comparison src/video/SDL_renderer_sw.c @ 1683:396a35389351 SDL-1.3

Finished palettized display handling. Added support for surface palette sharing.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 17 Jun 2006 06:45:14 +0000
parents 80a5e6a4e1e2
children c4aa1a2f48f1
comparison
equal deleted inserted replaced
1682:7ae8018b2e5d 1683:396a35389351
176 Bmask, Amask); 176 Bmask, Amask);
177 if (!data->screens[i]) { 177 if (!data->screens[i]) {
178 SDL_SW_DestroyRenderer(renderer); 178 SDL_SW_DestroyRenderer(renderer);
179 return NULL; 179 return NULL;
180 } 180 }
181 SDL_SetSurfacePalette(data->screens[i], window->display->palette);
181 } 182 }
182 data->current_screen = 0; 183 data->current_screen = 0;
183 data->target = data->screens[0]; 184 data->target = data->screens[0];
184 185
185 /* Find a render driver that we can use to display data */ 186 /* Find a render driver that we can use to display data */
246 const SDL_Color * colors, int firstcolor, 247 const SDL_Color * colors, int firstcolor,
247 int ncolors) 248 int ncolors)
248 { 249 {
249 SDL_Surface *surface = (SDL_Surface *) texture->driverdata; 250 SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
250 251
251 SDL_SetColors(surface, colors, firstcolor, ncolors); 252 return SDL_SetPaletteColors(surface->format->palette, colors, firstcolor,
252 return 0; 253 ncolors);
253 } 254 }
254 255
255 static int 256 static int
256 SDL_SW_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, 257 SDL_SW_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
257 SDL_Color * colors, int firstcolor, int ncolors) 258 SDL_Color * colors, int firstcolor, int ncolors)
312 313
313 static void 314 static void
314 SDL_SW_SelectRenderTexture(SDL_Renderer * renderer, SDL_Texture * texture) 315 SDL_SW_SelectRenderTexture(SDL_Renderer * renderer, SDL_Texture * texture)
315 { 316 {
316 SDL_SW_RenderData *data = (SDL_SW_RenderData *) renderer->driverdata; 317 SDL_SW_RenderData *data = (SDL_SW_RenderData *) renderer->driverdata;
317 data->target = (SDL_Surface *) texture->driverdata; 318
319 if (texture) {
320 data->target = (SDL_Surface *) texture->driverdata;
321 } else {
322 data->target = data->screens[data->current_screen];
323 }
318 } 324 }
319 325
320 static void 326 static void
321 SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect, 327 SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
322 Uint32 color) 328 Uint32 color)