aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/wince/CEScaler.cpp32
-rw-r--r--backends/platform/wince/CEScaler.h7
2 files changed, 23 insertions, 16 deletions
diff --git a/backends/platform/wince/CEScaler.cpp b/backends/platform/wince/CEScaler.cpp
index cb97907497..a8f5931e79 100644
--- a/backends/platform/wince/CEScaler.cpp
+++ b/backends/platform/wince/CEScaler.cpp
@@ -41,26 +41,36 @@ void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, ui
template<typename ColorMask>
void SmartphoneLandscapeTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
- uint8 *work;
int line = 0;
- while (height--) {
- work = dstPtr;
+ assert((width % 16) == 0);
- for (int i = 0; i < width; i += 3) {
- // Filter 2/3
- uint16 color1 = *(((const uint16 *)srcPtr) + i);
- uint16 color2 = *(((const uint16 *)srcPtr) + (i + 1));
- uint16 color3 = *(((const uint16 *)srcPtr) + (i + 2));
+ while (height--) {
+ uint16 *d = (uint16 *)dstPtr;
- *(((uint16 *)work) + 0) = interpolate32_3_1<ColorMask>(color1, color2);
- *(((uint16 *)work) + 1) = interpolate32_3_1<ColorMask>(color3, color2);
+ const uint16 *s = (const uint16 *)srcPtr;
+ for (int i = 0; i < width; i += 16) {
+ // Downscale horizontally to 11/16.
+ // See smartLandScale.s for an explanation of the scale pattern.
+ *d++ = interpolate32_3_1<ColorMask>(s[0], s[1]);
+ *d++ = interpolate32_1_1<ColorMask>(s[1], s[2]);
+ *d++ = interpolate32_3_1<ColorMask>(s[3], s[2]);
+ *d++ = interpolate32_1_1<ColorMask>(s[4], s[5]);
+ *d++ = interpolate32_3_1<ColorMask>(s[6], s[7]);
+ *d++ = interpolate32_1_1<ColorMask>(s[7], s[8]);
+ *d++ = interpolate32_3_1<ColorMask>(s[9], s[8]);
+ *d++ = interpolate32_1_1<ColorMask>(s[10], s[11]);
+ *d++ = interpolate32_3_1<ColorMask>(s[12], s[13]);
+ *d++ = interpolate32_1_1<ColorMask>(s[13], s[14]);
+ *d++ = interpolate32_3_1<ColorMask>(s[15], s[14]);
- work += 2 * sizeof(uint16);
+ s += 16;
}
srcPtr += srcPitch;
dstPtr += dstPitch;
line++;
+
+ // Skip every 8th row
if (line == 7) {
line = 0;
srcPtr += srcPitch;
diff --git a/backends/platform/wince/CEScaler.h b/backends/platform/wince/CEScaler.h
index a51cd5528c..c93e1c66ca 100644
--- a/backends/platform/wince/CEScaler.h
+++ b/backends/platform/wince/CEScaler.h
@@ -32,11 +32,8 @@
#include "graphics/scaler/intern.h"
/**
- * This filter (down)scales the source image horizontally by a factor of 2/3
- * and vertically by 7/8. For example, a 320x200 image is scaled to 213x175.
- *
- * @note The ARM asm version seems to work differently ?!? It apparently scales
- * horizontally by 11/16. Thus a 320x200 image is scaled to 220x175.
+ * This filter (down)scales the source image horizontally by a factor of 11/16
+ * and vertically by 7/8. For example, a 320x200 image is scaled to 220x175.
*/
DECLARE_SCALER(SmartphoneLandscape);