mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-24 22:09:54 +00:00
examples/save-rendering-to-bitmaps: Dump alpha channel.
examples/renderer/20-blending triggered this: the renderer's framebuffer has an alpha channel, even if the window itself doesn't, so we ended up with some weird rendering in the onmouseover.webp when I rebuilt it.
This commit is contained in:
@@ -32,6 +32,11 @@ static bool SAVERENDERING_SDL_RenderPresent(SDL_Renderer *renderer)
|
||||
if (!surface) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Failed to read pixels for frame #%u! (%s)", framenum, SDL_GetError());
|
||||
} else {
|
||||
SDL_Surface *cvt = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_RGBX32);
|
||||
if (cvt) {
|
||||
SDL_DestroySurface(surface);
|
||||
surface = cvt;
|
||||
}
|
||||
char fname[64];
|
||||
SDL_snprintf(fname, sizeof (fname), "frame%05u.png", framenum);
|
||||
if (!SDL_SavePNG(surface, fname)) {
|
||||
|
||||
Reference in New Issue
Block a user