comparison src/video/dummy/SDL_nullrender.c @ 1706:1577404809f0 SDL-1.3

Added a multi-window version of testsprite using the new API.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 24 Jun 2006 16:51:01 +0000
parents 396a35389351
children a1ebb17f9c52
comparison
equal deleted inserted replaced
1705:fc731a7d83ed 1706:1577404809f0
61 } SDL_DUMMY_RenderData; 61 } SDL_DUMMY_RenderData;
62 62
63 SDL_Renderer * 63 SDL_Renderer *
64 SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags) 64 SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags)
65 { 65 {
66 SDL_DisplayMode *displayMode = &window->display->current_mode; 66 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
67 SDL_DisplayMode *displayMode = &display->current_mode;
67 SDL_Renderer *renderer; 68 SDL_Renderer *renderer;
68 SDL_DUMMY_RenderData *data; 69 SDL_DUMMY_RenderData *data;
69 int i, n; 70 int i, n;
70 int bpp; 71 int bpp;
71 Uint32 Rmask, Gmask, Bmask, Amask; 72 Uint32 Rmask, Gmask, Bmask, Amask;
94 renderer->RenderReadPixels = SDL_DUMMY_RenderReadPixels; 95 renderer->RenderReadPixels = SDL_DUMMY_RenderReadPixels;
95 renderer->RenderWritePixels = SDL_DUMMY_RenderWritePixels; 96 renderer->RenderWritePixels = SDL_DUMMY_RenderWritePixels;
96 renderer->RenderPresent = SDL_DUMMY_RenderPresent; 97 renderer->RenderPresent = SDL_DUMMY_RenderPresent;
97 renderer->DestroyRenderer = SDL_DUMMY_DestroyRenderer; 98 renderer->DestroyRenderer = SDL_DUMMY_DestroyRenderer;
98 renderer->info = SDL_DUMMY_RenderDriver.info; 99 renderer->info = SDL_DUMMY_RenderDriver.info;
99 renderer->window = window; 100 renderer->window = window->id;
100 renderer->driverdata = data; 101 renderer->driverdata = data;
101 102
102 data->surface = 103 data->surface =
103 SDL_CreateRGBSurface(0, window->w, window->h, bpp, Rmask, Gmask, 104 SDL_CreateRGBSurface(0, window->w, window->h, bpp, Rmask, Gmask,
104 Bmask, Amask); 105 Bmask, Amask);
105 if (!data->surface) { 106 if (!data->surface) {
106 SDL_DUMMY_DestroyRenderer(renderer); 107 SDL_DUMMY_DestroyRenderer(renderer);
107 return NULL; 108 return NULL;
108 } 109 }
109 SDL_SetSurfacePalette(data->surface, window->display->palette); 110 SDL_SetSurfacePalette(data->surface, display->palette);
110 111
111 return renderer; 112 return renderer;
112 } 113 }
113 114
114 int 115 int
168 SDL_Surface *surface = data->surface; 169 SDL_Surface *surface = data->surface;
169 170
170 if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) { 171 if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) {
171 char file[128]; 172 char file[128];
172 SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", 173 SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp",
173 renderer->window->id, ++frame_number); 174 renderer->window, ++frame_number);
174 SDL_SaveBMP(surface, file); 175 SDL_SaveBMP(surface, file);
175 } 176 }
176 } 177 }
177 178
178 void 179 void