summaryrefslogtreecommitdiffstats
path: root/minui
diff options
context:
space:
mode:
Diffstat (limited to 'minui')
-rw-r--r--minui/Android.mk2
-rw-r--r--minui/graphics.c7
-rw-r--r--minui/minui.h7
-rw-r--r--minui/resources.c24
4 files changed, 25 insertions, 15 deletions
diff --git a/minui/Android.mk b/minui/Android.mk
index 43e0ad33b..232ebb2bf 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -6,7 +6,7 @@ LOCAL_SRC_FILES := graphics.c events.c resources.c
LOCAL_C_INCLUDES +=\
external/libpng\
external/zlib
-
+LOCAL_STATIC_LIBRARY := libpng
LOCAL_MODULE := libminui
# This used to compare against values in double-quotes (which are just
diff --git a/minui/graphics.c b/minui/graphics.c
index d75716531..8998d9fd1 100644
--- a/minui/graphics.c
+++ b/minui/graphics.c
@@ -223,7 +223,12 @@ void gr_font_size(int *x, int *y)
*y = gr_font->cheight;
}
-int gr_text(int x, int y, const char *s, int bold)
+int gr_text(int x, int y, const char *s, ...)
+{
+ return gr_text_impl(x, y, s, 0);
+}
+
+int gr_text_impl(int x, int y, const char *s, int bold)
{
GGLContext *gl = gr_context;
GRFont *font = gr_font;
diff --git a/minui/minui.h b/minui/minui.h
index 1b8dd059b..ccd501f85 100644
--- a/minui/minui.h
+++ b/minui/minui.h
@@ -37,7 +37,12 @@ void gr_fb_blank(bool blank);
void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
void gr_fill(int x1, int y1, int x2, int y2);
-int gr_text(int x, int y, const char *s, int bold);
+
+// system/core/charger uses different gr_print signatures in diferent
+// Android versions, either with or without int bold.
+int gr_text(int x, int y, const char *s, ...);
+int gr_text_impl(int x, int y, const char *s, int bold);
+
void gr_texticon(int x, int y, gr_surface icon);
int gr_measure(const char *s);
void gr_font_size(int *x, int *y);
diff --git a/minui/resources.c b/minui/resources.c
index 72f39fbaa..c0a9ccacb 100644
--- a/minui/resources.c
+++ b/minui/resources.c
@@ -93,9 +93,13 @@ int res_create_surface(const char* name, gr_surface* pSurface) {
png_set_sig_bytes(png_ptr, sizeof(header));
png_read_info(png_ptr, info_ptr);
- int color_type = info_ptr->color_type;
- int bit_depth = info_ptr->bit_depth;
- int channels = info_ptr->channels;
+ int color_type, bit_depth;
+ size_t width, height;
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
+ &color_type, NULL, NULL, NULL);
+
+ int channels = png_get_channels(png_ptr, info_ptr);
+
if (!(bit_depth == 8 &&
((channels == 3 && color_type == PNG_COLOR_TYPE_RGB) ||
(channels == 4 && color_type == PNG_COLOR_TYPE_RGBA) ||
@@ -105,8 +109,6 @@ int res_create_surface(const char* name, gr_surface* pSurface) {
goto exit;
}
- size_t width = info_ptr->width;
- size_t height = info_ptr->height;
size_t stride = (color_type == PNG_COLOR_TYPE_GRAY ? 1 : 4) * width;
size_t pixelSize = stride * height;
@@ -246,13 +248,11 @@ int res_create_localized_surface(const char* name, gr_surface* pSurface) {
png_set_sig_bytes(png_ptr, sizeof(header));
png_read_info(png_ptr, info_ptr);
- size_t width = info_ptr->width;
- size_t height = info_ptr->height;
- size_t stride = 4 * width;
-
- int color_type = info_ptr->color_type;
- int bit_depth = info_ptr->bit_depth;
- int channels = info_ptr->channels;
+ int color_type, bit_depth;
+ size_t width, height;
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
+ &color_type, NULL, NULL, NULL);
+ int channels = png_get_channels(png_ptr, info_ptr);
if (!(bit_depth == 8 &&
(channels == 1 && color_type == PNG_COLOR_TYPE_GRAY))) {