summaryrefslogtreecommitdiff
path: root/package/DirectFB/patches/patch-tools_directfb-csource_c
blob: 84711d86f8a066902008371666afa40931bea617 (plain)
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
--- DirectFB-1.4.11.orig/tools/directfb-csource.c	2010-10-31 09:49:49.000000000 +0100
+++ DirectFB-1.4.11/tools/directfb-csource.c	2011-03-29 10:57:18.453068981 +0200
@@ -338,7 +338,7 @@ static DFBResult load_image (const char 
      if (!png_ptr)
           goto cleanup;
 
-     if (setjmp (png_ptr->jmpbuf)) {
+     if (setjmp (png_jmpbuf (png_ptr))) {
           if (desc->preallocated[0].data) {
                free (desc->preallocated[0].data);
                desc->preallocated[0].data = NULL;
@@ -405,17 +405,22 @@ static DFBResult load_image (const char 
        }
 
      switch (src_format) {
-          case DSPF_LUT8:
-               if (info_ptr->num_palette) {
+          case DSPF_LUT8: {
+               png_colorp png_palette;
+               int        num_palette;
+
+               png_get_PLTE( png_ptr, info_ptr, &png_palette, &num_palette );
+
+               if (num_palette) {
                     png_byte *alpha;
                     int       i, num;
 
-                    *palette_size = MIN (info_ptr->num_palette, 256);
+                    *palette_size = MIN (num_palette, 256);
                     for (i = 0; i < *palette_size; i++) {
                          palette[i].a = 0xFF;
-                         palette[i].r = info_ptr->palette[i].red;
-                         palette[i].g = info_ptr->palette[i].green;
-                         palette[i].b = info_ptr->palette[i].blue;
+                         palette[i].r = png_palette[i].red;
+                         palette[i].g = png_palette[i].green;
+                         palette[i].b = png_palette[i].blue;
                     }
                     if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) {
                          png_get_tRNS (png_ptr, info_ptr, &alpha, &num, NULL);
@@ -424,6 +429,7 @@ static DFBResult load_image (const char 
                     }
                }
                break;
+          }
           case DSPF_RGB32:
                 png_set_filler (png_ptr, 0xFF,
 #ifdef WORDS_BIGENDIAN