Mercurial > fife-parpg
comparison engine/core/video/sdl/sdlimage.cpp @ 620:853d25234671
* Moved the GLEnable and GLDisable structures from opengl_gui_graphics.cpp to fife_opengl.h as they may prove to be useful elsewhere.
* Fixed the color mask definitions in fife_stdint.h
* Added the nextPow2() function to calculate the nearest (greater) power of 2
* Removed a bunch of re-definitions of RGB masks
* Modified GLImage to only generate one "texture chunk". I hope this makes better use of memory and speeds things up a hair
* Made use of the GLEnable structure when clearing the screen
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 30 Sep 2010 21:24:55 +0000 |
parents | d242e6ce6f9f |
children | f3457443c95f |
comparison
equal
deleted
inserted
replaced
619:f648bfbae5fe | 620:853d25234671 |
---|---|
282 if (dst_h < 1) | 282 if (dst_h < 1) |
283 dst_h = 1; | 283 dst_h = 1; |
284 | 284 |
285 // If source surface has no alpha channel then convert it | 285 // If source surface has no alpha channel then convert it |
286 if (src->format->Amask == 0) { | 286 if (src->format->Amask == 0) { |
287 Uint32 rmask, gmask, bmask, amask; | |
288 #if SDL_BYTEORDER == SDL_BIG_ENDIAN | |
289 rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; | |
290 #else | |
291 rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; | |
292 #endif | |
293 | |
294 zoom_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, | 287 zoom_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, |
295 rmask, gmask, | 288 RMASK, GMASK, |
296 bmask, amask); | 289 BMASK, AMASK); |
297 SDL_BlitSurface(src, NULL, zoom_src, NULL); | 290 SDL_BlitSurface(src, NULL, zoom_src, NULL); |
298 } else { | 291 } else { |
299 zoom_src = src; | 292 zoom_src = src; |
300 } | 293 } |
301 // Create destination surface | 294 // Create destination surface |
787 | 780 |
788 void SDLImage::saveImage(const std::string& filename) { | 781 void SDLImage::saveImage(const std::string& filename) { |
789 if(m_surface) { | 782 if(m_surface) { |
790 const unsigned int swidth = getWidth(); | 783 const unsigned int swidth = getWidth(); |
791 const unsigned int sheight = getHeight(); | 784 const unsigned int sheight = getHeight(); |
792 Uint32 rmask, gmask, bmask, amask; | |
793 SDL_Surface *surface = NULL; | 785 SDL_Surface *surface = NULL; |
794 | |
795 #if SDL_BYTEORDER == SDL_BIG_ENDIAN | |
796 rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; | |
797 #else | |
798 rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; | |
799 #endif | |
800 | 786 |
801 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, swidth, | 787 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, swidth, |
802 sheight, 24, | 788 sheight, 24, |
803 rmask, gmask, bmask, 0); | 789 RMASK, GMASK, BMASK, 0); |
804 | 790 |
805 if(surface == NULL) { | 791 if(surface == NULL) { |
806 return; | 792 return; |
807 } | 793 } |
808 | 794 |