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:
Ryan C. Gordon
2026-05-20 00:40:25 -04:00
parent 35098e927c
commit 8fe1d7faec

View File

@@ -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)) {