MCPcopy Create free account
hub / github.com/diasurgical/devilution / dx_create_back_buffer

Function dx_create_back_buffer

SourceX/dx.cpp:33–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31SDL_Surface *pal_surface;
32
33static 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
55static void dx_create_primary_surface()
56{

Callers 1

dx_initFunction · 0.85

Calls 1

Tested by

no test coverage detected