Fixed bug in the saving of pictures with a PAL palette.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@155 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2002-12-05 16:44:56 +00:00
parent bbc5ada9e6
commit fd2dc1e33b
1 changed files with 5 additions and 11 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Snapshot.cxx,v 1.3 2002-08-03 22:52:39 stephena Exp $ // $Id: Snapshot.cxx,v 1.4 2002-12-05 16:44:56 stephena Exp $
//============================================================================ //============================================================================
#include <png.h> #include <png.h>
@ -90,17 +90,11 @@ int Snapshot::savePNG(string filename, MediaSource& mediaSource, int multiplier)
} }
const uInt32* gamePalette = mediaSource.palette(); const uInt32* gamePalette = mediaSource.palette();
for(uInt32 i = 0; i < 256; i += 2) for(uInt32 i = 0; i < 256; ++i)
{ {
uInt8 r, g, b; palette[i].red = (uInt8) ((gamePalette[i] & 0x00ff0000) >> 16);
palette[i].green = (uInt8) ((gamePalette[i] & 0x0000ff00) >> 8);
r = (uInt8) ((gamePalette[i] & 0x00ff0000) >> 16); palette[i].blue = (uInt8) (gamePalette[i] & 0x000000ff);
g = (uInt8) ((gamePalette[i] & 0x0000ff00) >> 8);
b = (uInt8) (gamePalette[i] & 0x000000ff);
palette[i].red = palette[i+1].red = r;
palette[i].green = palette[i+1].green = g;
palette[i].blue = palette[i+1].blue = b;
} }
} }