summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@android.com>2013-08-27 18:49:39 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-08-27 18:49:39 +0200
commit5c4e1dac0bd8f31559bd50eec4343b7a17b7a976 (patch)
treeec54384f035b6727efcc1d8e8508a5ac5a4d747b
parentam 901b898d: recovery: remove O_DIRECT, use O_SYNC only (diff)
parentUpdate libpng API usage (diff)
downloadandroid_bootable_recovery-5c4e1dac0bd8f31559bd50eec4343b7a17b7a976.tar
android_bootable_recovery-5c4e1dac0bd8f31559bd50eec4343b7a17b7a976.tar.gz
android_bootable_recovery-5c4e1dac0bd8f31559bd50eec4343b7a17b7a976.tar.bz2
android_bootable_recovery-5c4e1dac0bd8f31559bd50eec4343b7a17b7a976.tar.lz
android_bootable_recovery-5c4e1dac0bd8f31559bd50eec4343b7a17b7a976.tar.xz
android_bootable_recovery-5c4e1dac0bd8f31559bd50eec4343b7a17b7a976.tar.zst
android_bootable_recovery-5c4e1dac0bd8f31559bd50eec4343b7a17b7a976.zip
-rw-r--r--minui/resources.c24
1 files changed, 12 insertions, 12 deletions
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))) {