aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Bacca2004-02-13 12:27:26 +0000
committerNicolas Bacca2004-02-13 12:27:26 +0000
commit71c9d5c3542ea1e5bd806caa2032b1ab0c9f7786 (patch)
treecbd98b83ad374f4a2a6351549c2e872880c55b3b
parentffb7aeebf6ada1fb44b99cfbfa2a4851123d46ce (diff)
downloadscummvm-rg350-71c9d5c3542ea1e5bd806caa2032b1ab0c9f7786.tar.gz
scummvm-rg350-71c9d5c3542ea1e5bd806caa2032b1ab0c9f7786.tar.bz2
scummvm-rg350-71c9d5c3542ea1e5bd806caa2032b1ab0c9f7786.zip
Fix compile and 555 display mode
svn-id: r12855
-rw-r--r--backends/wince/CEScaler.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/backends/wince/CEScaler.cpp b/backends/wince/CEScaler.cpp
index a3348cfa8e..8fe6ea250a 100644
--- a/backends/wince/CEScaler.cpp
+++ b/backends/wince/CEScaler.cpp
@@ -22,6 +22,14 @@
#include "stdafx.h"
#include "CEScaler.h"
+template<int bitFormat, int w1, int w2, int w3, int w4>
+static inline uint16 interpolate16_4(uint16 p1, uint16 p2, uint16 p3, uint16 p4)
+ {
+ return ((((p1 & redblueMask) * w1 + (p2 & redblueMask) * w2 + (p3 & redblueMask) * w3 + (p4 & redblueMask) * w4) / (w1 + w2 + w3 + w4)) & redblueMask) |
+ ((((p1 & greenMask) * w1 + (p2 & greenMask) * w2 + (p3 & greenMask) * w3 + (p4 & greenMask) * w4) / (w1 + w2 + w3 + w4)) & greenMask);
+}
+
+
void PocketPCPortrait(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
int width, int height) {
uint8 *work;
@@ -38,9 +46,16 @@ void PocketPCPortrait(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint3
uint16 color3 = *(((const uint16 *)srcPtr) + (i + 2));
uint16 color4 = *(((const uint16 *)srcPtr) + (i + 3));
- *(((uint16 *)work) + 0) = interpolate16_2<565, 3, 1>(color1, color2);
- *(((uint16 *)work) + 1) = interpolate16_2<565, 1, 1>(color2, color3);
- *(((uint16 *)work) + 2) = interpolate16_2<565, 1, 3>(color3, color4);
+ if (gBitFormat == 565) {
+ *(((uint16 *)work) + 0) = interpolate16_2<565, 3, 1>(color1, color2);
+ *(((uint16 *)work) + 1) = interpolate16_2<565, 1, 1>(color2, color3);
+ *(((uint16 *)work) + 2) = interpolate16_2<565, 1, 3>(color3, color4);
+ }
+ else {
+ *(((uint16 *)work) + 0) = interpolate16_2<555, 3, 1>(color1, color2);
+ *(((uint16 *)work) + 1) = interpolate16_2<555, 1, 1>(color2, color3);
+ *(((uint16 *)work) + 2) = interpolate16_2<555, 1, 3>(color3, color4);
+ }
work += 3 * sizeof(uint16);
}
@@ -65,7 +80,10 @@ void PocketPCHalf(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 ds
uint16 color2 = *(((const uint16 *)srcPtr) + (i + 1));
uint16 color3 = *(((const uint16 *)srcPtr) + (i + srcPitch16));
uint16 color4 = *(((const uint16 *)srcPtr) + (i + srcPitch16 + 1));
- *(((uint16 *)work) + 0) = interpolate16_4<565, 1, 1, 1, 1>(color1, color2, color3, color4);
+ if (gBitFormat == 565)
+ *(((uint16 *)work) + 0) = interpolate16_4<565, 1, 1, 1, 1>(color1, color2, color3, color4);
+ else
+ *(((uint16 *)work) + 0) = interpolate16_4<555, 1, 1, 1, 1>(color1, color2, color3, color4);
work += sizeof(uint16);
}