diff 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
line wrap: on
line diff
--- a/src/video/SDL_renderer_sw.c	Fri Jun 16 06:00:31 2006 +0000
+++ b/src/video/SDL_renderer_sw.c	Sat Jun 17 06:45:14 2006 +0000
@@ -178,6 +178,7 @@
             SDL_SW_DestroyRenderer(renderer);
             return NULL;
         }
+        SDL_SetSurfacePalette(data->screens[i], window->display->palette);
     }
     data->current_screen = 0;
     data->target = data->screens[0];
@@ -248,8 +249,8 @@
 {
     SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
 
-    SDL_SetColors(surface, colors, firstcolor, ncolors);
-    return 0;
+    return SDL_SetPaletteColors(surface->format->palette, colors, firstcolor,
+                                ncolors);
 }
 
 static int
@@ -314,7 +315,12 @@
 SDL_SW_SelectRenderTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
     SDL_SW_RenderData *data = (SDL_SW_RenderData *) renderer->driverdata;
-    data->target = (SDL_Surface *) texture->driverdata;
+
+    if (texture) {
+        data->target = (SDL_Surface *) texture->driverdata;
+    } else {
+        data->target = data->screens[data->current_screen];
+    }
 }
 
 static void