Make sure we bump the palette version when we modify it.
authorSam Lantinga <slouken@libsdl.org>
Sun, 24 Mar 2013 10:37:16 -0700
changeset 7025 4eb8ac58642c
parent 7024 72cb3e205571
child 7026 bc089599bd82
Make sure we bump the palette version when we modify it.
src/video/SDL_surface.c
--- a/src/video/SDL_surface.c	Sun Mar 24 09:56:45 2013 -0700
+++ b/src/video/SDL_surface.c	Sun Mar 24 10:37:16 2013 -0700
@@ -189,10 +189,18 @@
         surface->map->info.colorkey = key;
         if (surface->format->palette) {
             surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_TRANSPARENT;
+            ++surface->format->palette->version;
+            if (!surface->format->palette->version) {
+                surface->format->palette->version = 1;
+            }
         }
     } else {
         if (surface->format->palette) {
             surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_OPAQUE;
+            ++surface->format->palette->version;
+            if (!surface->format->palette->version) {
+                surface->format->palette->version = 1;
+            }
         }
         surface->map->info.flags &= ~SDL_COPY_COLORKEY;
     }