MapSurface not being triggered on Palette->Bitfield blit after palette update

Hello list,

A simple, yet annoying issue with SDL 1.3 (latest HG) is that when you
change Surface’s palette (via SDL_SetPaletteColors or compat
SDL_SetColors), it is not reflected on subsequent blits onto bitfield
destinations.

A patch to fix that (luckily wrong):

diff -r a7142857e885 src/video/SDL_surface.c
— a/src/video/SDL_surface.c Mon Oct 24 12:07:41 2011 -0400
+++ b/src/video/SDL_surface.c Mon Oct 24 21:25:28 2011 +0400
@@ -494,7 +494,9 @@
/* Check to make sure the blit mapping is valid */
if ((src->map->dst != dst) ||
(dst->format->palette &&

  •     src->map->palette_version != dst->format->palette->version)) {
    
  •     src->map->palette_version != dst->format->palette->version) ||
    
  •     (src->format->palette &&
    
  •      src->map->palette_version != src->format->palette->version))
    
    { if (SDL_MapSurface(src, dst) < 0) {
    return (-1);
    }

Hello list,

Sorry for not realizing this earlier, but the issue I describe is in
fact http://bugzilla.libsdl.org/show_bug.cgi?id=1224 . There is a patch
attached, so I compared them and indeed my one was wrong. The two
variables are indeed needed, without them (the way I did it) you always
succeed at that test (making it pointless).

In short, I’m experiencing the problem described in bug 1224, I’ve
tested the patch attached there and it fixes it nicely. I also believe
the logic behind it is sound.

[patch]: http://bugzilla.libsdl.org/attachment.cgi?id=623&action=diffOn Mon, 24 Oct 2011 21:55:56 +0400 Driedfruit <@Driedfruit> wrote:

Hello list,

A simple, yet annoying issue with SDL 1.3 (latest HG) is that when you
change Surface’s palette (via SDL_SetPaletteColors or compat
SDL_SetColors), it is not reflected on subsequent blits onto bitfield
destinations.

A patch to fix that (luckily wrong):

diff -r a7142857e885 src/video/SDL_surface.c
— a/src/video/SDL_surface.c Mon Oct 24 12:07:41 2011 -0400
+++ b/src/video/SDL_surface.c Mon Oct 24 21:25:28 2011 +0400
@@ -494,7 +494,9 @@
/* Check to make sure the blit mapping is valid */
if ((src->map->dst != dst) ||
(dst->format->palette &&

  •     src->map->palette_version !=
    

dst->format->palette->version)) {

  •     src->map->palette_version != dst->format->palette->version)
    

||

  •     (src->format->palette &&
    
  •      src->map->palette_version !=
    

src->format->palette->version)) { if (SDL_MapSurface(src, dst) < 0) {
return (-1);
}


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org