Add support for RGBA_8888 pixel format

Change-Id: Ia15d49e51cad5bc8a3291975e1ff515a2b1c419c
diff --git a/minui.old/Android.mk b/minui.old/Android.mk
index 7d8e3a7..6191448 100644
--- a/minui.old/Android.mk
+++ b/minui.old/Android.mk
@@ -41,6 +41,9 @@
 # ordinary characters in this context).  Strip double-quotes from the
 # value so that either will work.
 
+ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBA_8888)
+  LOCAL_CFLAGS += -DRECOVERY_RGBA
+endif
 ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
   LOCAL_CFLAGS += -DRECOVERY_RGBX
 endif
diff --git a/minui.old/graphics.c b/minui.old/graphics.c
index cce02a9..580af29 100644
--- a/minui.old/graphics.c
+++ b/minui.old/graphics.c
@@ -42,6 +42,9 @@
 #if defined(RECOVERY_BGRA)
 #define PIXEL_FORMAT GGL_PIXEL_FORMAT_BGRA_8888
 #define PIXEL_SIZE   4
+#elif defined(RECOVERY_RGBA)
+#define PIXEL_FORMAT GGL_PIXEL_FORMAT_RGBA_8888
+#define PIXEL_SIZE   4
 #elif defined(RECOVERY_RGBX)
 #define PIXEL_FORMAT GGL_PIXEL_FORMAT_RGBX_8888
 #define PIXEL_SIZE   4
@@ -111,6 +114,15 @@
       vi.blue.length    = 8;
       vi.transp.offset  = 0;
       vi.transp.length  = 8;
+    } else if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_RGBA_8888) {
+      vi.red.offset     = 0;
+      vi.red.length     = 8;
+      vi.green.offset   = 8;
+      vi.green.length   = 8;
+      vi.blue.offset    = 16;
+      vi.blue.length    = 8;
+      vi.transp.offset  = 24;
+      vi.transp.length  = 8;
     } else if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_RGBX_8888) {
       vi.red.offset     = 24;
       vi.red.length     = 8;
diff --git a/minui.old/graphics_overlay.c b/minui.old/graphics_overlay.c
index d793b57..c42e9c1 100644
--- a/minui.old/graphics_overlay.c
+++ b/minui.old/graphics_overlay.c
@@ -72,6 +72,8 @@
     int format = MDP_RGB_565;
 #if defined(RECOVERY_BGRA)
     format = MDP_BGRA_8888;
+#elif defined(RECOVERY_RGBA)
+    format = MDP_RGBA_8888;
 #elif defined(RECOVERY_RGBX)
     format = MDP_RGBA_8888;
 #endif
diff --git a/minui/Android.mk b/minui/Android.mk
index f217025..b9cf8ad 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -49,6 +49,9 @@
 ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),ABGR_8888)
   LOCAL_CFLAGS += -DRECOVERY_ABGR
 endif
+ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBA_8888)
+  LOCAL_CFLAGS += -DRECOVERY_RGBA
+endif
 ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
   LOCAL_CFLAGS += -DRECOVERY_RGBX
 endif
diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp
index 5d0867f..10e1c4b 100644
--- a/minui/graphics_adf.cpp
+++ b/minui/graphics_adf.cpp
@@ -145,6 +145,8 @@
     pdata->format = DRM_FORMAT_ABGR8888;
 #elif defined(RECOVERY_BGRA)
     pdata->format = DRM_FORMAT_BGRA8888;
+#elif defined(RECOVERY_RGBA)
+    pdata->format = DRM_FORMAT_RGBA8888;
 #elif defined(RECOVERY_RGBX)
     pdata->format = DRM_FORMAT_RGBX8888;
 #else
diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp
index 03e33b7..ddda187 100644
--- a/minui/graphics_drm.cpp
+++ b/minui/graphics_drm.cpp
@@ -117,6 +117,7 @@
         case DRM_FORMAT_RGBX8888:
         case DRM_FORMAT_BGRX8888:
         case DRM_FORMAT_XBGR8888:
+        case DRM_FORMAT_ARGB8888:
         case DRM_FORMAT_XRGB8888:
             return 32;
         case DRM_FORMAT_RGB565:
@@ -143,6 +144,8 @@
     format = DRM_FORMAT_RGBA8888;
 #elif defined(RECOVERY_BGRA)
     format = DRM_FORMAT_ARGB8888;
+#elif defined(RECOVERY_RGBA)
+    format = DRM_FORMAT_ABGR8888;
 #elif defined(RECOVERY_RGBX)
     format = DRM_FORMAT_XBGR8888;
 #else
diff --git a/minui/graphics_overlay.cpp b/minui/graphics_overlay.cpp
index 2ba452a..978a3bb 100644
--- a/minui/graphics_overlay.cpp
+++ b/minui/graphics_overlay.cpp
@@ -82,6 +82,8 @@
     int format = MDP_RGB_565;
 #if defined(RECOVERY_BGRA)
     format = MDP_BGRA_8888;
+#elif defined(RECOVERY_RGBA)
+    format = MDP_RGBA_8888;
 #elif defined(RECOVERY_RGBX)
     format = MDP_RGBA_8888;
 #endif
diff --git a/minuitwrp/Android.mk b/minuitwrp/Android.mk
index 2f30343..9204339 100644
--- a/minuitwrp/Android.mk
+++ b/minuitwrp/Android.mk
@@ -62,6 +62,9 @@
 LOCAL_CFLAGS += -D_EVENT_LOGGING
 endif
 
+ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBA_8888)
+  LOCAL_CFLAGS += -DRECOVERY_RGBA
+endif
 ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
   LOCAL_CFLAGS += -DRECOVERY_RGBX
 endif
diff --git a/minuitwrp/graphics.c b/minuitwrp/graphics.c
index 6dfbc23..a3da6cb 100644
--- a/minuitwrp/graphics.c
+++ b/minuitwrp/graphics.c
@@ -44,6 +44,10 @@
 #define PIXEL_FORMAT GGL_PIXEL_FORMAT_BGRA_8888
 #define PIXEL_SIZE 4
 #endif
+#ifdef RECOVERY_RGBA
+#define PIXEL_FORMAT GGL_PIXEL_FORMAT_RGBA_8888
+#define PIXEL_SIZE   4
+#endif
 #ifdef RECOVERY_RGBX
 #define PIXEL_FORMAT GGL_PIXEL_FORMAT_RGBX_8888
 #define PIXEL_SIZE 4
@@ -199,6 +203,17 @@
         vi.blue.length    = 8;
         vi.transp.offset  = 0;
         vi.transp.length  = 8;
+    } else if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_RGBA_8888) {
+        fprintf(stderr, "Pixel format: RGBA_8888\n");
+        if (PIXEL_SIZE != 4)    fprintf(stderr, "E: Pixel Size mismatch!\n");
+        vi.red.offset     = 0;
+        vi.red.length     = 8;
+        vi.green.offset   = 8;
+        vi.green.length   = 8;
+        vi.blue.offset    = 16;
+        vi.blue.length    = 8;
+        vi.transp.offset  = 24;
+        vi.transp.length  = 8;
     } else if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_RGBX_8888) {
         fprintf(stderr, "Pixel format: RGBX_8888\n");
         if (PIXEL_SIZE != 4)    fprintf(stderr, "E: Pixel Size mismatch!\n");
diff --git a/minuitwrp/graphics_overlay.c b/minuitwrp/graphics_overlay.c
index 80e64d7..723ffa2 100644
--- a/minuitwrp/graphics_overlay.c
+++ b/minuitwrp/graphics_overlay.c
@@ -75,6 +75,8 @@
     int format = MDP_RGB_565;
 #if defined(RECOVERY_BGRA)
     format = MDP_BGRA_8888;
+#elif defined(RECOVERY_RGBA)
+    format = MDP_RGBA_8888;
 #elif defined(RECOVERY_RGBX)
     format = MDP_RGBA_8888;
 #endif