aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-03-02 16:36:52 +0000
committerMax Horn2003-03-02 16:36:52 +0000
commit086a89f365a26796ba58e1809a7984b5d42cee51 (patch)
tree6a830b35d9fbbf186d1eeab46ab4c9224fd2f9cc
parentf6bac973f86ea3cf9f756cef7602a1decfc80d6b (diff)
downloadscummvm-rg350-086a89f365a26796ba58e1809a7984b5d42cee51.tar.gz
scummvm-rg350-086a89f365a26796ba58e1809a7984b5d42cee51.tar.bz2
scummvm-rg350-086a89f365a26796ba58e1809a7984b5d42cee51.zip
Patch #691064: dot matrix scaler
svn-id: r6663
-rw-r--r--backends/sdl/sdl-common.cpp4
-rw-r--r--backends/sdl/sdl.cpp6
-rw-r--r--common/gameDetector.cpp3
-rw-r--r--common/scaler.cpp42
-rw-r--r--common/scaler.h2
-rw-r--r--common/system.h3
-rw-r--r--gui/options.cpp1
7 files changed, 56 insertions, 5 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp
index 7adb1c7b35..fe1d5765fe 100644
--- a/backends/sdl/sdl-common.cpp
+++ b/backends/sdl/sdl-common.cpp
@@ -503,9 +503,9 @@ bool OSystem_SDL_Common::poll_event(Event *event) {
quit();
break;
}
- // Ctr-Alt-1 till Ctrl-Alt-8 will change the GFX mode
+ // Ctr-Alt-1 till Ctrl-Alt-9 will change the GFX mode
if (b == (KBD_CTRL|KBD_ALT) &&
- (ev.key.keysym.sym>='1') && (ev.key.keysym.sym<='8')) {
+ (ev.key.keysym.sym>='1') && (ev.key.keysym.sym<='9')) {
Property prop;
prop.gfx_mode = ev.key.keysym.sym - '1';
property(PROP_SET_GFX_MODE, &prop);
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index 19cde5f514..d618b60065 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -103,6 +103,10 @@ void OSystem_SDL::load_gfx_mode() {
_scaleFactor = 2;
_scaler_proc = TV2x;
break;
+ case GFX_DOTMATRIX:
+ _scaleFactor = 2;
+ _scaler_proc = DotMatrix;
+ break;
case GFX_DOUBLESIZE:
_scaleFactor = 2;
@@ -345,7 +349,7 @@ uint32 OSystem_SDL::property(int param, Property *value) {
#endif
return 1;
} else if (param == PROP_SET_GFX_MODE) {
- if (value->gfx_mode >= 8)
+ if (value->gfx_mode >= 9)
return 0;
_mode = value->gfx_mode;
diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp
index 3808ccbe6e..c9d1e37608 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,tv2x)\n"
+ "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x,dotmatrix)\n"
"\t-e<mode> - set music engine (see README for details)\n"
"\t-a - specify game is amiga version\n"
"\t-q<lang> - specify language (en,de,fr,it,pt,es,ja,zh,ko,hb)\n"
@@ -91,6 +91,7 @@ static const struct GraphicsModes gfx_modes[] = {
{"supereagle", "SuperEagle", GFX_SUPEREAGLE},
{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
{"tv2x", "TV2x", GFX_TV2X},
+ {"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
{0, 0}
};
diff --git a/common/scaler.cpp b/common/scaler.cpp
index d0244996b8..78cd5aee53 100644
--- a/common/scaler.cpp
+++ b/common/scaler.cpp
@@ -32,6 +32,20 @@ static uint32 qlowpixelMask = 0x18631863;
static uint32 redblueMask = 0xF81F;
static uint32 greenMask = 0x7E0;
+static const uint16 dotmatrix_565[16] = {
+ 0x01E0, 0x0007, 0x3800, 0x0000,
+ 0x39E7, 0x0000, 0x39E7, 0x0000,
+ 0x3800, 0x0000, 0x01E0, 0x0007,
+ 0x39E7, 0x0000, 0x39E7, 0x0000
+};
+static const uint16 dotmatrix_555[16] = {
+ 0x00E0, 0x0007, 0x1C00, 0x0000,
+ 0x1CE7, 0x0000, 0x1CE7, 0x0000,
+ 0x1C00, 0x0000, 0x00E0, 0x0007,
+ 0x1CE7, 0x0000, 0x1CE7, 0x0000
+};
+static const uint16 *dotmatrix;
+
int Init_2xSaI(uint32 BitFormat)
{
if (BitFormat == 565) {
@@ -41,6 +55,7 @@ int Init_2xSaI(uint32 BitFormat)
qlowpixelMask = 0x18631863;
redblueMask = 0xF81F;
greenMask = 0x7E0;
+ dotmatrix = dotmatrix_565;
} else if (BitFormat == 555) {
colorMask = 0x7BDE7BDE;
lowPixelMask = 0x04210421;
@@ -48,6 +63,7 @@ int Init_2xSaI(uint32 BitFormat)
qlowpixelMask = 0x0C630C63;
redblueMask = 0x7C1F;
greenMask = 0x3E0;
+ dotmatrix = dotmatrix_555;
} else {
return 0;
}
@@ -830,3 +846,29 @@ void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dst
q += nextlineDst << 1;
}
}
+
+static inline uint16 DOT_16(uint16 c, int j, int i) {
+ return c - ((c >> 2) & *(dotmatrix + ((j & 3) << 2) + (i & 3)));
+}
+
+void DotMatrix(uint8 *srcPtr, uint32 srcPitch, uint8 *null, 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;
+
+ for (int j = 0, jj = 0; j < height; ++j, jj += 2) {
+ for (int i = 0, ii = 0; i < width; ++i, ii += 2) {
+ uint16 c = *(p + i);
+ *(q + ii) = DOT_16(c, jj, ii);
+ *(q + ii + 1) = DOT_16(c, jj, ii + 1);
+ *(q + ii + nextlineDst) = DOT_16(c, jj + 1, ii);
+ *(q + ii + nextlineDst + 1) = DOT_16(c, jj + 1, ii + 1);
+ }
+ p += nextlineSrc;
+ q += nextlineDst << 1;
+ }
+}
diff --git a/common/scaler.h b/common/scaler.h
index 893bb12a8a..710fc65507 100644
--- a/common/scaler.h
+++ b/common/scaler.h
@@ -38,5 +38,7 @@ 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);
+extern void DotMatrix(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 11bf5df53b..5e729551ea 100644
--- a/common/system.h
+++ b/common/system.h
@@ -223,7 +223,8 @@ enum {
GFX_SUPER2XSAI = 4,
GFX_SUPEREAGLE = 5,
GFX_ADVMAME2X = 6,
- GFX_TV2X = 7
+ GFX_TV2X = 7,
+ GFX_DOTMATRIX = 8
};
diff --git a/gui/options.cpp b/gui/options.cpp
index 93478a635d..c6345e768e 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -70,6 +70,7 @@ GlobalOptionsDialog::GlobalOptionsDialog(NewGui *gui)
gfxPopUp->appendEntry("SuperEagle");
gfxPopUp->appendEntry("AdvMAME2x");
gfxPopUp->appendEntry("TV2x");
+ gfxPopUp->appendEntry("DotMatrix");
gfxPopUp->setSelected(0);
// The MIDI mode popup & a label