Commits

Anonymous committed d4c1a98

Fixed unset colorkey with Surface.set_colorkey

  • Participants
  • Parent commits a2e9f5a
  • Branches ctypes-soc

Comments (0)

Files changed (2)

+Pygame-ctypes 0.10
+------------------
+ - Fixed unset colorkey with Surface.set_colorkey
+
 Pygame-ctypes 0.09
 ------------------
  - pygame.mixer.Channel.get/set_endevent fixed

File pygame/surface.py

         if surf.flags & SDL_OPENGL:
             raise pygame.base.error, 'Cannot call on OPENGL surfaces'
 
+        if color is None:
+            SDL_SetColorKey(surf, 0, 0)
+            return
+
         rgba = pygame.base._rgba_from_obj(color)
         if rgba:
             color = SDL_MapRGBA(surf.format, rgba[0], rgba[1], rgba[2], rgba[3])
         if color and type(color) not in (int, long):
             raise 'invalid color argument'
-        if color is not None:
-            flags |= SDL_SRCCOLORKEY
 
+        flags |= SDL_SRCCOLORKEY
         SDL_SetColorKey(surf, flags, color)
         
     def get_colorkey(self):