diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-12-25 12:30:49 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-12-25 12:30:49 +0000 |
commit | d5fb765fcc5daace6f91c0a8c71740328ca44964 (patch) | |
tree | ae65adaa415790088610ae746465452003eb27ea /graphics | |
parent | Finish properly support png 1.5 (diff) |
Properly support png 1.5
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/simpleviewer/Makefile | 3 | ||||
-rw-r--r-- | graphics/simpleviewer/files/patch-formatpng.cpp | 10 | ||||
-rw-r--r-- | graphics/simpleviewer/files/patch-src_fileslist.cpp | 2 | ||||
-rw-r--r-- | graphics/simpleviewer/files/patch-src_formats_formatpng.cpp | 68 |
4 files changed, 70 insertions, 13 deletions
diff --git a/graphics/simpleviewer/Makefile b/graphics/simpleviewer/Makefile index 3a8b515254df..e042ae81bce6 100644 --- a/graphics/simpleviewer/Makefile +++ b/graphics/simpleviewer/Makefile @@ -14,14 +14,13 @@ COMMENT= Small and simple OpenGL image viewer with transparency support LICENSE= GPLv2 LIB_DEPENDS= libjpeg.so:${PORTSDIR}/graphics/jpeg \ - libpng15.so:${PORTSDIR}/graphics/png \ + libpng.so:${PORTSDIR}/graphics/png \ libgif.so:${PORTSDIR}/graphics/giflib USES= tar:bzip2 USE_EFL= imlib2 USE_GL= glut WRKSRC= ${WRKDIR}/sviewgl-src -CFLAGS+= -I${LOCALBASE}/include/libpng15 MAKE_ARGS= CC="${CXX}" PLIST_FILES= bin/sviewgl diff --git a/graphics/simpleviewer/files/patch-formatpng.cpp b/graphics/simpleviewer/files/patch-formatpng.cpp deleted file mode 100644 index b910eb4ffbf7..000000000000 --- a/graphics/simpleviewer/files/patch-formatpng.cpp +++ /dev/null @@ -1,10 +0,0 @@ ---- src/formats/formatpng.cpp.orig 2010-08-29 16:33:33.000000000 +0200 -+++ src/formats/formatpng.cpp 2012-05-05 07:46:22.000000000 +0200 -@@ -7,6 +7,7 @@ - - #include "formatpng.h" - #include <png.h> -+#include <pngpriv.h> - #include <string.h> - #include <iostream> - diff --git a/graphics/simpleviewer/files/patch-src_fileslist.cpp b/graphics/simpleviewer/files/patch-src_fileslist.cpp index 4cce9d72563d..0ec8536c8c35 100644 --- a/graphics/simpleviewer/files/patch-src_fileslist.cpp +++ b/graphics/simpleviewer/files/patch-src_fileslist.cpp @@ -1,4 +1,4 @@ ---- src/fileslist.cpp.orig 2010-05-13 07:15:11.000000000 +0000 +--- src/fileslist.cpp.orig 2010-05-13 07:15:11 UTC +++ src/fileslist.cpp @@ -8,6 +8,7 @@ #include "fileslist.h" diff --git a/graphics/simpleviewer/files/patch-src_formats_formatpng.cpp b/graphics/simpleviewer/files/patch-src_formats_formatpng.cpp new file mode 100644 index 000000000000..1a1d05032531 --- /dev/null +++ b/graphics/simpleviewer/files/patch-src_formats_formatpng.cpp @@ -0,0 +1,68 @@ +--- src/formats/formatpng.cpp.orig 2010-08-29 14:33:33 UTC ++++ src/formats/formatpng.cpp +@@ -57,9 +57,9 @@ bool CFormatPng::Load(const char* filena + png_read_info(png, info); + + // get real bits per pixel +- m_bppImage = info->pixel_depth; ++ m_bppImage = png_get_bit_depth(png, info) * png_get_channels(png, info); + +- if(info->color_type == PNG_COLOR_TYPE_PALETTE) { ++ if(png_get_color_type(png, info) == PNG_COLOR_TYPE_PALETTE) { + png_set_palette_to_rgb(png); + } + +@@ -73,20 +73,20 @@ bool CFormatPng::Load(const char* filena + if(png_get_valid(png, info, PNG_INFO_tRNS)) { + png_set_tRNS_to_alpha(png); + } +- if(info->bit_depth == 16) { ++ if(png_get_bit_depth(png, info) == 16) { + png_set_strip_16(png); + } +- if(info->color_type == PNG_COLOR_TYPE_GRAY || info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { ++ if(png_get_color_type(png, info) == PNG_COLOR_TYPE_GRAY || png_get_color_type(png, info) == PNG_COLOR_TYPE_GRAY_ALPHA) { + png_set_gray_to_rgb(png); + } + + // int number_of_passes = png_set_interlace_handling(png); + png_read_update_info(png, info); + +- m_width = info->width; +- m_height = info->height; +- m_pitch = info->rowbytes; +- m_bpp = info->pixel_depth; ++ m_width = png_get_image_width(png, info); ++ m_height = png_get_image_height(png, info); ++ m_pitch = png_get_rowbytes(png, info); ++ m_bpp = png_get_bit_depth(png, info) * png_get_channels(png, info); + + // read file + if(setjmp(png_jmpbuf(png)) != 0) { +@@ -98,7 +98,7 @@ bool CFormatPng::Load(const char* filena + // create buffer and read data + png_bytep* row_pointers = new png_bytep[m_height]; + for(int y = 0; y < m_height; y++) { +- row_pointers[y] = new png_byte[info->rowbytes]; ++ row_pointers[y] = new png_byte[png_get_rowbytes(png, info)]; + } + png_read_image(png, row_pointers); + +@@ -106,7 +106,7 @@ bool CFormatPng::Load(const char* filena + m_sizeMem = m_pitch * m_height; + m_bitmap = new unsigned char[m_sizeMem]; + +- if(info->color_type == PNG_COLOR_TYPE_RGB) { ++ if(png_get_color_type(png, info) == PNG_COLOR_TYPE_RGB) { + m_format = GL_RGB; + for(int y = 0; y < m_height; y++) { + int dst = y * m_pitch; +@@ -123,7 +123,7 @@ bool CFormatPng::Load(const char* filena + delete[] row_pointers[y]; + } + } +- else if(info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { ++ else if(png_get_color_type(png, info) == PNG_COLOR_TYPE_RGB_ALPHA) { + m_format = GL_RGBA; + for(int y = 0; y < m_height; y++) { + int dst = y * m_pitch; |