summaryrefslogtreecommitdiffstats
path: root/tools/aapt
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2013-08-13 13:29:15 -0700
committerJohn Reck <jreck@google.com>2013-08-13 13:29:15 -0700
commit48b15b1e1df8315575ada27ab3b0206ed87d67b2 (patch)
tree045a18f381f8b90758c0294fdf1dac3ca83f529f /tools/aapt
parent1c2274603898dde95eee5caa227fd2bf9133cc3e (diff)
downloadframeworks_base-48b15b1e1df8315575ada27ab3b0206ed87d67b2.zip
frameworks_base-48b15b1e1df8315575ada27ab3b0206ed87d67b2.tar.gz
frameworks_base-48b15b1e1df8315575ada27ab3b0206ed87d67b2.tar.bz2
Fix libpng API usage
Remove usage of deprecated APIs no longer in 1.6 Change-Id: I04cbceba718533312e900e62ddcf3872b61765ec
Diffstat (limited to 'tools/aapt')
-rw-r--r--tools/aapt/Images.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 9de685a..a842553 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -12,13 +12,15 @@
#include <utils/ByteOrder.h>
#include <png.h>
+#include <zlib.h>
#define NOISY(x) //x
static void
png_write_aapt_file(png_structp png_ptr, png_bytep data, png_size_t length)
{
- status_t err = ((AaptFile*)png_ptr->io_ptr)->writeData(data, length);
+ AaptFile* aaptfile = (AaptFile*) png_get_io_ptr(png_ptr);
+ status_t err = aaptfile->writeData(data, length);
if (err != NO_ERROR) {
png_error(png_ptr, "Write Error");
}
@@ -90,7 +92,7 @@ static void read_png(const char* imageName,
png_set_palette_to_rgb(read_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
- png_set_gray_1_2_4_to_8(read_ptr);
+ png_set_expand_gray_1_2_4_to_8(read_ptr);
if (png_get_valid(read_ptr, read_info, PNG_INFO_tRNS)) {
//printf("Has PNG_INFO_tRNS!\n");
@@ -109,7 +111,7 @@ static void read_png(const char* imageName,
png_read_update_info(read_ptr, read_info);
outImageInfo->rows = (png_bytepp)malloc(
- outImageInfo->height * png_sizeof(png_bytep));
+ outImageInfo->height * sizeof(png_bytep));
outImageInfo->allocHeight = outImageInfo->height;
outImageInfo->allocRows = outImageInfo->rows;
@@ -573,7 +575,7 @@ static status_t do_9patch(const char* imageName, image_info* image)
image->info9Patch.paddingTop, image->info9Patch.paddingBottom));
// Remove frame from image.
- image->rows = (png_bytepp)malloc((H-2) * png_sizeof(png_bytep));
+ image->rows = (png_bytepp)malloc((H-2) * sizeof(png_bytep));
for (i=0; i<(H-2); i++) {
image->rows[i] = image->allocRows[i+1];
memmove(image->rows[i], image->rows[i]+4, (W-2)*4);
@@ -984,7 +986,7 @@ static void write_png(const char* imageName,
unknowns[0].data = NULL;
unknowns[1].data = NULL;
- png_bytepp outRows = (png_bytepp) malloc((int) imageInfo.height * png_sizeof(png_bytep));
+ png_bytepp outRows = (png_bytepp) malloc((int) imageInfo.height * sizeof(png_bytep));
if (outRows == (png_bytepp) 0) {
printf("Can't allocate output buffer!\n");
exit(1);