forked from xuedipiaofei/apkutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
android-utils-4.4-r1-aapt-Images.patch
58 lines (48 loc) · 2.1 KB
/
android-utils-4.4-r1-aapt-Images.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--- src/android-utils-4.4-r1/aapt/Images.cpp 2013-09-26 23:14:54.000000000 +0800
+++ android-utils-4.4-r1/aapt/Images.cpp 2014-04-21 11:44:06.704214219 +0800
@@ -13,6 +13,8 @@
#include <png.h>
+#include "pngstruct.h"
+
#define NOISY(x) //x
static void
@@ -89,8 +91,8 @@
if (color_type == PNG_COLOR_TYPE_PALETTE)
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);
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+ 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 @@
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 @@
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 @@
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);
@@ -1092,7 +1094,7 @@
png_bytepp rows;
if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
- png_set_filler(write_ptr, 0, PNG_FILLER_AFTER);
+ // FIXME: png_set_filler(write_ptr, 0, PNG_FILLER_AFTER);
rows = imageInfo.rows;
} else {
rows = outRows;