aboutsummaryrefslogtreecommitdiff
path: root/common/scaler.cpp
diff options
context:
space:
mode:
authorMax Horn2003-05-09 22:44:16 +0000
committerMax Horn2003-05-09 22:44:16 +0000
commit37724d929721836821065b2a177ae2f298bd1ed5 (patch)
tree50ddae26d30216a6230062335129d0d40ef5ed16 /common/scaler.cpp
parent54a9ad3204140aba204474d186058db627b2584d (diff)
downloadscummvm-rg350-37724d929721836821065b2a177ae2f298bd1ed5.tar.gz
scummvm-rg350-37724d929721836821065b2a177ae2f298bd1ed5.tar.bz2
scummvm-rg350-37724d929721836821065b2a177ae2f298bd1ed5.zip
Patch #735294: AdvMame3x scaler
svn-id: r7409
Diffstat (limited to 'common/scaler.cpp')
-rw-r--r--common/scaler.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/common/scaler.cpp b/common/scaler.cpp
index 320f67ef5d..96d25f3b3c 100644
--- a/common/scaler.cpp
+++ b/common/scaler.cpp
@@ -746,6 +746,44 @@ void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
}
}
+void AdvMame3x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+ int width, int height) {
+ unsigned int nextlineSrc = srcPitch / sizeof(uint16);
+ uint16 *p = (uint16 *)srcPtr;
+
+ unsigned int nextlineDst = dstPitch / sizeof(uint16);
+ uint16 *q = (uint16 *)dstPtr;
+
+ uint16 A, B, C;
+ uint16 D, E, F;
+ uint16 G, H, I;
+
+ while (height--) {
+ B = C = *(p - nextlineSrc);
+ E = F = *(p);
+ H = I = *(p + nextlineSrc);
+ for (int i = 0; i < width; ++i) {
+ p++;
+ A = B; B = C; C = *(p - nextlineSrc);
+ D = E; E = F; F = *(p);
+ G = H; H = I; I = *(p + nextlineSrc);
+
+ *(q) = D == B && B != F && D != H ? D : E;
+ *(q + 1) = E;
+ *(q + 2) = B == F && B != D && F != H ? F : E;
+ *(q + nextlineDst) = E;
+ *(q + nextlineDst + 1) = E;
+ *(q + nextlineDst + 2) = E;
+ *(q + 2 * nextlineDst) = D == H && D != B && H != F ? D : E;
+ *(q + 2 * nextlineDst + 1) = E;
+ *(q + 2 * nextlineDst + 2) = H == F && D != H && B != F ? F : E;
+ q += 3;
+ }
+ p += nextlineSrc - width;
+ q += (nextlineDst - width) * 3;
+ }
+}
+
void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
int width, int height) {
while (height--) {