aboutsummaryrefslogtreecommitdiff
path: root/common
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
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')
-rw-r--r--common/gameDetector.cpp3
-rw-r--r--common/scaler.cpp25
-rw-r--r--common/scaler.h2
-rw-r--r--common/system.h3
4 files changed, 31 insertions, 2 deletions
diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp
index 99b1300963..554f181634 100644
--- a/common/gameDetector.cpp
+++ b/common/gameDetector.cpp
@@ -47,7 +47,7 @@ static const char USAGE_STRING[] =
"\t-p<path> - look for game in <path>\n"
"\t-x[<num>] - load this savegame (default: 0 - autosave)\n"
"\t-f - fullscreen mode\n"
- "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x)\n"
+ "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x)\n"
"\t-e<mode> - set music engine (see README for details)\n"
"\t-a - specify game is amiga version\n"
"\n"
@@ -182,6 +182,7 @@ static const struct GraphicsModes gfx_modes[] = {
{"super2xsai", "Super2xSAI", GFX_SUPER2XSAI},
{"supereagle", "SuperEagle", GFX_SUPEREAGLE},
{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
+ {"tv2x", "TV2x", GFX_TV2X},
{0, 0}
};
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;
+ }
+}
diff --git a/common/scaler.h b/common/scaler.h
index f3675ccdce..893bb12a8a 100644
--- a/common/scaler.h
+++ b/common/scaler.h
@@ -36,5 +36,7 @@ extern void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
uint8 *dstPtr, uint32 dstPitch, int width, int height);
+extern void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
+ uint8 *dstPtr, uint32 dstPitch, int width, int height);
#endif
diff --git a/common/system.h b/common/system.h
index df8da3b59a..77d50e2e84 100644
--- a/common/system.h
+++ b/common/system.h
@@ -220,7 +220,8 @@ enum {
GFX_2XSAI = 3,
GFX_SUPER2XSAI = 4,
GFX_SUPEREAGLE = 5,
- GFX_ADVMAME2X = 6
+ GFX_ADVMAME2X = 6,
+ GFX_TV2X = 7
};