aboutsummaryrefslogtreecommitdiff
path: root/common
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
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')
-rw-r--r--common/gameDetector.cpp1
-rw-r--r--common/scaler.cpp38
-rw-r--r--common/scaler.h6
3 files changed, 43 insertions, 2 deletions
diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp
index 27c9b7bb05..885a1e5754 100644
--- a/common/gameDetector.cpp
+++ b/common/gameDetector.cpp
@@ -90,6 +90,7 @@ static const struct GraphicsMode gfx_modes[] = {
{"super2xsai", "Super2xSAI", GFX_SUPER2XSAI},
{"supereagle", "SuperEagle", GFX_SUPEREAGLE},
{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
+ {"advmame3x", "AdvMAME3x", GFX_ADVMAME3X},
{"tv2x", "TV2x", GFX_TV2X},
{"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
#else
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--) {
diff --git a/common/scaler.h b/common/scaler.h
index 0b4c6d4186..668b02cb95 100644
--- a/common/scaler.h
+++ b/common/scaler.h
@@ -31,6 +31,7 @@ DECLARE_SCALER(_2xSaI);
DECLARE_SCALER(Super2xSaI);
DECLARE_SCALER(SuperEagle);
DECLARE_SCALER(AdvMame2x);
+DECLARE_SCALER(AdvMame3x);
DECLARE_SCALER(Normal1x);
DECLARE_SCALER(Normal2x);
DECLARE_SCALER(Normal3x);
@@ -46,8 +47,9 @@ enum {
GFX_SUPER2XSAI = 4,
GFX_SUPEREAGLE = 5,
GFX_ADVMAME2X = 6,
- GFX_TV2X = 7,
- GFX_DOTMATRIX = 8,
+ GFX_ADVMAME3X = 7,
+ GFX_TV2X = 8,
+ GFX_DOTMATRIX = 9,
GFX_FLIPPING = 100, // Palmos
GFX_DOUBLEBUFFER = 101 // Palmos