diff options
author | Max Horn | 2003-03-02 16:36:52 +0000 |
---|---|---|
committer | Max Horn | 2003-03-02 16:36:52 +0000 |
commit | 086a89f365a26796ba58e1809a7984b5d42cee51 (patch) | |
tree | 6a830b35d9fbbf186d1eeab46ab4c9224fd2f9cc /common | |
parent | f6bac973f86ea3cf9f756cef7602a1decfc80d6b (diff) | |
download | scummvm-rg350-086a89f365a26796ba58e1809a7984b5d42cee51.tar.gz scummvm-rg350-086a89f365a26796ba58e1809a7984b5d42cee51.tar.bz2 scummvm-rg350-086a89f365a26796ba58e1809a7984b5d42cee51.zip |
Patch #691064: dot matrix scaler
svn-id: r6663
Diffstat (limited to 'common')
-rw-r--r-- | common/gameDetector.cpp | 3 | ||||
-rw-r--r-- | common/scaler.cpp | 42 | ||||
-rw-r--r-- | common/scaler.h | 2 | ||||
-rw-r--r-- | common/system.h | 3 |
4 files changed, 48 insertions, 2 deletions
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 }; |