From cc7b7eb7379f08d113133b865a28dd9c3b0f0852 Mon Sep 17 00:00:00 2001 From: Adrian Salido Date: Thu, 12 Dec 2019 20:18:09 -0800 Subject: minui: add ARGB_8888 format Minui currently really only supports composing in 2 different formats (see gr_color()) with ALPHA always as MSB. However, some devices interpret PixelFormat as either Big Endian (i.e. ARGB has alpha at MSB) or Little Endian (i.e. BGRA has alpha at MSB). This change attempts to give multiple options to specify the same format depending on device interpretation, while keeping just 2 different composition formats supported by minui. * ARGB + BGRA: Pixels have (A)lpha at MSB and (B)lue at LSB * RGBX + ABGR: Pixels have (A)lpha at MSB and (R)ed at LSB With this in mind, limiting the use of png_set_bgr() to happen only for (ARGB/BGRA) combination while leaving (RGBX/ABGR) unchanged. Bug: 143480444 Test: Boot device with TARGET_RECOVERY_PIXEL_FORMAT := <> Change-Id: Ia0f94ccbc564b8def7c9416483712ff1abbbf49a --- minui/resources.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'minui/resources.cpp') diff --git a/minui/resources.cpp b/minui/resources.cpp index 00d36d5fb..f635acd1a 100644 --- a/minui/resources.cpp +++ b/minui/resources.cpp @@ -199,7 +199,7 @@ int res_create_display_surface(const char* name, GRSurface** pSurface) { } PixelFormat pixel_format = gr_pixel_format(); - if (pixel_format == PixelFormat::ABGR || pixel_format == PixelFormat::BGRA) { + if (pixel_format == PixelFormat::ARGB || pixel_format == PixelFormat::BGRA) { png_set_bgr(png_ptr); } @@ -271,7 +271,7 @@ int res_create_multi_display_surface(const char* name, int* frames, int* fps, surface[i] = created_surface.release(); } - if (gr_pixel_format() == PixelFormat::ABGR || gr_pixel_format() == PixelFormat::BGRA) { + if (gr_pixel_format() == PixelFormat::ARGB || gr_pixel_format() == PixelFormat::BGRA) { png_set_bgr(png_ptr); } @@ -317,7 +317,7 @@ int res_create_alpha_surface(const char* name, GRSurface** pSurface) { } PixelFormat pixel_format = gr_pixel_format(); - if (pixel_format == PixelFormat::ABGR || pixel_format == PixelFormat::BGRA) { + if (pixel_format == PixelFormat::ARGB || pixel_format == PixelFormat::BGRA) { png_set_bgr(png_ptr); } -- cgit v1.2.3