14 const SDL_PixelFormat& format,
unsigned maxWidth_,
unsigned height)
20 unsigned bytesPerPixel = format.BytesPerPixel;
23 surface.
reset(SDL_CreateRGBSurface(
24 SDL_HWSURFACE, maxWidth, height, format.BitsPerPixel,
25 format.Rmask, format.Gmask, format.Bmask, format.Amask));
27 throw FatalError(
"Couldn't allocate surface.");
35 data =
static_cast<char*
>(surface->pixels);
36 pitch = surface->pitch;
42 pitch = ((bytesPerPixel * maxWidth) + 63) & ~63;
43 data =
reinterpret_cast<char*
>(
46 maxWidth = pitch / bytesPerPixel;
51 for (
unsigned line = 0; line < height; line++) {
52 if (bytesPerPixel == 2) {
53 setBlank(line, static_cast<word>(0));
55 setBlank(line, static_cast<unsigned>(0));
76 return lineWidths[line];
85 width = lineWidths[line];
86 return data + line * pitch;
103 if (SDL_MUSTLOCK(surface.
get())) SDL_LockSurface(surface.
get());
111 if (SDL_MUSTLOCK(surface.
get())) SDL_UnlockSurface(surface.
get());