Update of /cvsroot/super-tux/supertux/src/screen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv324/src/screen
Modified Files:
texture.cpp
Log Message:
Passed color mask from screen SDL_Surface to the gradients cache one. This fixes the slowness.
Still, there are problems when scrolling. This looks like some background issue, but dunno where.
Index: texture.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/screen/texture.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- texture.cpp 10 Jun 2004 14:09:49 -0000 1.5
+++ texture.cpp 12 Jun 2004 15:42:24 -0000 1.6
@@ -366,44 +366,29 @@
{
SDL_Surface* sdl_surface;
- Uint32 rmask, gmask, bmask, amask;
-
- /* SDL interprets each pixel as a 32-bit number, so our masks must depend
- on the endianness (byte order) of the machine */
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- rmask = 0xff000000;
- gmask = 0x00ff0000;
- bmask = 0x0000ff00;
- amask = 0x000000ff;
-#else
- rmask = 0x000000ff;
- gmask = 0x0000ff00;
- bmask = 0x00ff0000;
- amask = 0xff000000;
-#endif
-
- sdl_surface = SDL_CreateRGBSurface(screen->flags, w, h,
- screen->format->BitsPerPixel, rmask, gmask, bmask, amask);
+ sdl_surface = SDL_CreateRGBSurface(screen->flags, w, h,
+ screen->format->BitsPerPixel, screen->format->Rmask,
+ screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
- if(sdl_surface == NULL)
- st_abort("Cannot create surface for the gradient", "SURFACE");
+ if(sdl_surface == NULL)
+ st_abort("Cannot create surface for the gradient", "SURFACE");
- float redstep = (float(bottom.red)-float(top.red)) / float(h);
- float greenstep = (float(bottom.green)-float(top.green)) / float(h);
- float bluestep = (float(bottom.blue) - float(top.blue)) / float(h);
+ float redstep = (float(bottom.red)-float(top.red)) / float(h);
+ float greenstep = (float(bottom.green)-float(top.green)) / float(h);
+ float bluestep = (float(bottom.blue) - float(top.blue)) / float(h);
- SDL_Rect rect;
- rect.x = 0;
- rect.w = w;
- rect.h = 1;
- for(float y = 0; y < h; y++)
- {
- rect.y = (int)y;
- SDL_FillRect(sdl_surface, &rect, SDL_MapRGB(sdl_surface->format,
- int(float(top.red) + redstep * y),
- int(float(top.green) + greenstep * y),
- int(float(top.blue) + bluestep * y)));
- }
+ SDL_Rect rect;
+ rect.x = 0;
+ rect.w = w;
+ rect.h = 1;
+ for(float y = 0; y < h; y++)
+ {
+ rect.y = (int)y;
+ SDL_FillRect(sdl_surface, &rect, SDL_MapRGB(sdl_surface->format,
+ int(float(top.red) + redstep * y),
+ int(float(top.green) + greenstep * y),
+ int(float(top.blue) + bluestep * y)));
+ }
return sdl_surface;
}
|