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

Method Surface

src/Engine/Surface.cpp:137–157  ·  view source on GitHub ↗

* Sets up a blank 8bpp surface with the specified size and position, * with pure black as the transparent color. * @note Surfaces don't have to fill the whole size since their * background is transparent, specially subclasses with their own * drawing logic, so it just covers the maximum drawing area. * @param width Width in pixels. * @param height Height in pixels. * @param x X position in

Source from the content-addressed store, hash-verified

135 * @param bpp Bits-per-pixel depth.
136 */
137Surface::Surface(int width, int height, int x, int y, int bpp) : _x(x), _y(y), _visible(true), _hidden(false), _redraw(false), _alignedBuffer(0)
138{
139 _alignedBuffer = NewAligned(bpp, width, height);
140 _surface = SDL_CreateRGBSurfaceFrom(_alignedBuffer, width, height, bpp, GetPitch(bpp, width), 0, 0, 0, 0);
141
142 if (_surface == 0)
143 {
144 throw Exception(SDL_GetError());
145 }
146
147 SDL_SetColorKey(_surface, SDL_SRCCOLORKEY, 0);
148
149 _crop.w = 0;
150 _crop.h = 0;
151 _crop.x = 0;
152 _crop.y = 0;
153 _clear.x = 0;
154 _clear.y = 0;
155 _clear.w = getWidth();
156 _clear.h = getHeight();
157}
158
159/**
160 * Performs a deep copy of an existing surface.

Callers

nothing calls this directly

Calls 6

NewAlignedFunction · 0.85
GetPitchFunction · 0.85
ExceptionClass · 0.85
getWidthMethod · 0.45
getHeightMethod · 0.45
getPaletteMethod · 0.45

Tested by

no test coverage detected