Commits

Anonymous committed 7f4e074

compiler warning cleanups

Comments (0)

Files changed (3)

 import pygame.mouse
 import pygame.time
 import pygame.joystick
+
+#these following imports don't really effect
+#pygame at all, but they help python windows
+#executable builders find all the modules :]
+import pygame.surflock as __surflock
+import pygame.rwobject as __rwobject
 	SDL_Surface* surf = PySurface_AsSurface(self);
 	SDL_PixelFormat* format = surf->format;
 	Uint8* pixels = (Uint8*)surf->pixels;
-	int didlock = 0;
 	int x, y;
 	Uint32 color;
 	Uint8* pix;
 	Uint8 rgba[4];
 	PyObject* rgba_obj;
 	Uint8* byte_buf;
-	int didlock = 0;
 
 	if(!PyArg_ParseTuple(args, "(ii)O", &x, &y, &rgba_obj))
 		return NULL;
 
 static PyObject* surf_lock(PyObject* self, PyObject* args)
 {
-	SDL_Surface* surf = PySurface_AsSurface(self);
-
 	if(!PyArg_ParseTuple(args, ""))
 		return NULL;
 
 
 static PyObject* surf_unlock(PyObject* self, PyObject* args)
 {
-	SDL_Surface* surf = PySurface_AsSurface(self);
-
 	if(!PyArg_ParseTuple(args, ""))
 		return NULL;
 
     /*DOC*/    "overall surface transparency. You'll need to change the actual\n"
     /*DOC*/    "pixel transparency to make changes.\n"
     /*DOC*/    "\n"
-    /*DOC*/    "If your image is nonchanging and will be used repeatedly, you\n"
+    /*DOC*/    "If your image also has pixel alpha values, will be used repeatedly, you\n"
     /*DOC*/    "will probably want to pass the RLEACCEL flag to the call. This\n"
     /*DOC*/    "will take a short time to compile your surface, and increase the\n"
     /*DOC*/    "blitting speed.\n"
 	GAME_Rect *rect, temp;
 	SDL_Surface* sub;
 	PyObject* subobj;
-	int didlock = 0;
 	int pixeloffset;
 	char* startpixel;
 	struct SubSurface_Data* data;
 		return RAISE(PyExc_ValueError, "subsurface rectangle outside surface area");
 
 
-	if(!surf->pixels)
-	{
-		if(SDL_LockSurface(surf) == -1)
-			return RAISE(PyExc_SDLError, SDL_GetError());
-		didlock = 1;
-	}
+	PySurface_Lock(self);
 
 	pixeloffset = rect->x * format->BytesPerPixel + rect->y * surf->pitch;
 	startpixel = ((char*)surf->pixels) + pixeloffset;
 	sub = SDL_CreateRGBSurfaceFrom(startpixel, rect->w, rect->h, format->BitsPerPixel, \
 				surf->pitch, format->Rmask, format->Gmask, format->Bmask, format->Amask);
 
-	if(didlock)
-		SDL_UnlockSurface(surf);
+	PySurface_Unlock(self);
 		
 	if(!sub)
 		return RAISE(PyExc_SDLError, SDL_GetError());
 	PyObject* array;
 	SDL_Surface* surf;
 	int stridex, stridey;
-	int didlock = 0;
 
 	if(!PyArg_ParseTuple(arg, "O!", &PySurface_Type, &array))
 		return NULL;
 	int Rmask, Gmask, Bmask, Rshift, Gshift, Bshift;
 	int stridex, stridey;
 	SDL_Color* palette;
-	int didlock = 0;
 
 	if(!PyArg_ParseTuple(arg, "O!", &PySurface_Type, &array))
 		return NULL;
 	PyObject* array;
 	SDL_Surface* surf;
 	int stridex, stridey;
-	int didlock = 0;
 	int Ashift, Amask, Aloss;
 
 	if(!PyArg_ParseTuple(arg, "O!", &PySurface_Type, &array))
 	PyObject* array;
 	SDL_Surface* surf;
 	int stridex, stridey;
-	int didlock = 0;
 
 	if(!PyArg_ParseTuple(arg, "O!", &PySurface_Type, &array))
 		return NULL;
 	int loopx, loopy;
 	int stridex, stridey, stridez=0, stridez2=0, sizex, sizey;
 	int Rloss, Gloss, Bloss, Rshift, Gshift, Bshift;
-	int didlock = 0;
 
 	if(!PyArg_ParseTuple(arg, "O!O!", &PySurface_Type, &surfobj, &PyArray_Type, &arrayobj))
 		return NULL;