diff options
author | John Reck <jreck@google.com> | 2013-08-13 13:01:29 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2013-08-13 13:01:29 -0700 |
commit | 41329c5fd09812ec7c53174f3a7cf67a49f23ce7 (patch) | |
tree | 708727dff12602b5d14b8a6c6e68402b3b62a8ff /minui | |
parent | c0441d171914e59941ec4f815ae0aabf56d6504f (diff) | |
download | bootable_recovery-41329c5fd09812ec7c53174f3a7cf67a49f23ce7.zip bootable_recovery-41329c5fd09812ec7c53174f3a7cf67a49f23ce7.tar.gz bootable_recovery-41329c5fd09812ec7c53174f3a7cf67a49f23ce7.tar.bz2 |
Fix libpng API usage
Remove usage of deprecated methods that were removed in 1.6
Change-Id: I2a669bf5201197f60adfdbe512fd729bebb74f9c
Diffstat (limited to 'minui')
-rw-r--r-- | minui/resources.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/minui/resources.c b/minui/resources.c index 72f39fb..c0a9cca 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))) { |