aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heider2010-05-09 12:30:20 +0000
committerAndre Heider2010-05-09 12:30:20 +0000
commit998531a0221646cb23bc053919e341b339522ca5 (patch)
tree9b44a643bd9ed924ddf528528c95af7d502534df
parent37e5691f1e375316ac85de54cc26f1675c9297d4 (diff)
downloadscummvm-rg350-998531a0221646cb23bc053919e341b339522ca5.tar.gz
scummvm-rg350-998531a0221646cb23bc053919e341b339522ca5.tar.bz2
scummvm-rg350-998531a0221646cb23bc053919e341b339522ca5.zip
Since configure allows HQ scalers without the normal onces, allow this combination.
svn-id: r48979
-rw-r--r--backends/platform/sdl/graphics.cpp62
-rw-r--r--backends/platform/sdl/sdl.cpp8
-rw-r--r--graphics/module.mk9
-rw-r--r--graphics/scaler.h4
4 files changed, 48 insertions, 35 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index b3ef101e9e..425cc367f4 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -45,23 +45,27 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{"supereagle", "SuperEagle", GFX_SUPEREAGLE},
{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
{"advmame3x", "AdvMAME3x", GFX_ADVMAME3X},
+ {"tv2x", "TV2x", GFX_TV2X},
+ {"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
+#endif
#ifdef USE_HQ_SCALERS
{"hq2x", "HQ2x", GFX_HQ2X},
{"hq3x", "HQ3x", GFX_HQ3X},
#endif
- {"tv2x", "TV2x", GFX_TV2X},
- {"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
-#endif
{0, 0, 0}
};
// Table of relative scalers magnitudes
// [definedScale - 1][scaleFactor - 1]
static ScalerProc *scalersMagn[3][3] = {
-#ifdef USE_SCALERS
+#if defined(USE_SCALERS)
{ Normal1x, AdvMame2x, AdvMame3x },
{ Normal1x, Normal1x, Normal1o5x },
{ Normal1x, Normal1x, Normal1x }
+#elif defined(USE_HQ_SCALERS)
+ { Normal1x, HQ2x, HQ3x },
+ { Normal1x, Normal1x, Normal1x },
+ { Normal1x, Normal1x, Normal1x }
#else // remove dependencies on other scalers
{ Normal1x, Normal1x, Normal1x },
{ Normal1x, Normal1x, Normal1x },
@@ -80,7 +84,7 @@ static const int s_gfxModeSwitchTable[][4] = {
{ GFX_NORMAL, GFX_DOTMATRIX, -1, -1 }
};
-#ifdef USE_SCALERS
+#if defined(USE_SCALERS) || defined(USE_HQ_SCALERS)
static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY);
#endif
@@ -331,6 +335,13 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
case GFX_ADVMAME3X:
newScaleFactor = 3;
break;
+ case GFX_TV2X:
+ newScaleFactor = 2;
+ break;
+ case GFX_DOTMATRIX:
+ newScaleFactor = 2;
+ break;
+#endif // USE_SCALERS
#ifdef USE_HQ_SCALERS
case GFX_HQ2X:
newScaleFactor = 2;
@@ -339,13 +350,6 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
newScaleFactor = 3;
break;
#endif
- case GFX_TV2X:
- newScaleFactor = 2;
- break;
- case GFX_DOTMATRIX:
- newScaleFactor = 2;
- break;
-#endif // USE_SCALERS
default:
warning("unknown gfx mode %d", mode);
@@ -395,6 +399,13 @@ void OSystem_SDL::setGraphicsModeIntern() {
case GFX_ADVMAME3X:
newScalerProc = AdvMame3x;
break;
+ case GFX_TV2X:
+ newScalerProc = TV2x;
+ break;
+ case GFX_DOTMATRIX:
+ newScalerProc = DotMatrix;
+ break;
+#endif // USE_SCALERS
#ifdef USE_HQ_SCALERS
case GFX_HQ2X:
newScalerProc = HQ2x;
@@ -403,13 +414,6 @@ void OSystem_SDL::setGraphicsModeIntern() {
newScalerProc = HQ3x;
break;
#endif
- case GFX_TV2X:
- newScalerProc = TV2x;
- break;
- case GFX_DOTMATRIX:
- newScalerProc = DotMatrix;
- break;
-#endif // USE_SCALERS
default:
error("Unknown gfx mode %d", _videoMode.mode);
@@ -898,7 +902,7 @@ void OSystem_SDL::internUpdateScreen() {
r->w = r->w * scale1;
r->h = dst_h * scale1;
-#ifdef USE_SCALERS
+#if defined(USE_SCALERS) || defined(USE_HQ_SCALERS)
if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible)
r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1);
#endif
@@ -1110,7 +1114,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool realCoordinates)
h = height - y;
}
-#ifdef USE_SCALERS
+#if defined(USE_SCALERS) || defined(USE_HQ_SCALERS)
if (_videoMode.aspectRatioCorrection && !_overlayVisible && !realCoordinates) {
makeRectStretchable(x, y, w, h);
}
@@ -1371,7 +1375,7 @@ void OSystem_SDL::clearOverlay() {
_scalerProc((byte *)(_tmpscreen->pixels) + _tmpscreen->pitch + 2, _tmpscreen->pitch,
(byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight);
-#ifdef USE_SCALERS
+#if defined(USE_SCALERS) || defined(USE_HQ_SCALERS)
if (_videoMode.aspectRatioCorrection)
stretch200To240((uint8 *)_overlayscreen->pixels, _overlayscreen->pitch,
_videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0);
@@ -1664,7 +1668,7 @@ void OSystem_SDL::blitCursor() {
_mouseCurState.vHotY = _mouseCurState.hotY;
}
-#ifdef USE_SCALERS
+#if defined(USE_SCALERS) || defined(USE_HQ_SCALERS)
int rH1 = rH; // store original to pass to aspect-correction function later
#endif
@@ -1702,8 +1706,10 @@ void OSystem_SDL::blitCursor() {
// If possible, use the same scaler for the cursor as for the rest of
// the game. This only works well with the non-blurring scalers so we
// actually only use the 1x, 1.5x, 2x and AdvMame scalers.
-
- if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE))
+ if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE ||
+ _videoMode.mode == GFX_TRIPLESIZE ||
+ _videoMode.mode == GFX_HQ2X ||
+ _videoMode.mode == GFX_HQ3X))
scalerProc = _scalerProc;
else
scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1];
@@ -1712,7 +1718,7 @@ void OSystem_SDL::blitCursor() {
_mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch,
_mouseCurState.w, _mouseCurState.h);
-#ifdef USE_SCALERS
+#if defined(USE_SCALERS) || defined(USE_HQ_SCALERS)
if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1)
cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0);
#endif
@@ -1721,9 +1727,9 @@ void OSystem_SDL::blitCursor() {
SDL_UnlockSurface(_mouseOrigSurface);
}
-#ifdef USE_SCALERS
+#if defined(USE_SCALERS) || defined(USE_HQ_SCALERS)
// Basically it is kVeryFastAndUglyAspectMode of stretch200To240 from
-// common/scale/aspect.cpp
+// graphics/scale/aspect.cpp
static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY) {
int maxDstY = real2Aspect(origSrcY + height - 1);
int y;
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 6b23acfb8b..c9363fae51 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -94,7 +94,7 @@ AspectRatio::AspectRatio(int w, int h) {
_kh = h;
}
-#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && defined(USE_SCALERS)
+#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && (defined(USE_SCALERS) || defined(USE_HQ_SCALERS))
static const size_t AR_COUNT = 4;
static const char* desiredAspectRatioAsStrings[AR_COUNT] = { "auto", "4/3", "16/9", "16/10" };
static const AspectRatio desiredAspectRatios[AR_COUNT] = { AspectRatio(0, 0), AspectRatio(4,3), AspectRatio(16,9), AspectRatio(16,10) };
@@ -150,12 +150,16 @@ void OSystem_SDL::initBackend() {
memset(&_transactionDetails, 0, sizeof(_transactionDetails));
_cksumValid = false;
-#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && defined(USE_SCALERS)
+#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && (defined(USE_SCALERS) || defined(USE_HQ_SCALERS))
_videoMode.mode = GFX_DOUBLESIZE;
_videoMode.scaleFactor = 2;
_videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
_videoMode.desiredAspectRatio = getDesiredAspectRatio();
+#ifdef USE_SCALERS
_scalerProc = Normal2x;
+#else
+ _scalerProc = HQ2x;
+#endif
#else // for small screen platforms
_videoMode.mode = GFX_NORMAL;
_videoMode.scaleFactor = 1;
diff --git a/graphics/module.mk b/graphics/module.mk
index 15fbf092b3..85a1afe3a8 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -48,7 +48,14 @@ MODULE_OBJS += \
scaler/Normal2xARM.o
endif
+endif
+
ifdef USE_HQ_SCALERS
+ifndef USE_SCALERS
+MODULE_OBJS += \
+ scaler/aspect.o
+endif
+
MODULE_OBJS += \
scaler/hq2x.o \
scaler/hq3x.o
@@ -61,7 +68,5 @@ endif
endif
-endif
-
# Include common rules
include $(srcdir)/rules.mk
diff --git a/graphics/scaler.h b/graphics/scaler.h
index 22bda5273a..1ee1503967 100644
--- a/graphics/scaler.h
+++ b/graphics/scaler.h
@@ -42,7 +42,6 @@ typedef void ScalerProc(const uint8 *srcPtr, uint32 srcPitch,
DECLARE_SCALER(Normal1x);
#ifdef USE_SCALERS
-
DECLARE_SCALER(Normal2x);
DECLARE_SCALER(Normal3x);
DECLARE_SCALER(Normal1o5x);
@@ -56,14 +55,13 @@ DECLARE_SCALER(AdvMame3x);
DECLARE_SCALER(TV2x);
DECLARE_SCALER(DotMatrix);
+#endif // #ifdef USE_SCALERS
#ifdef USE_HQ_SCALERS
DECLARE_SCALER(HQ2x);
DECLARE_SCALER(HQ3x);
#endif
-#endif // #ifdef USE_SCALERS
-
// creates a 160x100 thumbnail for 320x200 games
// and 160x120 thumbnail for 320x240 and 640x480 games
// only 565 mode