aboutsummaryrefslogtreecommitdiff
path: root/engines/tony/gfxcore.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2012-07-02 20:53:31 +1000
committerPaul Gilbert2012-07-02 20:53:31 +1000
commit58b03ec446737164782867aedc324cce3b491218 (patch)
tree5c5073dfc445f2ec138044d98b1df7bf3674950d /engines/tony/gfxcore.cpp
parent65a8799f9653956cfced0b77e8c638be7c805824 (diff)
downloadscummvm-rg350-58b03ec446737164782867aedc324cce3b491218.tar.gz
scummvm-rg350-58b03ec446737164782867aedc324cce3b491218.tar.bz2
scummvm-rg350-58b03ec446737164782867aedc324cce3b491218.zip
TONY: Refactored the Sepia (B & W) mode so the cursor is converted as well
Diffstat (limited to 'engines/tony/gfxcore.cpp')
-rw-r--r--engines/tony/gfxcore.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp
index d91f5bab4e..119b730303 100644
--- a/engines/tony/gfxcore.cpp
+++ b/engines/tony/gfxcore.cpp
@@ -433,6 +433,41 @@ void RMGfxTargetBuffer::mergeDirtyRects() {
}
}
+uint16 *RMGfxTargetBuffer::_precalcTable = NULL;
+
+/**
+ * Set up the black & white precalculated mapping table. This is only
+ * called if the user selects the black & white option.
+ */
+void RMGfxTargetBuffer::createBWPrecalcTable() {
+ _precalcTable = new uint16[0x8000];
+
+ for (int i = 0; i < 0x8000; i++) {
+ int r = (i >> 10) & 0x1F;
+ int g = (i >> 5) & 0x1F;
+ int b = i & 0x1F;
+
+ int min = MIN(r, MIN(g, b));
+ int max = MAX(r, MAX(g, b));
+
+ min = (min + max) / 2;
+
+ r = CLIP(min + 8 - 8, 0, 31);
+ g = CLIP(min + 5 - 8, 0, 31);
+ b = CLIP(min + 0 - 8, 0, 31);
+
+ _precalcTable[i] = (r << 10) | (g << 5) | b;
+ }
+}
+
+/**
+ * Frees the black & white precalculated mapping table.
+ */
+void RMGfxTargetBuffer::freeBWPrecalcTable() {
+ delete[] _precalcTable;
+ _precalcTable = NULL;
+}
+
/****************************************************************************\
* RMGfxSourceBufferPal Methods
\****************************************************************************/