[mupen64plus-video-rice] 63/191: Convert 8-bit png to truecolor when needed
Sven Eckelmann
ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:17:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-video-rice.
commit a1835b851870a082520e0d40af4e1a2bddd2c51c
Author: Sven Eckelmann <sven at narfation.org>
Date: Sun Jul 24 10:41:22 2011 +0200
Convert 8-bit png to truecolor when needed
---
debian/changelog | 2 +
debian/patches/png_truecolor_conversation.patch | 50 +++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 53 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index f9f2d5f..9dede0f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ mupen64plus-video-rice (1.99.4-3) UNRELEASED; urgency=low
* debian/patches:
- Remove default-optimisations.patch, hurd_os.patch
- Add rewrite_makefile.patch, Rewrite Makefile to fix flags and linking
+ - Add png_truecolor_conversation.patch, Convert 8-bit png to truecolor when
+ needed
* Depend on pkg-config in debian/control for new Makefile
-- Sven Eckelmann <sven at narfation.org> Sat, 23 Jul 2011 16:42:59 +0200
diff --git a/debian/patches/png_truecolor_conversation.patch b/debian/patches/png_truecolor_conversation.patch
new file mode 100644
index 0000000..c3f1ec1
--- /dev/null
+++ b/debian/patches/png_truecolor_conversation.patch
@@ -0,0 +1,50 @@
+Description: Convert 8-bit png to truecolor when needed
+ fix errors when using some texture packs that have PNGs saved in the wrong
+ format (8-bit PNG but should be true color)
+Origin: upstream, https://bitbucket.org/richard42/mupen64plus-video-rice/changeset/26cae4093009
+Author: Richard Goedeken <Richard at fascinationsoftware.com>
+
+---
+diff --git a/src/TextureFilters.cpp b/src/TextureFilters.cpp
+index 20f904d8be25a2073b9527202342b0848c72a4d4..7837887a076ffd8b608b51fa11cab51ea95ff062 100644
+--- a/src/TextureFilters.cpp
++++ b/src/TextureFilters.cpp
+@@ -1565,9 +1565,28 @@ bool LoadRGBBufferFromPNGFile(char *filename, unsigned char **pbuf, int &width,
+ pSrc++;
+ }
+ }
++ else if (img.bits_per_pixel == 8 && (bits_per_pixel == 24 || bits_per_pixel == 32))
++ {
++ // do palette lookup and convert 8bpp to 24/32bpp
++ int destBytePP = bits_per_pixel / 8;
++ int paletteBytePP = img.bytes_per_palette_entry;
++ unsigned char *pSrc = img.bits;
++ unsigned char *pDst = *pbuf;
++ // clear the destination image data (just to clear alpha if bpp=32)
++ memset(*pbuf, 0, img.width*img.height*destBytePP);
++ for (int i = 0; i < (int)(img.width*img.height); i++)
++ {
++ unsigned char clridx = *pSrc++;
++ unsigned char *palcolor = img.palette + clridx * paletteBytePP;
++ pDst[0] = palcolor[2]; // red
++ pDst[1] = palcolor[1]; // green
++ pDst[2] = palcolor[0]; // blue
++ pDst += destBytePP;
++ }
++ }
+ else
+ {
+- DebugMessage(M64MSG_ERROR, "PNG file is %i bpp but texture is %i bpp.", img.bits_per_pixel, bits_per_pixel);
++ DebugMessage(M64MSG_ERROR, "PNG file '%s' is %i bpp but texture is %i bpp.", filename, img.bits_per_pixel, bits_per_pixel);
+ delete [] *pbuf;
+ *pbuf = NULL;
+ }
+@@ -1580,7 +1599,7 @@ bool LoadRGBBufferFromPNGFile(char *filename, unsigned char **pbuf, int &width,
+ }
+ else
+ {
+- DebugMessage(M64MSG_ERROR, "ReadPNG() returned error in LoadRGBBufferFromPNGFile!");
++ DebugMessage(M64MSG_ERROR, "ReadPNG() returned error for '%s' in LoadRGBBufferFromPNGFile!", filename);
+ *pbuf = NULL;
+ return false;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 09eb613..e1b5d8d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
rewrite_makefile.patch
highres_memcorruption.patch
+png_truecolor_conversation.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-video-rice.git
More information about the Pkg-games-commits
mailing list