| 31 | SDL_Surface *pal_surface; |
| 32 | |
| 33 | static void dx_create_back_buffer() |
| 34 | { |
| 35 | pal_surface = SDL_CreateRGBSurfaceWithFormat(0, BUFFER_WIDTH, BUFFER_HEIGHT, 8, SDL_PIXELFORMAT_INDEX8); |
| 36 | if (pal_surface == NULL) { |
| 37 | ErrSdl(); |
| 38 | } |
| 39 | |
| 40 | gpBuffer = (BYTE *)pal_surface->pixels; |
| 41 | |
| 42 | #ifndef USE_SDL1 |
| 43 | // In SDL2, `pal_surface` points to the global `palette`. |
| 44 | if (SDL_SetSurfacePalette(pal_surface, palette) < 0) |
| 45 | ErrSdl(); |
| 46 | #else |
| 47 | // In SDL1, `pal_surface` owns its palette and we must update it every |
| 48 | // time the global `palette` is changed. No need to do anything here as |
| 49 | // the global `palette` doesn't have any colors set yet. |
| 50 | #endif |
| 51 | |
| 52 | pal_surface_palette_version = 1; |
| 53 | } |
| 54 | |
| 55 | static void dx_create_primary_surface() |
| 56 | { |
no test coverage detected