MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / testSurface

Method testSurface

src/Menu/TestState.cpp:149–174  ·  view source on GitHub ↗

* Generates a surface with a row of every single color currently * loaded in the game palette (like a rainbow). First used for * testing 8bpp functionality, still useful for debugging palette issues. * @return Test surface. */

Source from the content-addressed store, hash-verified

147 * @return Test surface.
148 */
149SDL_Surface *TestState::testSurface()
150{
151 SDL_Surface *surface;
152
153 // Create surface
154 surface = SDL_CreateRGBSurface(SDL_HWSURFACE, 256, 25, 8, 0, 0, 0, 0);
155
156 if (surface == 0)
157 {
158 throw Exception(SDL_GetError());
159 }
160
161 // Lock the surface
162 SDL_LockSurface(surface);
163
164 Uint8 *index = (Uint8 *)surface->pixels;
165
166 for (int j = 0; j < 25; ++j)
167 for (int i = 0; i < 256; i++, ++index)
168 *index = i;
169
170 // Unlock the surface
171 SDL_UnlockSurface(surface);
172
173 return surface;
174}
175
176}

Callers

nothing calls this directly

Calls 1

ExceptionClass · 0.85

Tested by

no test coverage detected