summaryrefslogtreecommitdiffstats
path: root/minui/resources.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-08-04 02:11:48 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-08-04 02:11:48 +0200
commit18834739ebc1da34aa677d1286abeae79ff69680 (patch)
tree28037d5a1099e2bdcc5c0b1bb91a02f4e1769d2f /minui/resources.cpp
parentMerge "ui: Read custom recovery UI values via system property." am: 2117b4bd07 am: 17bf8d0518 am: 814468deb5 (diff)
parentMerge "minui: Use runtime properties instead of build time vars." am: ebc04d1e7a am: ce0409a560 (diff)
downloadandroid_bootable_recovery-18834739ebc1da34aa677d1286abeae79ff69680.tar
android_bootable_recovery-18834739ebc1da34aa677d1286abeae79ff69680.tar.gz
android_bootable_recovery-18834739ebc1da34aa677d1286abeae79ff69680.tar.bz2
android_bootable_recovery-18834739ebc1da34aa677d1286abeae79ff69680.tar.lz
android_bootable_recovery-18834739ebc1da34aa677d1286abeae79ff69680.tar.xz
android_bootable_recovery-18834739ebc1da34aa677d1286abeae79ff69680.tar.zst
android_bootable_recovery-18834739ebc1da34aa677d1286abeae79ff69680.zip
Diffstat (limited to '')
-rw-r--r--minui/resources.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/minui/resources.cpp b/minui/resources.cpp
index c018d9b8c..477fbe2a2 100644
--- a/minui/resources.cpp
+++ b/minui/resources.cpp
@@ -207,9 +207,10 @@ int res_create_display_surface(const char* name, GRSurface** pSurface) {
return -8;
}
-#if defined(RECOVERY_ABGR) || defined(RECOVERY_BGRA)
- png_set_bgr(png_ptr);
-#endif
+ PixelFormat pixel_format = gr_pixel_format();
+ if (pixel_format == PixelFormat::ABGR || pixel_format == PixelFormat::BGRA) {
+ png_set_bgr(png_ptr);
+ }
for (png_uint_32 y = 0; y < height; ++y) {
std::vector<unsigned char> p_row(width * 4);
@@ -278,9 +279,9 @@ int res_create_multi_display_surface(const char* name, int* frames, int* fps,
}
}
-#if defined(RECOVERY_ABGR) || defined(RECOVERY_BGRA)
- png_set_bgr(png_ptr);
-#endif
+ if (gr_pixel_format() == PixelFormat::ABGR || gr_pixel_format() == PixelFormat::BGRA) {
+ png_set_bgr(png_ptr);
+ }
for (png_uint_32 y = 0; y < height; ++y) {
std::vector<unsigned char> p_row(width * 4);
@@ -327,9 +328,10 @@ int res_create_alpha_surface(const char* name, GRSurface** pSurface) {
surface->row_bytes = width;
surface->pixel_bytes = 1;
-#if defined(RECOVERY_ABGR) || defined(RECOVERY_BGRA)
- png_set_bgr(png_ptr);
-#endif
+ PixelFormat pixel_format = gr_pixel_format();
+ if (pixel_format == PixelFormat::ABGR || pixel_format == PixelFormat::BGRA) {
+ png_set_bgr(png_ptr);
+ }
for (png_uint_32 y = 0; y < height; ++y) {
unsigned char* p_row = surface->data + y * surface->row_bytes;