aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Cawley2019-12-23 23:26:25 +0000
committerFilippos Karapetis2019-12-25 08:52:19 +0200
commite2e72af31d45ee1c28b38a30b1eeb93d791839a7 (patch)
treede642a3bea20a189fbb952e1f8ac1909b3e4f8bc
parentf328ab43694b74adf56924ed9d8b4da74be4f7ac (diff)
downloadscummvm-rg350-e2e72af31d45ee1c28b38a30b1eeb93d791839a7.tar.gz
scummvm-rg350-e2e72af31d45ee1c28b38a30b1eeb93d791839a7.tar.bz2
scummvm-rg350-e2e72af31d45ee1c28b38a30b1eeb93d791839a7.zip
SDL: Remove duplicated cursorStretch200To240() function
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp27
-rw-r--r--graphics/scaler/aspect.cpp11
-rw-r--r--graphics/scaler/aspect.h2
3 files changed, 6 insertions, 34 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 21a8265d8c..bb7221da4b 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -106,10 +106,6 @@ static const int s_gfxModeSwitchTable[][4] = {
{ GFX_NORMAL, GFX_DOTMATRIX, -1, -1 }
};
-#ifdef USE_SCALERS
-static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY);
-#endif
-
AspectRatio::AspectRatio(int w, int h) {
// TODO : Validation and so on...
// Currently, we just ensure the program don't instantiate non-supported aspect ratios
@@ -2224,34 +2220,13 @@ void SurfaceSdlGraphicsManager::blitCursor() {
#ifdef USE_SCALERS
if (!_cursorDontScale && _videoMode.aspectRatioCorrection)
- cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0);
+ stretch200To240Nearest((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0);
#endif
SDL_UnlockSurface(_mouseSurface);
SDL_UnlockSurface(_mouseOrigSurface);
}
-#ifdef USE_SCALERS
-// Basically it is stretch200To240Nearest from common/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;
- const uint8 *startSrcPtr = buf + srcX * 2 + (srcY - origSrcY) * pitch;
- uint8 *dstPtr = buf + srcX * 2 + maxDstY * pitch;
-
- for (y = maxDstY; y >= srcY; y--) {
- const uint8 *srcPtr = startSrcPtr + aspect2Real(y) * pitch;
-
- if (srcPtr == dstPtr)
- break;
- memcpy(dstPtr, srcPtr, width * 2);
- dstPtr -= pitch;
- }
-
- return 1 + maxDstY - srcY;
-}
-#endif
-
void SurfaceSdlGraphicsManager::undrawMouse() {
const int x = _mouseBackup.x;
const int y = _mouseBackup.y;
diff --git a/graphics/scaler/aspect.cpp b/graphics/scaler/aspect.cpp
index dae1d41079..1c2844955f 100644
--- a/graphics/scaler/aspect.cpp
+++ b/graphics/scaler/aspect.cpp
@@ -205,8 +205,7 @@ void makeRectStretchable(int &x, int &y, int &w, int &h, bool interpolate) {
* srcY + height - 1, and it should be stretched to Y coordinates srcY
* through real2Aspect(srcY + height - 1).
*/
-
-template<typename ColorMask>
+
int stretch200To240Nearest(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY) {
int maxDstY = real2Aspect(origSrcY + height - 1);
int y;
@@ -224,7 +223,6 @@ int stretch200To240Nearest(uint8 *buf, uint32 pitch, int width, int height, int
return 1 + maxDstY - srcY;
}
-
template<typename ColorMask>
int stretch200To240Interpolated(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY) {
int maxDstY = real2Aspect(origSrcY + height - 1);
@@ -262,8 +260,8 @@ int stretch200To240Interpolated(uint8 *buf, uint32 pitch, int width, int height,
}
int stretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY, bool interpolate) {
- extern int gBitFormat;
#if ASPECT_MODE != kSuperFastAndUglyAspectMode
+ extern int gBitFormat;
if (interpolate) {
if (gBitFormat == 565)
return stretch200To240Interpolated<Graphics::ColorMasks<565> >(buf, pitch, width, height, srcX, srcY, origSrcY);
@@ -271,10 +269,7 @@ int stretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, i
return stretch200To240Interpolated<Graphics::ColorMasks<555> >(buf, pitch, width, height, srcX, srcY, origSrcY);
} else {
#endif
- if (gBitFormat == 565)
- return stretch200To240Nearest<Graphics::ColorMasks<565> >(buf, pitch, width, height, srcX, srcY, origSrcY);
- else // gBitFormat == 555
- return stretch200To240Nearest<Graphics::ColorMasks<555> >(buf, pitch, width, height, srcX, srcY, origSrcY);
+ return stretch200To240Nearest(buf, pitch, width, height, srcX, srcY, origSrcY);
#if ASPECT_MODE != kSuperFastAndUglyAspectMode
}
#endif
diff --git a/graphics/scaler/aspect.h b/graphics/scaler/aspect.h
index 93201c3d40..ee1dfc1460 100644
--- a/graphics/scaler/aspect.h
+++ b/graphics/scaler/aspect.h
@@ -58,4 +58,6 @@ int stretch200To240(uint8 *buf,
int origSrcY,
bool interpolate);
+int stretch200To240Nearest(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY);
+
#endif