Date: Wed, 24 Dec 2014 11:46:54 +0000 (UTC) From: Antoine Brodin <antoine@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r375430 - in head/games/tuxpuck: . files Message-ID: <201412241146.sBOBksUY079407@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: antoine Date: Wed Dec 24 11:46:53 2014 New Revision: 375430 URL: https://svnweb.freebsd.org/changeset/ports/375430 QAT: https://qat.redports.org/buildarchive/r375430/ Log: Properly support png15 Obtained from: Fedora Modified: head/games/tuxpuck/Makefile head/games/tuxpuck/files/patch-png.c Modified: head/games/tuxpuck/Makefile ============================================================================== --- head/games/tuxpuck/Makefile Wed Dec 24 11:41:41 2014 (r375429) +++ head/games/tuxpuck/Makefile Wed Dec 24 11:46:53 2014 (r375430) @@ -13,7 +13,7 @@ COMMENT= Shufflepuck Cafe Clone LICENSE= GPLv2 LIB_DEPENDS= libjpeg.so:${PORTSDIR}/graphics/jpeg \ - libpng15.so:${PORTSDIR}/graphics/png \ + libpng.so:${PORTSDIR}/graphics/png \ libvorbis.so:${PORTSDIR}/audio/libvorbis \ libfreetype.so:${PORTSDIR}/print/freetype2 Modified: head/games/tuxpuck/files/patch-png.c ============================================================================== --- head/games/tuxpuck/files/patch-png.c Wed Dec 24 11:41:41 2014 (r375429) +++ head/games/tuxpuck/files/patch-png.c Wed Dec 24 11:46:53 2014 (r375430) @@ -1,18 +1,6 @@ ---- png.c.orig 2002-11-08 11:50:29.000000000 +0100 -+++ png.c 2012-04-30 06:40:16.000000000 +0200 -@@ -10,9 +10,10 @@ - #define MACOS - #endif - #include <png.h> -+#include <pngpriv.h> - - /* png code */ --static void png_read_data(png_structp ctx, png_bytep area, png_size_t size) -+static void local_png_read_data(png_structp ctx, png_bytep area, png_size_t size) - { - SDL_RWops *src; - -@@ -74,13 +75,13 @@ +--- png.c.orig 2002-11-08 10:50:29 UTC ++++ png.c +@@ -74,7 +74,7 @@ SDL_Surface *loadPNG(Uint8 * data, Uint3 * the normal method of doing things with libpng). REQUIRED unless you * set up your own error handlers in png_create_read_struct() earlier. */ @@ -21,10 +9,55 @@ SDL_SetError("Error reading the PNG file."); goto done; } +@@ -142,9 +142,9 @@ SDL_Surface *loadPNG(Uint8 * data, Uint3 + Rmask = 0x000000FF; + Gmask = 0x0000FF00; + Bmask = 0x00FF0000; +- Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0; ++ Amask = (png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0; + } else { +- int s = (info_ptr->channels == 4) ? 0 : 8; ++ int s = (png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8; + Rmask = 0xFF000000 >> s; + Gmask = 0x00FF0000 >> s; + Bmask = 0x0000FF00 >> s; +@@ -152,7 +152,7 @@ SDL_Surface *loadPNG(Uint8 * data, Uint3 + } + } + surface = SDL_AllocSurface(SDL_SWSURFACE, width, height, +- bit_depth * info_ptr->channels, Rmask, Gmask, ++ bit_depth * png_get_channels(png_ptr, info_ptr), Rmask, Gmask, + Bmask, Amask); + if (surface == NULL) { + SDL_SetError("Out of memory"); +@@ -188,6 +188,11 @@ SDL_Surface *loadPNG(Uint8 * data, Uint3 + png_read_end(png_ptr, info_ptr); - /* Set up the input control */ -- png_set_read_fn(png_ptr, src, png_read_data); -+ png_set_read_fn(png_ptr, src, local_png_read_data); - - /* Read PNG header info */ - png_read_info(png_ptr, info_ptr); + /* Load the palette, if any */ ++ ++ png_uint_32 pnum_palette; ++ png_colorp ppalette; ++ png_get_PLTE(png_ptr, info_ptr, &ppalette, &pnum_palette); ++ + palette = surface->format->palette; + if (palette) { + if (color_type == PNG_COLOR_TYPE_GRAY) { +@@ -197,12 +202,12 @@ SDL_Surface *loadPNG(Uint8 * data, Uint3 + palette->colors[i].g = i; + palette->colors[i].b = i; + } +- } else if (info_ptr->num_palette > 0) { +- palette->ncolors = info_ptr->num_palette; +- for (i = 0; i < info_ptr->num_palette; ++i) { +- palette->colors[i].b = info_ptr->palette[i].blue; +- palette->colors[i].g = info_ptr->palette[i].green; +- palette->colors[i].r = info_ptr->palette[i].red; ++ } else if ( pnum_palette > 0) { ++ palette->ncolors = pnum_palette; ++ for (i = 0; i < pnum_palette; ++i) { ++ palette->colors[i].b = ppalette[i].blue; ++ palette->colors[i].g = ppalette[i].green; ++ palette->colors[i].r = ppalette[i].red; + } + } + }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412241146.sBOBksUY079407>