aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'backends/graphics')
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 5d5f8e9f51..427053f647 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -170,6 +170,7 @@ void DINGUXSdlGraphicsManager::drawMouse() {
// We draw the pre-scaled cursor image, so now we need to adjust for
// scaling, shake position and aspect ratio correction manually.
+ dst.x += _currentShakeXOffset;
dst.y += _currentShakeYOffset;
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
@@ -222,6 +223,19 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() {
#endif
// If the shake position changed, fill the dirty area with blackness
+ if (_currentShakeXOffset != _gameScreenShakeXOffset ||
+ (_cursorNeedsRedraw && _mouseBackup.x <= _currentShakeXOffset)) {
+ SDL_Rect blackrect = {0, 0, (Uint16)(_gameScreenShakeXOffset * _videoMode.scaleFactor), (Uint16)(_videoMode.screenHeight * _videoMode.scaleFactor)};
+
+ if (_videoMode.aspectRatioCorrection && !_overlayVisible)
+ blackrect.h = real2Aspect(blackrect.h - 1) + 1;
+
+ SDL_FillRect(_hwScreen, &blackrect, 0);
+
+ _currentShakeXOffset = _gameScreenShakeXOffset;
+
+ _forceRedraw = true;
+ }
if (_currentShakeYOffset != _gameScreenShakeYOffset ||
(_cursorNeedsRedraw && _mouseBackup.y <= _currentShakeYOffset)) {
SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_gameScreenShakeYOffset * _videoMode.scaleFactor)};
@@ -307,13 +321,17 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() {
for (r = _dirtyRectList; r != lastRect; ++r) {
int dst_y = r->y + _currentShakeYOffset;
int dst_h = 0;
- int dst_w = r->w;
+ int dst_w = 0;
int orig_dst_y = 0;
- int dst_x = r->x;
+ int dst_x = r->x + _currentShakeXOffset;
int src_y;
int src_x;
- if (dst_y < height) {
+ if (dst_x < width && dst_y < height) {
+ dst_w = r->w;
+ if (dst_w > width - dst_x)
+ dst_w = width - dst_x;
+
dst_h = r->h;
if (dst_h > height - dst_y)
dst_h = height - dst_y;
@@ -346,15 +364,15 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() {
} else {
scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
- (byte *)_hwScreen->pixels + r->x * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
+ (byte *)_hwScreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
}
}
if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf) {
- r->w = r->w / 2;
+ r->w = dst_w / 2;
r->h = dst_h / 2;
} else {
- r->w = r->w;
+ r->w = dst_w;
r->h = dst_h;
}
@@ -373,7 +391,9 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() {
// Readjust the dirty rect list in case we are doing a full update.
// This is necessary if shaking is active.
if (_forceRedraw) {
+ _dirtyRectList[0].x = 0;
_dirtyRectList[0].y = 0;
+ _dirtyRectList[0].w = (_videoMode.mode == GFX_HALF) ? _videoMode.hardwareWidth / 2 : _videoMode.hardwareWidth;
_dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? _videoMode.hardwareHeight / 2 : _videoMode.hardwareHeight;
}