Commits

illume committed 3e7d2a8

disable gil release for image save with png, and jpeg on windows.

Comments (0)

Files changed (1)

     surf_flags = surface->flags & (SDL_SRCALPHA | SDL_SRCCOLORKEY);
     surf_alpha = surface->format->alpha;
     if (surf_flags & SDL_SRCALPHA)
-	SDL_SetAlpha (surface, 0, 255);
+        SDL_SetAlpha (surface, 0, 255);
     if (surf_flags & SDL_SRCCOLORKEY)
-	SDL_SetColorKey (surface, 0, surface->format->colorkey);
+        SDL_SetColorKey (surface, 0, surface->format->colorkey);
 
     ss_rect.x = 0;
     ss_rect.y = 0;
             return -1;
     }
     if (surf_flags & SDL_SRCALPHA)
-	SDL_SetAlpha (surface, SDL_SRCALPHA, (Uint8)surf_alpha);
+        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, surface->format->colorkey);
 
     for (i = 0; i < ss_h; i++)
     {
         if (!PyArg_ParseTuple (arg, "O|s", &file, &name))
             return NULL;
         namelen = strlen (name);
-        Py_BEGIN_ALLOW_THREADS;
         if ((namelen > 3) &&
             (((name[namelen - 1]=='g' || name[namelen - 1]=='G') &&
                 (name[namelen - 2]=='n' || name[namelen - 2]=='N') &&
                 (name[namelen - 3]=='j' || name[namelen - 3]=='J'))))
         {
 #ifdef JPEGLIB_H
+#ifndef MS_WIN32
+            Py_BEGIN_ALLOW_THREADS;
+#endif
             result = SaveJPEG (surf, name);
+#ifndef MS_WIN32
+            Py_END_ALLOW_THREADS;
+#endif
+
 #else
             return RAISE (PyExc_SDLError, "No support for jpg compiled in.");
 #endif
         else if (name[namelen-1]=='g' || name[namelen-1]=='G')
         {
 #ifdef PNG_H
+#ifndef MS_WIN32
+            Py_BEGIN_ALLOW_THREADS;
+#endif
             result = SavePNG (surf, name);
+#ifndef MS_WIN32
+            Py_END_ALLOW_THREADS;
+#endif
 #else
             return RAISE (PyExc_SDLError, "No support for png compiled in.");
 #endif
 
         else
             result = -1;
-        Py_END_ALLOW_THREADS;
     }
     else
         return NULL;