comparison src/video/dummy/SDL_nullvideo.c @ 1676:e136f3ffdc1b SDL-1.3

Adding software renderer implementation
author Sam Lantinga <slouken@libsdl.org>
date Mon, 12 Jun 2006 09:10:06 +0000
parents 9857d21967bb
children 5e4c5e095925
comparison
equal deleted inserted replaced
1675:d33dcfc3fde7 1676:e136f3ffdc1b
99 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); 99 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
100 100
101 /* Set the function pointers */ 101 /* Set the function pointers */
102 device->VideoInit = DUMMY_VideoInit; 102 device->VideoInit = DUMMY_VideoInit;
103 device->SetDisplayMode = DUMMY_SetDisplayMode; 103 device->SetDisplayMode = DUMMY_SetDisplayMode;
104 device->CreateWindowSurface = DUMMY_CreateWindowSurface;
105 device->UpdateWindowSurface = DUMMY_UpdateWindowSurface;
106 device->VideoQuit = DUMMY_VideoQuit; 104 device->VideoQuit = DUMMY_VideoQuit;
107 device->InitOSKeymap = DUMMY_InitOSKeymap;
108 device->PumpEvents = DUMMY_PumpEvents; 105 device->PumpEvents = DUMMY_PumpEvents;
109 106
110 device->free = DUMMY_DeleteDevice; 107 device->free = DUMMY_DeleteDevice;
111 108
112 return device; 109 return device;
137 { 134 {
138 SDL_CurrentDisplay.current_mode = *mode; 135 SDL_CurrentDisplay.current_mode = *mode;
139 return 0; 136 return 0;
140 } 137 }
141 138
142 static void
143 DUMMY_CreateWindowSurface(_THIS, SDL_Window * window, Uint32 flags)
144 {
145 int bpp;
146 Uint32 Rmask, Gmask, Bmask, Amask;
147
148 SDL_PixelFormatEnumToMasks(SDL_GetCurrentDisplayMode()->format, &bpp,
149 &Rmask, &Gmask, &Bmask, &Amask);
150 window->surface =
151 SDL_CreateRGBSurface(flags, window->w, window->h, bpp, Rmask, Gmask,
152 Bmask, Amask);
153 }
154
155 static void
156 DUMMY_UpdateWindowSurface(_THIS, SDL_Window * window, int numrects,
157 SDL_Rect * rects)
158 {
159 static int frame_number;
160 if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) {
161 char file[128];
162 SDL_snprintf(file, sizeof(file), "SDL_screen-%8.8d.bmp",
163 ++frame_number);
164 SDL_SaveBMP(window->surface, file);
165 }
166 }
167
168 /* Note: If we are terminated, this could be called in the middle of
169 another SDL video routine -- notably UpdateRects.
170 */
171 void 139 void
172 DUMMY_VideoQuit(_THIS) 140 DUMMY_VideoQuit(_THIS)
173 { 141 {
174 } 142 }
175 143