diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2015-12-28 21:54:50 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2016-01-27 17:53:13 +0100 |
commit | fbb4353a247157d32208f8f133cd1ee42f4fbc49 (patch) | |
tree | 6f819fbdd21f2adef4f7ba4a5b4d02054cc02f29 /minuitwrp/graphics_utils.cpp | |
parent | Adopted Storage support (diff) | |
download | android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.gz android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.bz2 android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.lz android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.xz android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.zst android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.zip |
Diffstat (limited to '')
-rw-r--r-- | minuitwrp/graphics_utils.cpp (renamed from minuitwrp/graphics_utils.c) | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/minuitwrp/graphics_utils.c b/minuitwrp/graphics_utils.cpp index ea1182dd9..6ce570484 100644 --- a/minuitwrp/graphics_utils.c +++ b/minuitwrp/graphics_utils.cpp @@ -23,7 +23,8 @@ #include "minui.h" struct fb_var_screeninfo vi; -GGLSurface gr_mem_surface; +extern GGLSurface gr_mem_surface; +extern GRSurface* gr_draw; int gr_save_screenshot(const char *dest) { @@ -41,7 +42,11 @@ int gr_save_screenshot(const char *dest) if(!fp) goto exit; - img_data = malloc(gr_mem_surface.stride * vi.yres * 4); + img_data = (uint8_t *)malloc(gr_mem_surface.stride * gr_mem_surface.height * gr_draw->pixel_bytes); + if (!img_data) { + printf("gr_save_screenshot failed to malloc img_data\n"); + goto exit; + } surface.version = sizeof(surface); surface.width = gr_mem_surface.width; surface.height = gr_mem_surface.height; |