src/SDL12_compat.c
changeset 92 b62ce3deedf4
parent 91 ecc70507b655
child 93 20605b15ca8c
equal deleted inserted replaced
91:ecc70507b655 92:b62ce3deedf4
  2112 }
  2112 }
  2113 
  2113 
  2114 DECLSPEC SDL12_Surface * SDLCALL
  2114 DECLSPEC SDL12_Surface * SDLCALL
  2115 SDL_CreateRGBSurface(Uint32 sdl12flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
  2115 SDL_CreateRGBSurface(Uint32 sdl12flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
  2116 {
  2116 {
       
  2117     if (depth == 8) {
       
  2118         Rmask = Gmask = Bmask = Amask = 0;  // force a paletted surface.
       
  2119     }
  2117     SDL_Surface *surface20 = SDL20_CreateRGBSurface(0, width, height, depth, Rmask, Gmask, Bmask, Amask);
  2120     SDL_Surface *surface20 = SDL20_CreateRGBSurface(0, width, height, depth, Rmask, Gmask, Bmask, Amask);
  2118     SDL12_Surface *surface12 = Surface20to12(surface20);
  2121     SDL12_Surface *surface12 = Surface20to12(surface20);
  2119     if (!surface12) {
  2122     if (!surface12) {
  2120         SDL20_FreeSurface(surface20);
  2123         SDL20_FreeSurface(surface20);
  2121         return NULL;
  2124         return NULL;
  2126 }
  2129 }
  2127 
  2130 
  2128 DECLSPEC SDL12_Surface * SDLCALL
  2131 DECLSPEC SDL12_Surface * SDLCALL
  2129 SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
  2132 SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
  2130 {
  2133 {
       
  2134     if (depth == 8) {
       
  2135         Rmask = Gmask = Bmask = Amask = 0;  // force a paletted surface.
       
  2136     }
  2131     SDL_Surface *surface20 = SDL20_CreateRGBSurfaceFrom(pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask);
  2137     SDL_Surface *surface20 = SDL20_CreateRGBSurfaceFrom(pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask);
  2132     SDL12_Surface *surface12 = Surface20to12(surface20);
  2138     SDL12_Surface *surface12 = Surface20to12(surface20);
  2133     if (!surface12) {
  2139     if (!surface12) {
  2134         SDL20_FreeSurface(surface20);
  2140         SDL20_FreeSurface(surface20);
  2135         return NULL;
  2141         return NULL;