screenshot: one simple trick to reduce the file size
This commit is contained in:
parent
66c16be3a5
commit
d0fb331aa4
|
@ -91,13 +91,13 @@ togglezoom(Uxn *u)
|
||||||
static void
|
static void
|
||||||
screencapture(void)
|
screencapture(void)
|
||||||
{
|
{
|
||||||
const Uint32 format = SDL_PIXELFORMAT_ARGB8888;
|
const Uint32 format = SDL_PIXELFORMAT_RGB24;
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
char fname[64];
|
char fname[64];
|
||||||
int w, h;
|
int w, h;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
SDL_GetRendererOutputSize(gRenderer, &w, &h);
|
SDL_GetRendererOutputSize(gRenderer, &w, &h);
|
||||||
surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 32, format);
|
surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 24, format);
|
||||||
SDL_RenderReadPixels(gRenderer, NULL, format, surface->pixels, surface->pitch);
|
SDL_RenderReadPixels(gRenderer, NULL, format, surface->pixels, surface->pitch);
|
||||||
strftime(fname, sizeof(fname), "screenshot-%Y%m%d-%H%M%S.bmp", localtime(&t));
|
strftime(fname, sizeof(fname), "screenshot-%Y%m%d-%H%M%S.bmp", localtime(&t));
|
||||||
SDL_SaveBMP(surface, fname);
|
SDL_SaveBMP(surface, fname);
|
||||||
|
|
Loading…
Reference in New Issue