diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 8241dc486..3555b328a 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -1598,19 +1598,28 @@ static void Printscreen() GError *error = NULL; u8 *rgb; 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) 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, GDK_COLORSPACE_RGB, FALSE, 8, - 256, - 192*2, - 256*3, + W, + H, + W*SCREEN_BYTES_PER_PIXEL, NULL, NULL);