patch-tools_directfb-csource_c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --- DirectFB-1.4.11.orig/tools/directfb-csource.c 2010-10-31 09:49:49.000000000 +0100
  2. +++ DirectFB-1.4.11/tools/directfb-csource.c 2011-03-29 10:57:18.453068981 +0200
  3. @@ -338,7 +338,7 @@ static DFBResult load_image (const char
  4. if (!png_ptr)
  5. goto cleanup;
  6. - if (setjmp (png_ptr->jmpbuf)) {
  7. + if (setjmp (png_jmpbuf (png_ptr))) {
  8. if (desc->preallocated[0].data) {
  9. free (desc->preallocated[0].data);
  10. desc->preallocated[0].data = NULL;
  11. @@ -405,17 +405,22 @@ static DFBResult load_image (const char
  12. }
  13. switch (src_format) {
  14. - case DSPF_LUT8:
  15. - if (info_ptr->num_palette) {
  16. + case DSPF_LUT8: {
  17. + png_colorp png_palette;
  18. + int num_palette;
  19. +
  20. + png_get_PLTE( png_ptr, info_ptr, &png_palette, &num_palette );
  21. +
  22. + if (num_palette) {
  23. png_byte *alpha;
  24. int i, num;
  25. - *palette_size = MIN (info_ptr->num_palette, 256);
  26. + *palette_size = MIN (num_palette, 256);
  27. for (i = 0; i < *palette_size; i++) {
  28. palette[i].a = 0xFF;
  29. - palette[i].r = info_ptr->palette[i].red;
  30. - palette[i].g = info_ptr->palette[i].green;
  31. - palette[i].b = info_ptr->palette[i].blue;
  32. + palette[i].r = png_palette[i].red;
  33. + palette[i].g = png_palette[i].green;
  34. + palette[i].b = png_palette[i].blue;
  35. }
  36. if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) {
  37. png_get_tRNS (png_ptr, info_ptr, &alpha, &num, NULL);
  38. @@ -424,6 +429,7 @@ static DFBResult load_image (const char
  39. }
  40. }
  41. break;
  42. + }
  43. case DSPF_RGB32:
  44. png_set_filler (png_ptr, 0xFF,
  45. #ifdef WORDS_BIGENDIAN