aboutsummaryrefslogtreecommitdiff
path: root/common/scaler.cpp
diff options
context:
space:
mode:
authorJonathan Gray2003-01-15 02:11:37 +0000
committerJonathan Gray2003-01-15 02:11:37 +0000
commitc08d736d1d4198233b3e6920d904114bae95611e (patch)
treeb02839e86b8e6e99e5920dbf99c8a9e039e3112c /common/scaler.cpp
parentbd1b0d53ef30d437a1ebaca1397869245d30dc0e (diff)
downloadscummvm-rg350-c08d736d1d4198233b3e6920d904114bae95611e.tar.gz
scummvm-rg350-c08d736d1d4198233b3e6920d904114bae95611e.tar.bz2
scummvm-rg350-c08d736d1d4198233b3e6920d904114bae95611e.zip
add new tv scanlines graphics scaler from Gregory Montoir, use -g tv2x to try it
svn-id: r6462
Diffstat (limited to 'common/scaler.cpp')
-rw-r--r--common/scaler.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/common/scaler.cpp b/common/scaler.cpp
index c0a2e30ef4..c0e9f85719 100644
--- a/common/scaler.cpp
+++ b/common/scaler.cpp
@@ -810,3 +810,28 @@ void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32
dstPtr += dstPitch3;
}
}
+
+void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
+ int width, int height)
+{
+ unsigned int nextlineSrc = srcPitch / sizeof(short);
+ short *p = (short *)srcPtr;
+
+ unsigned int nextlineDst = dstPitch / sizeof(short);
+ short *q = (short *)dstPtr;
+
+ while(height--) {
+ for (int i = 0, j = 0; i < width; ++i, j += 2) {
+ unsigned short p1 = *(p + i);
+ unsigned short p2 = *(p + i + nextlineSrc);
+ unsigned short pi = (unsigned short)((INTERPOLATE(p1, p2) & colorMask) >> 1);
+
+ *(q + j) = p1;
+ *(q + j + 1) = p1;
+ *(q + j + nextlineDst) = pi;
+ *(q + j + nextlineDst + 1) = pi;
+ }
+ p += nextlineSrc;
+ q += nextlineDst << 1;
+ }
+}