[Scummvm-cvs-logs] SF.net SVN: scummvm:[54981] scummvm/trunk/backends/platform/n64
hkz at users.sourceforge.net
hkz at users.sourceforge.net
Mon Dec 20 22:46:29 CET 2010
Revision: 54981
http://scummvm.svn.sourceforge.net/scummvm/?rev=54981&view=rev
Author: hkz
Date: 2010-12-20 21:46:28 +0000 (Mon, 20 Dec 2010)
Log Message:
-----------
N64: save and return exact palette for grabPalette
Save the exact palette and return it when grabPalette is called,
The less precise 16bit conversion is still used inside though.
Modified Paths:
--------------
scummvm/trunk/backends/platform/n64/osys_n64.h
scummvm/trunk/backends/platform/n64/osys_n64_base.cpp
Modified: scummvm/trunk/backends/platform/n64/osys_n64.h
===================================================================
--- scummvm/trunk/backends/platform/n64/osys_n64.h 2010-12-20 18:44:25 UTC (rev 54980)
+++ scummvm/trunk/backends/platform/n64/osys_n64.h 2010-12-20 21:46:28 UTC (rev 54981)
@@ -91,6 +91,10 @@
OverlayColor *_overlayBuffer; // Offscreen for the overlay (16 bit)
uint16 *_screenPalette; // Array for palette entries (256 colors max)
+
+#ifndef N64_EXTREME_MEMORY_SAVING
+ uint32 *_screenExactPalette; // Array for palette entries, as received by setPalette(), no precision loss
+#endif
uint16 _cursorPalette[256]; // Palette entries for the cursor
int _graphicMode; // Graphic mode
Modified: scummvm/trunk/backends/platform/n64/osys_n64_base.cpp
===================================================================
--- scummvm/trunk/backends/platform/n64/osys_n64_base.cpp 2010-12-20 18:44:25 UTC (rev 54980)
+++ scummvm/trunk/backends/platform/n64/osys_n64_base.cpp 2010-12-20 21:46:28 UTC (rev 54981)
@@ -112,6 +112,10 @@
// Clear palette array
_screenPalette = (uint16*)memalign(8, 256 * sizeof(uint16));
+#ifndef N64_EXTREME_MEMORY_SAVING
+ _screenExactPalette = (uint32*)memalign(8, 256 * sizeof(uint32));
+ memset(_screenExactPalette, 0, 256 * sizeof(uint32));
+#endif
memset(_screenPalette, 0, 256 * sizeof(uint16));
memset(_cursorPalette, 0, 256 * sizeof(uint16));
@@ -348,6 +352,9 @@
void OSystem_N64::setPalette(const byte *colors, uint start, uint num) {
for (uint i = 0; i < num; ++i) {
_screenPalette[start + i] = colRGB888toBGR555(colors[2], colors[1], colors[0]);
+#ifndef N64_EXTREME_MEMORY_SAVING
+ _screenExactPalette[start + i] = *((uint32*)(colors));
+#endif
colors += 4;
}
@@ -395,6 +402,7 @@
}
void OSystem_N64::grabPalette(byte *colors, uint start, uint num) {
+#ifdef N64_EXTREME_MEMORY_SAVING // This way loses precisions
uint32 i;
uint16 color;
@@ -407,6 +415,9 @@
*colors++ = (((color >> 10) & 0x1F) << 3);
*colors++ = 0;
}
+#else
+ memcpy(colors, (uint8*)(_screenExactPalette + start), num * 4);
+#endif
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list