36 Uint32 rMask, Uint32 gMask, Uint32 bMask, Uint32 aMask)
38 assert((depth % 8) == 0);
39 unsigned pitch = width * (depth >> 3);
40 unsigned size = height * pitch;
41 buffer = malloc(size);
42 if (!buffer)
throw std::bad_alloc();
43 surface = SDL_CreateRGBSurfaceFrom(
44 buffer, width, height, depth, pitch,
45 rMask, gMask, bMask, aMask);
48 throw std::bad_alloc();
58 void* buffer_ =
nullptr)
65 : surface(other.surface)
66 , buffer(other.buffer)
68 other.surface =
nullptr;
69 other.buffer =
nullptr;
75 SDL_FreeSurface(surface);
80 void reset(SDL_Surface* surface_ =
nullptr)
90 const SDL_Surface*
get()
const
104 other.surface =
nullptr;
105 other.buffer =
nullptr;
130 assert(y <
unsigned(surface->h));
131 return static_cast<Uint8*
>(surface->pixels) + y * surface->pitch;
139 SDL_Surface* surface;