comparison src/video/dummy/SDL_nullrender.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 7ae8018b2e5d
children 1577404809f0
comparison
equal deleted inserted replaced
1682:7ae8018b2e5d 1683:396a35389351
104 Bmask, Amask); 104 Bmask, Amask);
105 if (!data->surface) { 105 if (!data->surface) {
106 SDL_DUMMY_DestroyRenderer(renderer); 106 SDL_DUMMY_DestroyRenderer(renderer);
107 return NULL; 107 return NULL;
108 } 108 }
109 109 SDL_SetSurfacePalette(data->surface, window->display->palette);
110 /* If the display has a palette, use it for the window surfaces */
111 if (window->display->palette.ncolors) {
112 SDL_PixelFormat *format = data->surface->format;
113 if (format->palette->colors) {
114 SDL_free(format->palette->colors);
115 }
116 SDL_free(format->palette);
117 format->palette = &window->display->palette;
118 }
119 110
120 return renderer; 111 return renderer;
121 } 112 }
122 113
123 int 114 int
176 (SDL_DUMMY_RenderData *) renderer->driverdata; 167 (SDL_DUMMY_RenderData *) renderer->driverdata;
177 SDL_Surface *surface = data->surface; 168 SDL_Surface *surface = data->surface;
178 169
179 if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) { 170 if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) {
180 char file[128]; 171 char file[128];
181 SDL_snprintf(file, sizeof(file), "SDL_frame-%8.8d.bmp", 172 SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp",
182 ++frame_number); 173 renderer->window->id, ++frame_number);
183 SDL_SaveBMP(surface, file); 174 SDL_SaveBMP(surface, file);
184 } 175 }
185 } 176 }
186 177
187 void 178 void