From 29ad618c07f78c325be242caac65172ce65e4cdc Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Mon, 19 Mar 2012 19:15:09 +0100 Subject: [PATCH] xbmc-rpi: update to xbmc-rpi-535d2bd Signed-off-by: Stephan Raue --- .../xbmc-rpi-theme-Confluence/meta | 2 +- packages/mediacenter/xbmc-rpi/build | 10 +- packages/mediacenter/xbmc-rpi/meta | 2 +- ...-add_support_to_specify_GIT_REV-0.1.patch} | 0 ...i-535d2bd-303-fix_libdvd_xFLAGS-0.1.patch} | 0 ...-rpi-535d2bd-311-fix_rsxs_build-0.1.patch} | 0 ...5d2bd-402-enable_yasm_in_ffmpeg-0.1.patch} | 0 ...-rpi-535d2bd-404-add_lame_check-0.6.patch} | 0 ...ONOPTIMIZE_with_external_Python-0.1.patch} | 0 ...-535d2bd-452-change_lcd_content-0.1.patch} | 0 ...bd-453-add_openelec.tv_RSS_news-0.1.patch} | 0 ...i-535d2bd-454-disable_backslash-0.1.patch} | 0 ...35d2bd-457-fix_connection_check-0.1.patch} | 0 ...-add_remote_irtrans_mediacenter-0.1.patch} | 0 ...535d2bd-463-add_remote_devinput-0.1.patch} | 0 ...4-add_eject_keymapping_for_lirc-0.1.patch} | 0 ...h => xbmc-rpi-535d2bd-801-cec-PR570.patch} | 0 ...c-rpi-535d2bd-981-toggleButtonState.patch} | 0 ...pi-535d2bd-991.01-libpng-1.5_support.patch | 618 ++++++++++++++++++ ...d-991.02-simplyfing_libpng-1.5_check.patch | 434 ++++++++++++ 20 files changed, 1056 insertions(+), 10 deletions(-) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-001-add_support_to_specify_GIT_REV-0.1.patch => xbmc-rpi-535d2bd-001-add_support_to_specify_GIT_REV-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-303-fix_libdvd_xFLAGS-0.1.patch => xbmc-rpi-535d2bd-303-fix_libdvd_xFLAGS-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-311-fix_rsxs_build-0.1.patch => xbmc-rpi-535d2bd-311-fix_rsxs_build-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-402-enable_yasm_in_ffmpeg-0.1.patch => xbmc-rpi-535d2bd-402-enable_yasm_in_ffmpeg-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-404-add_lame_check-0.6.patch => xbmc-rpi-535d2bd-404-add_lame_check-0.6.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch => xbmc-rpi-535d2bd-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-452-change_lcd_content-0.1.patch => xbmc-rpi-535d2bd-452-change_lcd_content-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-453-add_openelec.tv_RSS_news-0.1.patch => xbmc-rpi-535d2bd-453-add_openelec.tv_RSS_news-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-454-disable_backslash-0.1.patch => xbmc-rpi-535d2bd-454-disable_backslash-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-457-fix_connection_check-0.1.patch => xbmc-rpi-535d2bd-457-fix_connection_check-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-462-add_remote_irtrans_mediacenter-0.1.patch => xbmc-rpi-535d2bd-462-add_remote_irtrans_mediacenter-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-463-add_remote_devinput-0.1.patch => xbmc-rpi-535d2bd-463-add_remote_devinput-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-464-add_eject_keymapping_for_lirc-0.1.patch => xbmc-rpi-535d2bd-464-add_eject_keymapping_for_lirc-0.1.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-801-cec-PR570.patch => xbmc-rpi-535d2bd-801-cec-PR570.patch} (100%) rename packages/mediacenter/xbmc-rpi/patches/{xbmc-rpi-452836f-981-toggleButtonState.patch => xbmc-rpi-535d2bd-981-toggleButtonState.patch} (100%) create mode 100644 packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-991.01-libpng-1.5_support.patch create mode 100644 packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-991.02-simplyfing_libpng-1.5_check.patch diff --git a/packages/mediacenter/xbmc-rpi-theme-Confluence/meta b/packages/mediacenter/xbmc-rpi-theme-Confluence/meta index 82ba476bc8..0a40f80249 100644 --- a/packages/mediacenter/xbmc-rpi-theme-Confluence/meta +++ b/packages/mediacenter/xbmc-rpi-theme-Confluence/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="xbmc-rpi-theme-Confluence" -PKG_VERSION="452836f" +PKG_VERSION="535d2bd" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/xbmc-rpi/build b/packages/mediacenter/xbmc-rpi/build index a99d6d2759..12acdeb8d3 100755 --- a/packages/mediacenter/xbmc-rpi/build +++ b/packages/mediacenter/xbmc-rpi/build @@ -149,7 +149,7 @@ fi if [ "$OPENMAX_SUPPORT" = yes ]; then XBMC_OPENMAX="--enable-openmax" if [ "$OPENMAX" = "bcm2835-driver" ]; then - PLATFORM_SUPPORT_RPI="yes" + XBMC_PLATFORM_SUPPORT="--with-platform=raspberry-pi" fi else XBMC_OPENMAX="--disable-openmax" @@ -179,12 +179,6 @@ else XBMC_CRYSTALHD="--disable-crystalhd" fi -if [ "$PLATFORM_SUPPORT_RPI" = "yes" ]; then - XBMC_PLATFORM_RPI="--enable-platform-raspberry-pi" -else - XBMC_PLATFORM_RPI="--disable-platform-raspberry-pi" -fi - # dont build parallel MAKEFLAGS=-j1 @@ -277,7 +271,7 @@ cd $PKG_BUILD --enable-texturepacker \ --disable-external-libraries \ --disable-external-ffmpeg \ - $XBMC_PLATFORM_RPI \ + $XBMC_PLATFORM_SUPPORT \ # setup default skin inside the sources sed -i -e "s|skin.confluence|$SKIN_DIR|g" xbmc/settings/Settings.h diff --git a/packages/mediacenter/xbmc-rpi/meta b/packages/mediacenter/xbmc-rpi/meta index cd9b3acb92..fea3513e03 100644 --- a/packages/mediacenter/xbmc-rpi/meta +++ b/packages/mediacenter/xbmc-rpi/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="xbmc-rpi" -PKG_VERSION="452836f" +PKG_VERSION="535d2bd" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-001-add_support_to_specify_GIT_REV-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-001-add_support_to_specify_GIT_REV-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-001-add_support_to_specify_GIT_REV-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-001-add_support_to_specify_GIT_REV-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-303-fix_libdvd_xFLAGS-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-303-fix_libdvd_xFLAGS-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-303-fix_libdvd_xFLAGS-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-303-fix_libdvd_xFLAGS-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-311-fix_rsxs_build-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-311-fix_rsxs_build-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-311-fix_rsxs_build-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-311-fix_rsxs_build-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-402-enable_yasm_in_ffmpeg-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-402-enable_yasm_in_ffmpeg-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-402-enable_yasm_in_ffmpeg-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-402-enable_yasm_in_ffmpeg-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-404-add_lame_check-0.6.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-404-add_lame_check-0.6.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-404-add_lame_check-0.6.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-404-add_lame_check-0.6.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-452-change_lcd_content-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-452-change_lcd_content-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-452-change_lcd_content-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-452-change_lcd_content-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-453-add_openelec.tv_RSS_news-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-453-add_openelec.tv_RSS_news-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-453-add_openelec.tv_RSS_news-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-453-add_openelec.tv_RSS_news-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-454-disable_backslash-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-454-disable_backslash-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-454-disable_backslash-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-454-disable_backslash-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-457-fix_connection_check-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-457-fix_connection_check-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-457-fix_connection_check-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-457-fix_connection_check-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-462-add_remote_irtrans_mediacenter-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-462-add_remote_irtrans_mediacenter-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-462-add_remote_irtrans_mediacenter-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-462-add_remote_irtrans_mediacenter-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-463-add_remote_devinput-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-463-add_remote_devinput-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-463-add_remote_devinput-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-463-add_remote_devinput-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-464-add_eject_keymapping_for_lirc-0.1.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-464-add_eject_keymapping_for_lirc-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-464-add_eject_keymapping_for_lirc-0.1.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-464-add_eject_keymapping_for_lirc-0.1.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-801-cec-PR570.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-801-cec-PR570.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-801-cec-PR570.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-801-cec-PR570.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-981-toggleButtonState.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-981-toggleButtonState.patch similarity index 100% rename from packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-452836f-981-toggleButtonState.patch rename to packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-981-toggleButtonState.patch diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-991.01-libpng-1.5_support.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-991.01-libpng-1.5_support.patch new file mode 100644 index 0000000000..7b2c572516 --- /dev/null +++ b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-991.01-libpng-1.5_support.patch @@ -0,0 +1,618 @@ +From 06688eb1982c9a672a1cdffc0f0873f0ec4b5bfb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Damien=20Th=C3=A9bault?= +Date: Sat, 14 Jan 2012 23:33:45 +0100 +Subject: [PATCH] Commit cleaned libpng 1.5 support. + +--- + lib/cximage-6.0/CxImage/ximapng.cpp | 258 ++++++++++++++++++++++++++++++++++- + lib/cximage-6.0/CxImage/ximapng.h | 5 + + 2 files changed, 262 insertions(+), 1 deletions(-) + +diff --git a/lib/cximage-6.0/CxImage/ximapng.cpp b/lib/cximage-6.0/CxImage/ximapng.cpp +index f718269..3e0cf73 100644 +--- a/lib/cximage-6.0/CxImage/ximapng.cpp ++++ b/lib/cximage-6.0/CxImage/ximapng.cpp +@@ -15,7 +15,11 @@ + void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message) + { + strcpy(info.szLastError,message); ++#if PNG_LIBPNG_VER > 10499 ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + //////////////////////////////////////////////////////////////////////////////// + #if CXIMAGE_SUPPORT_DECODE +@@ -62,7 +66,11 @@ bool CxImagePNG::Decode(CxFile *hFile) + /* Set error handling if you are using the setjmp/longjmp method (this is + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in the png_create_read_struct() earlier. */ ++#if PNG_LIBPNG_VER > 10499 ++ if (setjmp(png_jmpbuf(png_ptr))) { ++#else + if (setjmp(png_ptr->jmpbuf)) { ++#endif + /* Free all of the memory associated with the png_ptr and info_ptr */ + delete [] row_pointers; + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); +@@ -76,16 +84,34 @@ bool CxImagePNG::Decode(CxFile *hFile) + /* read the file information */ + png_read_info(png_ptr, info_ptr); + ++#if PNG_LIBPNG_VER > 10499 ++ png_uint_32 _width,_height; ++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type; ++ png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type, ++ &_interlace_type,&_compression_type,&_filter_type); ++ ++ if (info.nEscape == -1){ ++ head.biWidth = _width; ++ head.biHeight= _height; ++ info.dwType = CXIMAGE_FORMAT_PNG; ++ longjmp(png_jmpbuf(png_ptr), 1); ++ } ++#else + if (info.nEscape == -1){ + head.biWidth = info_ptr->width; + head.biHeight= info_ptr->height; + info.dwType = CXIMAGE_FORMAT_PNG; + longjmp(png_ptr->jmpbuf, 1); + } ++#endif + + /* calculate new number of channels */ + int channels=0; ++#if PNG_LIBPNG_VER > 10499 ++ switch(_color_type){ ++#else + switch(info_ptr->color_type){ ++#endif + case PNG_COLOR_TYPE_GRAY: + case PNG_COLOR_TYPE_PALETTE: + channels = 1; +@@ -101,20 +127,49 @@ bool CxImagePNG::Decode(CxFile *hFile) + break; + default: + strcpy(info.szLastError,"unknown PNG color type"); ++#if PNG_LIBPNG_VER > 10499 ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + + //find the right pixel depth used for cximage ++#if PNG_LIBPNG_VER > 10499 ++ int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr); ++#else + int pixel_depth = info_ptr->pixel_depth; ++#endif + if (channels == 1 && pixel_depth>8) pixel_depth=8; + if (channels == 2) pixel_depth=8; + if (channels >= 3) pixel_depth=24; + ++#if PNG_LIBPNG_VER > 10499 ++ if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){ ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){ + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + + /* get metrics */ ++#if PNG_LIBPNG_VER > 10499 ++ png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit; ++ int _phys_unit_type; ++ png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type); ++ switch (_phys_unit_type) ++ { ++ case PNG_RESOLUTION_UNKNOWN: ++ SetXDPI(_x_pixels_per_unit); ++ SetYDPI(_y_pixels_per_unit); ++ break; ++ case PNG_RESOLUTION_METER: ++ SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5)); ++ SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5)); ++ break; ++ } ++#else + switch (info_ptr->phys_unit_type) + { + case PNG_RESOLUTION_UNKNOWN: +@@ -126,46 +181,94 @@ bool CxImagePNG::Decode(CxFile *hFile) + SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5)); + break; + } ++#endif + ++#if PNG_LIBPNG_VER > 10499 ++ int _num_palette; ++ png_colorp _palette; ++ png_uint_32 _palette_ret; ++ _palette_ret = png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette); ++ if (_palette_ret && _num_palette>0){ ++ SetPalette((rgb_color*)_palette,_num_palette); ++ SetClrImportant(_num_palette); ++ } else if (_bit_depth ==2) { // needed for 2 bpp grayscale PNGs ++#else + if (info_ptr->num_palette>0){ + SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette); + SetClrImportant(info_ptr->num_palette); + } else if (info_ptr->bit_depth ==2) { // needed for 2 bpp grayscale PNGs ++#endif + SetPaletteColor(0,0,0,0); + SetPaletteColor(1,85,85,85); + SetPaletteColor(2,170,170,170); + SetPaletteColor(3,255,255,255); + } else SetGrayPalette(); // needed for grayscale PNGs + ++#if PNG_LIBPNG_VER > 10499 ++ int nshift = max(0,(_bit_depth>>3)-1)<<3; ++#else + int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3; ++#endif + ++#if PNG_LIBPNG_VER > 10499 ++ png_bytep _trans_alpha; ++ int _num_trans; ++ png_color_16p _trans_color; ++ png_uint_32 _trans_ret; ++ _trans_ret = png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color); ++ if (_trans_ret && _num_trans!=0){ //palette transparency ++ if (_num_trans==1){ ++ if (_color_type == PNG_COLOR_TYPE_PALETTE){ ++#else + if (info_ptr->num_trans!=0){ //palette transparency + if (info_ptr->num_trans==1){ + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){ ++#endif ++#if PNG_LIBPNG_VER > 10499 ++ info.nBkgndIndex = _trans_color->index; ++#else + #if PNG_LIBPNG_VER > 10399 + info.nBkgndIndex = info_ptr->trans_color.index; + #else + info.nBkgndIndex = info_ptr->trans_values.index; + #endif ++#endif + } else{ ++#if PNG_LIBPNG_VER > 10499 ++ info.nBkgndIndex = _trans_color->gray>>nshift; ++#else + #if PNG_LIBPNG_VER > 10399 + info.nBkgndIndex = info_ptr->trans_color.gray>>nshift; + #else + info.nBkgndIndex = info_ptr->trans_values.gray>>nshift; + #endif ++#endif + } + } ++#if PNG_LIBPNG_VER > 10499 ++ if (_num_trans>1 && _trans_alpha!=NULL){ ++#else + if (info_ptr->num_trans>1){ ++#endif + RGBQUAD* pal=GetPalette(); + if (pal){ + DWORD ip; ++#if PNG_LIBPNG_VER > 10499 ++ for (ip=0;ipnum_trans);ip++) + #if PNG_LIBPNG_VER > 10399 + pal[ip].rgbReserved=info_ptr->trans_alpha[ip]; + #else + pal[ip].rgbReserved=info_ptr->trans[ip]; + #endif ++#endif ++#if PNG_LIBPNG_VER > 10499 ++ for (ip=_num_trans;ipnum_trans;ip 10499 ++ info.nBkgndColor.rgbRed = (BYTE)(_trans_color->red>>nshift); ++ info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift); ++ info.nBkgndColor.rgbBlue = (BYTE)(_trans_color->blue>>nshift); ++#else + #if PNG_LIBPNG_VER > 10399 + info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift); + info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift); +@@ -187,6 +295,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift); + info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_values.blue>>nshift); + #endif ++#endif + info.nBkgndColor.rgbReserved = 0; + info.nBkgndIndex = 0; + } +@@ -202,15 +311,27 @@ bool CxImagePNG::Decode(CxFile *hFile) + } + + // - flip the RGB pixels to BGR (or RGBA to BGRA) ++#if PNG_LIBPNG_VER > 10499 ++ if (_color_type & PNG_COLOR_MASK_COLOR){ ++#else + if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){ ++#endif + png_set_bgr(png_ptr); + } + + // - handle cancel ++#if PNG_LIBPNG_VER > 10499 ++ if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1); ++#else + if (info.nEscape) longjmp(png_ptr->jmpbuf, 1); ++#endif + + // row_bytes is the width x number of channels x (bit-depth / 8) ++#if PNG_LIBPNG_VER > 10499 ++ row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8]; ++#else + row_pointers = new BYTE[info_ptr->rowbytes + 8]; ++#endif + + // turn on interlace handling + int number_passes = png_set_interlace_handling(png_ptr); +@@ -221,8 +342,16 @@ bool CxImagePNG::Decode(CxFile *hFile) + SetCodecOption(0); + } + ++#if PNG_LIBPNG_VER > 10499 ++ int chan_offset = _bit_depth >> 3; ++#else + int chan_offset = info_ptr->bit_depth >> 3; ++#endif ++#if PNG_LIBPNG_VER > 10499 ++ int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3; ++#else + int pixel_offset = info_ptr->pixel_depth >> 3; ++#endif + + for (int pass=0; pass < number_passes; pass++) { + iter.Upset(); +@@ -230,7 +359,11 @@ bool CxImagePNG::Decode(CxFile *hFile) + do { + + // - handle cancel ++#if PNG_LIBPNG_VER > 10499 ++ if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1); ++#else + if (info.nEscape) longjmp(png_ptr->jmpbuf, 1); ++#endif + + #if CXIMAGE_SUPPORT_ALPHA // + if (AlphaIsValid()) { +@@ -241,7 +374,11 @@ bool CxImagePNG::Decode(CxFile *hFile) + BYTE* prow= iter.GetRow(ay); + + //recover data from previous scan ++#if PNG_LIBPNG_VER > 10499 ++ if (_interlace_type && pass>0 && pass!=7){ ++#else + if (info_ptr->interlace_type && pass>0 && pass!=7){ ++#endif + for(ax=0;ax 10499 ++ if (_interlace_type && pass>0){ ++ iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr)); ++ //re-expand buffer for images with bit depth > 8 ++ if (_bit_depth > 8){ ++#else + if (info_ptr->interlace_type && pass>0){ + iter.GetRow(row_pointers, info_ptr->rowbytes); + //re-expand buffer for images with bit depth > 8 + if (info_ptr->bit_depth > 8){ ++#endif + for(long ax=(head.biWidth*channels-1);ax>=0;ax--) + row_pointers[ax*chan_offset] = row_pointers[ax]; + } +@@ -291,15 +435,27 @@ bool CxImagePNG::Decode(CxFile *hFile) + png_read_row(png_ptr, row_pointers, NULL); + + //shrink 16 bit depth images down to 8 bits ++#if PNG_LIBPNG_VER > 10499 ++ if (_bit_depth > 8){ ++#else + if (info_ptr->bit_depth > 8){ ++#endif + for(long ax=0;ax<(head.biWidth*channels);ax++) + row_pointers[ax] = row_pointers[ax*chan_offset]; + } + + //copy the pixels ++#if PNG_LIBPNG_VER > 10499 ++ iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr)); ++#else + iter.SetRow(row_pointers, info_ptr->rowbytes); ++#endif + // expand 2 bpp images only in the last pass ++#if PNG_LIBPNG_VER > 10499 ++ if (_bit_depth==2 && pass==(number_passes-1)) ++#else + if (info_ptr->bit_depth==2 && pass==(number_passes-1)) ++#endif + expand2to4bpp(iter.GetRow()); + + //go on +@@ -361,9 +517,13 @@ bool CxImagePNG::Encode(CxFile *hFile) + /* Set error handling. REQUIRED if you aren't supplying your own + * error hadnling functions in the png_create_write_struct() call. + */ ++#if PNG_LIBPNG_VER > 10499 ++ if (setjmp(png_jmpbuf(png_ptr))){ ++#else + if (setjmp(png_ptr->jmpbuf)){ + /* If we get here, we had a problem reading the file */ + if (info_ptr->palette) free(info_ptr->palette); ++#endif + png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr); + cx_throw("Error saving PNG file"); + } +@@ -372,9 +532,23 @@ bool CxImagePNG::Encode(CxFile *hFile) + //png_init_io(png_ptr, hFile); + + // use custom I/O functions +- png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data); ++ png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data); + + /* set the file information here */ ++#if PNG_LIBPNG_VER > 10499 ++ /* use variables to hold the values so it isnt necessary to png_get them later */ ++ png_uint_32 _width,_height; ++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type; ++ png_byte _channels,_pixel_depth; ++ ++ _width = GetWidth(); ++ _height = GetHeight(); ++ _pixel_depth = (BYTE)GetBpp(); ++ _channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1; ++ _bit_depth = (BYTE)(GetBpp()/_channels); ++ _compression_type = PNG_COMPRESSION_TYPE_DEFAULT; ++ _filter_type = PNG_FILTER_TYPE_DEFAULT; ++#else + info_ptr->width = GetWidth(); + info_ptr->height = GetHeight(); + info_ptr->pixel_depth = (BYTE)GetBpp(); +@@ -382,13 +556,22 @@ bool CxImagePNG::Encode(CxFile *hFile) + info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels); + info_ptr->compression_type = info_ptr->filter_type = 0; + info_ptr->valid = 0; ++#endif + + switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){ + case 1: ++#if PNG_LIBPNG_VER > 10499 ++ _interlace_type = PNG_INTERLACE_ADAM7; ++#else + info_ptr->interlace_type = PNG_INTERLACE_ADAM7; ++#endif + break; + default: ++#if PNG_LIBPNG_VER > 10499 ++ _interlace_type = PNG_INTERLACE_NONE; ++#else + info_ptr->interlace_type = PNG_INTERLACE_NONE; ++#endif + } + + /* set compression level */ +@@ -398,19 +581,38 @@ bool CxImagePNG::Encode(CxFile *hFile) + + if (GetNumColors()){ + if (bGrayScale){ ++#if PNG_LIBPNG_VER > 10499 ++ _color_type = PNG_COLOR_TYPE_GRAY; ++#else + info_ptr->color_type = PNG_COLOR_TYPE_GRAY; ++#endif + } else { ++#if PNG_LIBPNG_VER > 10499 ++ _color_type = PNG_COLOR_TYPE_PALETTE; ++#else + info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; ++#endif + } + } else { ++#if PNG_LIBPNG_VER > 10499 ++ _color_type = PNG_COLOR_TYPE_RGB; ++#else + info_ptr->color_type = PNG_COLOR_TYPE_RGB; ++#endif + } + #if CXIMAGE_SUPPORT_ALPHA + if (AlphaIsValid()){ ++#if PNG_LIBPNG_VER > 10499 ++ _color_type |= PNG_COLOR_MASK_ALPHA; ++ _channels++; ++ _bit_depth = 8; ++ _pixel_depth += 8; ++#else + info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; + info_ptr->channels++; + info_ptr->bit_depth = 8; + info_ptr->pixel_depth += 8; ++#endif + } + #endif + +@@ -427,14 +629,30 @@ bool CxImagePNG::Encode(CxFile *hFile) + /* set metrics */ + png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER); + ++#if PNG_LIBPNG_VER > 10499 ++ png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type, ++ _compression_type,_filter_type); ++#else + png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth, + info_ptr->color_type, info_ptr->interlace_type, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); ++#endif + + // simple transparency + if (info.nBkgndIndex >= 0){ ++#if PNG_LIBPNG_VER <= 10499 + info_ptr->num_trans = 1; + info_ptr->valid |= PNG_INFO_tRNS; ++#endif ++#if PNG_LIBPNG_VER > 10499 ++ png_color_16 _trans_color; ++ _trans_color.index = (BYTE)info.nBkgndIndex; ++ _trans_color.red = tc.rgbRed; ++ _trans_color.green = tc.rgbGreen; ++ _trans_color.blue = tc.rgbBlue; ++ _trans_color.gray = _trans_color.index; ++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color); ++#else + #if PNG_LIBPNG_VER > 10399 + info_ptr->trans_alpha = trans; + info_ptr->trans_color.index = (BYTE)info.nBkgndIndex; +@@ -450,6 +668,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + info_ptr->trans_values.blue = tc.rgbBlue; + info_ptr->trans_values.gray = info_ptr->trans_values.index; + #endif ++#endif + + // the transparency indexes start from 0 for non grayscale palette + if (!bGrayScale && head.biClrUsed && info.nBkgndIndex) +@@ -457,10 +676,16 @@ bool CxImagePNG::Encode(CxFile *hFile) + } + + /* set the palette if there is one */ ++#if PNG_LIBPNG_VER > 10499 ++ png_colorp _palette = NULL; ++ if (GetPalette()){ ++ /* png_set_PLTE() will be called once the palette is ready */ ++#else + if (GetPalette()){ + if (!bGrayScale){ + info_ptr->valid |= PNG_INFO_PLTE; + } ++#endif + + int nc = GetClrImportant(); + if (nc==0) nc = GetNumColors(); +@@ -468,20 +693,34 @@ bool CxImagePNG::Encode(CxFile *hFile) + if (info.bAlphaPaletteEnabled){ + for(WORD ip=0; ipnum_trans = (WORD)nc; + info_ptr->valid |= PNG_INFO_tRNS; ++#endif ++#if PNG_LIBPNG_VER > 10499 ++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL); ++#else + #if PNG_LIBPNG_VER > 10399 + info_ptr->trans_alpha = trans; + #else + info_ptr->trans = trans; + #endif ++#endif + } + + // copy the palette colors ++#if PNG_LIBPNG_VER > 10499 ++ _palette = new png_color[nc]; ++ for (int i=0; ipalette = new png_color[nc]; + info_ptr->num_palette = (png_uint_16) nc; + for (int i=0; ipalette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue); ++#endif + } + + #if CXIMAGE_SUPPORT_ALPHA // +@@ -495,8 +734,12 @@ bool CxImagePNG::Encode(CxFile *hFile) + } } } + #endif // CXIMAGE_SUPPORT_ALPHA // + ++#if PNG_LIBPNG_VER > 10499 ++ int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8)); ++#else + int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8)); + info_ptr->rowbytes = row_size; ++#endif + BYTE *row_pointers = new BYTE[row_size]; + + /* write the file information */ +@@ -514,7 +757,11 @@ bool CxImagePNG::Encode(CxFile *hFile) + if (AlphaIsValid()){ + for (long ax=head.biWidth-1; ax>=0;ax--){ + c = BlindGetPixelColor(ax,ay); ++#if PNG_LIBPNG_VER > 10499 ++ int px = ax * _channels; ++#else + int px = ax * info_ptr->channels; ++#endif + if (!bGrayScale){ + row_pointers[px++]=c.rgbRed; + row_pointers[px++]=c.rgbGreen; +@@ -529,7 +776,11 @@ bool CxImagePNG::Encode(CxFile *hFile) + #endif //CXIMAGE_SUPPORT_ALPHA // + { + iter.GetRow(row_pointers, row_size); ++#if PNG_LIBPNG_VER > 10499 ++ if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP ++#else + if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP ++#endif + RGBtoBGR(row_pointers, row_size); + png_write_row(png_ptr, row_pointers); + } +@@ -546,9 +797,14 @@ bool CxImagePNG::Encode(CxFile *hFile) + png_write_end(png_ptr, info_ptr); + + /* if you malloced the palette, free it here */ ++#if PNG_LIBPNG_VER > 10499 ++ if (_palette){ ++ delete [] (_palette); ++#else + if (info_ptr->palette){ + delete [] (info_ptr->palette); + info_ptr->palette = NULL; ++#endif + } + + /* clean up after the write, and free any memory allocated */ +diff --git a/lib/cximage-6.0/CxImage/ximapng.h b/lib/cximage-6.0/CxImage/ximapng.h +index db41935..68d8ddb 100644 +--- a/lib/cximage-6.0/CxImage/ximapng.h ++++ b/lib/cximage-6.0/CxImage/ximapng.h +@@ -69,8 +69,13 @@ class CxImagePNG: public CxImage + + static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg) + { ++#if PNG_LIBPNG_VER > 10499 ++ strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255); ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + strncpy((char*)png_ptr->error_ptr,error_msg,255); + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + }; + +-- +1.7.5.4 + diff --git a/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-991.02-simplyfing_libpng-1.5_check.patch b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-991.02-simplyfing_libpng-1.5_check.patch new file mode 100644 index 0000000000..76ee54bb28 --- /dev/null +++ b/packages/mediacenter/xbmc-rpi/patches/xbmc-rpi-535d2bd-991.02-simplyfing_libpng-1.5_check.patch @@ -0,0 +1,434 @@ +From d6d1dd650bbe94fc2b106af239e7d476879feaff Mon Sep 17 00:00:00 2001 +From: bobo1on1 +Date: Sun, 18 Mar 2012 01:02:12 +0100 +Subject: [PATCH] fixed: do the libpng version check in only one place + +--- + lib/cximage-6.0/CxImage/ximapng.cpp | 90 +++++++++++++++++----------------- + lib/cximage-6.0/CxImage/ximapng.h | 6 ++- + 2 files changed, 50 insertions(+), 46 deletions(-) + +diff --git a/lib/cximage-6.0/CxImage/ximapng.cpp b/lib/cximage-6.0/CxImage/ximapng.cpp +index 3e0cf73..adadeea 100644 +--- a/lib/cximage-6.0/CxImage/ximapng.cpp ++++ b/lib/cximage-6.0/CxImage/ximapng.cpp +@@ -15,7 +15,7 @@ + void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message) + { + strcpy(info.szLastError,message); +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + longjmp(png_jmpbuf(png_ptr), 1); + #else + longjmp(png_ptr->jmpbuf, 1); +@@ -66,7 +66,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + /* Set error handling if you are using the setjmp/longjmp method (this is + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in the png_create_read_struct() earlier. */ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (setjmp(png_jmpbuf(png_ptr))) { + #else + if (setjmp(png_ptr->jmpbuf)) { +@@ -84,7 +84,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + /* read the file information */ + png_read_info(png_ptr, info_ptr); + +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + png_uint_32 _width,_height; + int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type; + png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type, +@@ -107,7 +107,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + + /* calculate new number of channels */ + int channels=0; +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + switch(_color_type){ + #else + switch(info_ptr->color_type){ +@@ -127,7 +127,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + break; + default: + strcpy(info.szLastError,"unknown PNG color type"); +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + longjmp(png_jmpbuf(png_ptr), 1); + #else + longjmp(png_ptr->jmpbuf, 1); +@@ -135,7 +135,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + } + + //find the right pixel depth used for cximage +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr); + #else + int pixel_depth = info_ptr->pixel_depth; +@@ -144,7 +144,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + if (channels == 2) pixel_depth=8; + if (channels >= 3) pixel_depth=24; + +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){ + longjmp(png_jmpbuf(png_ptr), 1); + #else +@@ -154,7 +154,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + } + + /* get metrics */ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit; + int _phys_unit_type; + png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type); +@@ -183,7 +183,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + } + #endif + +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + int _num_palette; + png_colorp _palette; + png_uint_32 _palette_ret; +@@ -204,13 +204,13 @@ bool CxImagePNG::Decode(CxFile *hFile) + SetPaletteColor(3,255,255,255); + } else SetGrayPalette(); // needed for grayscale PNGs + +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + int nshift = max(0,(_bit_depth>>3)-1)<<3; + #else + int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3; + #endif + +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + png_bytep _trans_alpha; + int _num_trans; + png_color_16p _trans_color; +@@ -224,7 +224,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + if (info_ptr->num_trans==1){ + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){ + #endif +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + info.nBkgndIndex = _trans_color->index; + #else + #if PNG_LIBPNG_VER > 10399 +@@ -234,7 +234,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + #endif + #endif + } else{ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + info.nBkgndIndex = _trans_color->gray>>nshift; + #else + #if PNG_LIBPNG_VER > 10399 +@@ -245,7 +245,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + #endif + } + } +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (_num_trans>1 && _trans_alpha!=NULL){ + #else + if (info_ptr->num_trans>1){ +@@ -253,7 +253,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + RGBQUAD* pal=GetPalette(); + if (pal){ + DWORD ip; +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + for (ip=0;iptrans[ip]; + #endif + #endif +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + for (ip=_num_trans;ipnum_trans;ip 10499 ++#ifdef USE_NEW_LIBPNG_API + info.nBkgndColor.rgbRed = (BYTE)(_trans_color->red>>nshift); + info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift); + info.nBkgndColor.rgbBlue = (BYTE)(_trans_color->blue>>nshift); +@@ -311,7 +311,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + } + + // - flip the RGB pixels to BGR (or RGBA to BGRA) +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (_color_type & PNG_COLOR_MASK_COLOR){ + #else + if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){ +@@ -320,14 +320,14 @@ bool CxImagePNG::Decode(CxFile *hFile) + } + + // - handle cancel +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1); + #else + if (info.nEscape) longjmp(png_ptr->jmpbuf, 1); + #endif + + // row_bytes is the width x number of channels x (bit-depth / 8) +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8]; + #else + row_pointers = new BYTE[info_ptr->rowbytes + 8]; +@@ -342,12 +342,12 @@ bool CxImagePNG::Decode(CxFile *hFile) + SetCodecOption(0); + } + +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + int chan_offset = _bit_depth >> 3; + #else + int chan_offset = info_ptr->bit_depth >> 3; + #endif +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3; + #else + int pixel_offset = info_ptr->pixel_depth >> 3; +@@ -359,7 +359,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + do { + + // - handle cancel +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1); + #else + if (info.nEscape) longjmp(png_ptr->jmpbuf, 1); +@@ -374,7 +374,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + BYTE* prow= iter.GetRow(ay); + + //recover data from previous scan +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (_interlace_type && pass>0 && pass!=7){ + #else + if (info_ptr->interlace_type && pass>0 && pass!=7){ +@@ -415,7 +415,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + #endif // CXIMAGE_SUPPORT_ALPHA // vho + { + //recover data from previous scan +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (_interlace_type && pass>0){ + iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr)); + //re-expand buffer for images with bit depth > 8 +@@ -435,7 +435,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + png_read_row(png_ptr, row_pointers, NULL); + + //shrink 16 bit depth images down to 8 bits +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (_bit_depth > 8){ + #else + if (info_ptr->bit_depth > 8){ +@@ -445,13 +445,13 @@ bool CxImagePNG::Decode(CxFile *hFile) + } + + //copy the pixels +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr)); + #else + iter.SetRow(row_pointers, info_ptr->rowbytes); + #endif + // expand 2 bpp images only in the last pass +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (_bit_depth==2 && pass==(number_passes-1)) + #else + if (info_ptr->bit_depth==2 && pass==(number_passes-1)) +@@ -517,7 +517,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + /* Set error handling. REQUIRED if you aren't supplying your own + * error hadnling functions in the png_create_write_struct() call. + */ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (setjmp(png_jmpbuf(png_ptr))){ + #else + if (setjmp(png_ptr->jmpbuf)){ +@@ -535,7 +535,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data); + + /* set the file information here */ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + /* use variables to hold the values so it isnt necessary to png_get them later */ + png_uint_32 _width,_height; + int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type; +@@ -560,14 +560,14 @@ bool CxImagePNG::Encode(CxFile *hFile) + + switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){ + case 1: +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + _interlace_type = PNG_INTERLACE_ADAM7; + #else + info_ptr->interlace_type = PNG_INTERLACE_ADAM7; + #endif + break; + default: +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + _interlace_type = PNG_INTERLACE_NONE; + #else + info_ptr->interlace_type = PNG_INTERLACE_NONE; +@@ -581,20 +581,20 @@ bool CxImagePNG::Encode(CxFile *hFile) + + if (GetNumColors()){ + if (bGrayScale){ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + _color_type = PNG_COLOR_TYPE_GRAY; + #else + info_ptr->color_type = PNG_COLOR_TYPE_GRAY; + #endif + } else { +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + _color_type = PNG_COLOR_TYPE_PALETTE; + #else + info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; + #endif + } + } else { +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + _color_type = PNG_COLOR_TYPE_RGB; + #else + info_ptr->color_type = PNG_COLOR_TYPE_RGB; +@@ -602,7 +602,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + } + #if CXIMAGE_SUPPORT_ALPHA + if (AlphaIsValid()){ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + _color_type |= PNG_COLOR_MASK_ALPHA; + _channels++; + _bit_depth = 8; +@@ -629,7 +629,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + /* set metrics */ + png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER); + +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type, + _compression_type,_filter_type); + #else +@@ -644,7 +644,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + info_ptr->num_trans = 1; + info_ptr->valid |= PNG_INFO_tRNS; + #endif +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + png_color_16 _trans_color; + _trans_color.index = (BYTE)info.nBkgndIndex; + _trans_color.red = tc.rgbRed; +@@ -676,7 +676,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + } + + /* set the palette if there is one */ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + png_colorp _palette = NULL; + if (GetPalette()){ + /* png_set_PLTE() will be called once the palette is ready */ +@@ -697,7 +697,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + info_ptr->num_trans = (WORD)nc; + info_ptr->valid |= PNG_INFO_tRNS; + #endif +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL); + #else + #if PNG_LIBPNG_VER > 10399 +@@ -709,7 +709,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + } + + // copy the palette colors +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + _palette = new png_color[nc]; + for (int i=0; i + +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8)); + #else + int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8)); +@@ -757,7 +757,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + if (AlphaIsValid()){ + for (long ax=head.biWidth-1; ax>=0;ax--){ + c = BlindGetPixelColor(ax,ay); +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + int px = ax * _channels; + #else + int px = ax * info_ptr->channels; +@@ -776,7 +776,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + #endif //CXIMAGE_SUPPORT_ALPHA // + { + iter.GetRow(row_pointers, row_size); +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP + #else + if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP +@@ -797,7 +797,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + png_write_end(png_ptr, info_ptr); + + /* if you malloced the palette, free it here */ +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + if (_palette){ + delete [] (_palette); + #else +diff --git a/lib/cximage-6.0/CxImage/ximapng.h b/lib/cximage-6.0/CxImage/ximapng.h +index 68d8ddb..7d1611b 100644 +--- a/lib/cximage-6.0/CxImage/ximapng.h ++++ b/lib/cximage-6.0/CxImage/ximapng.h +@@ -30,6 +30,10 @@ + #endif + } + ++#if PNG_LIBPNG_VER > 10499 ++ #define USE_NEW_LIBPNG_API ++#endif ++ + class CxImagePNG: public CxImage + { + public: +@@ -69,7 +73,7 @@ class CxImagePNG: public CxImage + + static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg) + { +-#if PNG_LIBPNG_VER > 10499 ++#ifdef USE_NEW_LIBPNG_API + strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255); + longjmp(png_jmpbuf(png_ptr), 1); + #else +-- +1.7.5.4 +