Don't crash taking a screenshot on non default rotation / orientation
Patch from #2998869 by noodlebox.
This commit is contained in:
parent
0e61c45d5f
commit
1c31be8a5c
|
@ -1598,19 +1598,28 @@ static void Printscreen()
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
u8 *rgb;
|
u8 *rgb;
|
||||||
static int seq = 0;
|
static int seq = 0;
|
||||||
|
gint H, W;
|
||||||
|
|
||||||
rgb = (u8 *) malloc(SCREENS_PIXEL_SIZE*3);
|
rgb = (u8 *) malloc(SCREENS_PIXEL_SIZE*SCREEN_BYTES_PER_PIXEL);
|
||||||
if (!rgb)
|
if (!rgb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gpu_screen_to_rgb(rgb, SCREENS_PIXEL_SIZE);
|
if (nds_screen.rotation_angle == 0 || nds_screen.rotation_angle == 180) {
|
||||||
|
W = screen_size[nds_screen.orientation].width;
|
||||||
|
H = screen_size[nds_screen.orientation].height;
|
||||||
|
} else {
|
||||||
|
W = screen_size[nds_screen.orientation].height;
|
||||||
|
H = screen_size[nds_screen.orientation].width;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpu_screen_to_rgb(rgb, W*H*SCREEN_BYTES_PER_PIXEL);
|
||||||
screenshot = gdk_pixbuf_new_from_data(rgb,
|
screenshot = gdk_pixbuf_new_from_data(rgb,
|
||||||
GDK_COLORSPACE_RGB,
|
GDK_COLORSPACE_RGB,
|
||||||
FALSE,
|
FALSE,
|
||||||
8,
|
8,
|
||||||
256,
|
W,
|
||||||
192*2,
|
H,
|
||||||
256*3,
|
W*SCREEN_BYTES_PER_PIXEL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue