Upscale screenshots 2x

The plan is to have Steam screenshots always be 2x, but in the VVVVVV
screenshots directory (for F6 keybind) save both 1x and 2x.

Again, just for now, the 2x screenshot is being saved to a temporary
location for testing and will get proper timestamps later.
This commit is contained in:
Misa
2024-01-07 17:56:26 -08:00
committed by Misa Elizabeth Kai
parent 20f0fafa5e
commit 93ec2c6cca
8 changed files with 76 additions and 4 deletions

View File

@@ -346,3 +346,40 @@ bool TakeScreenshot(SDL_Surface** surface)
return true;
}
bool UpscaleScreenshot2x(SDL_Surface* src, SDL_Surface** dest)
{
if (src == NULL)
{
SDL_assert(0 && "src is NULL!");
return false;
}
if (dest == NULL)
{
SDL_assert(0 && "dest is NULL!");
return false;
}
if (*dest == NULL)
{
*dest = SDL_CreateRGBSurface(
0, src->w * 2, src->h * 2, src->format->BitsPerPixel, 0, 0, 0, 0
);
if (*dest == NULL)
{
WHINE_ONCE_ARGS(
("Could not create temporary surface: %s", SDL_GetError())
);
return false;
}
}
int result = SDL_BlitScaled(src, NULL, *dest, NULL);
if (result != 0)
{
WHINE_ONCE_ARGS(("Could not blit surface: %s", SDL_GetError()));
return false;
}
return true;
}