1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 12:00:59 +00:00

embed/unix: save only cropped part of the screenshot

This commit is contained in:
Pavol Rusnak 2018-07-02 17:10:18 +02:00
parent 35dcd917dd
commit 657de0274d
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -162,8 +162,12 @@ void display_save(const char *prefix)
static uint32_t cnt = 0;
char fname[256];
snprintf(fname, sizeof(fname), "%s%08d.png", prefix, cnt);
IMG_SavePNG(BUFFER, fname);
fprintf(stderr, "Saved display buffer to %s\n", fname);
const SDL_Rect rect = {0, 0, DISPLAY_RESX, DISPLAY_RESY};
SDL_Surface *crop = SDL_CreateRGBSurface(BUFFER->flags, rect.w, rect.h, BUFFER->format->BitsPerPixel, BUFFER->format->Rmask, BUFFER->format->Gmask, BUFFER->format->Bmask, BUFFER->format->Amask);
SDL_BlitSurface(BUFFER, &rect, crop, NULL);
IMG_SavePNG(crop, fname);
SDL_FreeSurface(crop);
fprintf(stderr, "Saved screenshot to %s\n", fname);
cnt++;
#endif
}