summaryrefslogtreecommitdiffstats
path: root/minui
diff options
context:
space:
mode:
Diffstat (limited to 'minui')
-rw-r--r--minui/Android.mk15
-rw-r--r--minui/events.c6
-rw-r--r--minui/graphics.c8
-rw-r--r--minui/graphics_adf.c5
-rw-r--r--minui/graphics_fbdev.c14
-rw-r--r--minui/resources.c13
6 files changed, 41 insertions, 20 deletions
diff --git a/minui/Android.mk b/minui/Android.mk
index df4aac169..9b2e09b70 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -4,11 +4,8 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := graphics.c graphics_adf.c graphics_fbdev.c events.c \
resources.c
-LOCAL_C_INCLUDES +=\
- external/libpng\
- external/zlib
-
LOCAL_WHOLE_STATIC_LIBRARIES += libadf
+LOCAL_STATIC_LIBRARIES += libpng
LOCAL_MODULE := libminui
@@ -16,6 +13,9 @@ LOCAL_MODULE := libminui
# ordinary characters in this context). Strip double-quotes from the
# value so that either will work.
+ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),ABGR_8888)
+ LOCAL_CFLAGS += -DRECOVERY_ABGR
+endif
ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
LOCAL_CFLAGS += -DRECOVERY_RGBX
endif
@@ -30,3 +30,10 @@ else
endif
include $(BUILD_STATIC_LIBRARY)
+
+# Used by OEMs for factory test images.
+include $(CLEAR_VARS)
+LOCAL_MODULE := libminui
+LOCAL_WHOLE_STATIC_LIBRARIES += libminui
+LOCAL_SHARED_LIBRARIES := libpng
+include $(BUILD_SHARED_LIBRARY)
diff --git a/minui/events.c b/minui/events.c
index df7dad448..9e4255dd7 100644
--- a/minui/events.c
+++ b/minui/events.c
@@ -16,6 +16,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <sys/epoll.h>
@@ -78,8 +80,8 @@ int ev_init(ev_callback input_cb, void *data)
}
/* TODO: add ability to specify event masks. For now, just assume
- * that only EV_KEY and EV_REL event types are ever needed. */
- if (!test_bit(EV_KEY, ev_bits) && !test_bit(EV_REL, ev_bits)) {
+ * that only EV_KEY, EV_REL & EV_SW event types are ever needed. */
+ if (!test_bit(EV_KEY, ev_bits) && !test_bit(EV_REL, ev_bits) && !test_bit(EV_SW, ev_bits)) {
close(fd);
continue;
}
diff --git a/minui/graphics.c b/minui/graphics.c
index 6049d85ca..870ffa089 100644
--- a/minui/graphics.c
+++ b/minui/graphics.c
@@ -16,6 +16,7 @@
#include <stdbool.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <fcntl.h>
@@ -160,10 +161,17 @@ void gr_texticon(int x, int y, GRSurface* icon) {
void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
+#if defined(RECOVERY_ABGR) || defined(RECOVERY_BGRA)
+ gr_current_r = b;
+ gr_current_g = g;
+ gr_current_b = r;
+ gr_current_a = a;
+#else
gr_current_r = r;
gr_current_g = g;
gr_current_b = b;
gr_current_a = a;
+#endif
}
void gr_clear()
diff --git a/minui/graphics_adf.c b/minui/graphics_adf.c
index ac6d64e9e..c023d4db9 100644
--- a/minui/graphics_adf.c
+++ b/minui/graphics_adf.c
@@ -19,6 +19,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <sys/cdefs.h>
@@ -141,7 +142,9 @@ static gr_surface adf_init(minui_backend *backend)
ssize_t n_dev_ids, i;
gr_surface ret;
-#if defined(RECOVERY_BGRA)
+#if defined(RECOVERY_ABGR)
+ pdata->format = DRM_FORMAT_ABGR8888;
+#elif defined(RECOVERY_BGRA)
pdata->format = DRM_FORMAT_BGRA8888;
#elif defined(RECOVERY_RGBX)
pdata->format = DRM_FORMAT_RGBX8888;
diff --git a/minui/graphics_fbdev.c b/minui/graphics_fbdev.c
index 6df2726f5..4a5b5b513 100644
--- a/minui/graphics_fbdev.c
+++ b/minui/graphics_fbdev.c
@@ -16,6 +16,7 @@
#include <stdbool.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <fcntl.h>
@@ -198,21 +199,8 @@ static gr_surface fbdev_flip(minui_backend* backend __unused) {
set_displayed_framebuffer(1-displayed_buffer);
} else {
// Copy from the in-memory surface to the framebuffer.
-
-#if defined(RECOVERY_BGRA)
- unsigned int idx;
- unsigned char* ucfb_vaddr = (unsigned char*)gr_framebuffer[0].data;
- unsigned char* ucbuffer_vaddr = (unsigned char*)gr_draw->data;
- for (idx = 0 ; idx < (gr_draw->height * gr_draw->row_bytes); idx += 4) {
- ucfb_vaddr[idx ] = ucbuffer_vaddr[idx + 2];
- ucfb_vaddr[idx + 1] = ucbuffer_vaddr[idx + 1];
- ucfb_vaddr[idx + 2] = ucbuffer_vaddr[idx ];
- ucfb_vaddr[idx + 3] = ucbuffer_vaddr[idx + 3];
- }
-#else
memcpy(gr_framebuffer[0].data, gr_draw->data,
gr_draw->height * gr_draw->row_bytes);
-#endif
}
return gr_draw;
}
diff --git a/minui/resources.c b/minui/resources.c
index 2bae4ded0..886c3255d 100644
--- a/minui/resources.c
+++ b/minui/resources.c
@@ -15,6 +15,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <fcntl.h>
@@ -215,6 +216,10 @@ int res_create_display_surface(const char* name, gr_surface* pSurface) {
goto exit;
}
+#if defined(RECOVERY_ABGR) || defined(RECOVERY_BGRA)
+ png_set_bgr(png_ptr);
+#endif
+
unsigned char* p_row = malloc(width * 4);
unsigned int y;
for (y = 0; y < height; ++y) {
@@ -278,6 +283,10 @@ int res_create_multi_display_surface(const char* name, int* frames, gr_surface**
}
}
+#if defined(RECOVERY_ABGR) || defined(RECOVERY_BGRA)
+ png_set_bgr(png_ptr);
+#endif
+
unsigned char* p_row = malloc(width * 4);
unsigned int y;
for (y = 0; y < height; ++y) {
@@ -333,6 +342,10 @@ int res_create_alpha_surface(const char* name, gr_surface* pSurface) {
surface->row_bytes = width;
surface->pixel_bytes = 1;
+#if defined(RECOVERY_ABGR) || defined(RECOVERY_BGRA)
+ png_set_bgr(png_ptr);
+#endif
+
unsigned char* p_row;
unsigned int y;
for (y = 0; y < height; ++y) {