Commits

Anonymous committed 817356a

Fixed colorkey loss on saving a sdl.video.Surface as png file.

  • Participants
  • Parent commits 5f4a3d7
  • Branches pgreloaded

Comments (0)

Files changed (1)

 
     unsigned surf_flags;
     unsigned surf_alpha;
+    unsigned surf_colorkey;
 
     if (!surface)
     {
     
     surf_flags = surface->flags & (SDL_SRCALPHA | SDL_SRCCOLORKEY);
     surf_alpha = surface->format->alpha;
+    surf_colorkey = surface->format->colorkey;
+
     if (surf_flags & SDL_SRCALPHA)
         SDL_SetAlpha (surface, 0, 255);
     if (surf_flags & SDL_SRCCOLORKEY)
     if (surf_flags & SDL_SRCALPHA)
         SDL_SetAlpha (surface, SDL_SRCALPHA, (Uint8)surf_alpha);
     if (surf_flags & SDL_SRCCOLORKEY)
-        SDL_SetColorKey (surface, SDL_SRCCOLORKEY, surface->format->colorkey);
+        SDL_SetColorKey (surface, SDL_SRCCOLORKEY, surf_colorkey);
 
     for (i = 0; i < ss_h; i++)
     {