summaryrefslogtreecommitdiffstats
path: root/minui/resources.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-08-01 06:32:50 +0200
committerTao Bao <tbao@google.com>2018-08-02 00:36:41 +0200
commited876a7175c54a68735e8bcacd1a22cbc84034ed (patch)
tree62857f4b3ef659dcbf137c6c917e23ee029e3dd6 /minui/resources.cpp
parentMerge "minui: Clean up the use of `rotation`." (diff)
downloadandroid_bootable_recovery-ed876a7175c54a68735e8bcacd1a22cbc84034ed.tar
android_bootable_recovery-ed876a7175c54a68735e8bcacd1a22cbc84034ed.tar.gz
android_bootable_recovery-ed876a7175c54a68735e8bcacd1a22cbc84034ed.tar.bz2
android_bootable_recovery-ed876a7175c54a68735e8bcacd1a22cbc84034ed.tar.lz
android_bootable_recovery-ed876a7175c54a68735e8bcacd1a22cbc84034ed.tar.xz
android_bootable_recovery-ed876a7175c54a68735e8bcacd1a22cbc84034ed.tar.zst
android_bootable_recovery-ed876a7175c54a68735e8bcacd1a22cbc84034ed.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;