illume avatar 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;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.