diff options
author | Colin Snover | 2017-10-15 16:32:50 -0500 |
---|---|---|
committer | Colin Snover | 2017-10-15 16:32:58 -0500 |
commit | 1f8eeb5920aeaaa34931f66ea565b9c1e14a1bbd (patch) | |
tree | 45f3993fab8d4fd055ba86c80e4c2ba11aaa2ddc /backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp | |
parent | 4263a78aa0a1dcb1e5764887f15cc4729ea78dc6 (diff) | |
download | scummvm-rg350-1f8eeb5920aeaaa34931f66ea565b9c1e14a1bbd.tar.gz scummvm-rg350-1f8eeb5920aeaaa34931f66ea565b9c1e14a1bbd.tar.bz2 scummvm-rg350-1f8eeb5920aeaaa34931f66ea565b9c1e14a1bbd.zip |
DINGUX: Replace usage of old SurfaceSdlGraphicsManager APIs
Diffstat (limited to 'backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp')
-rw-r--r-- | backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp index 3de6439d1a..9923b65d26 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp @@ -106,11 +106,11 @@ void DINGUXSdlGraphicsManager::setGraphicsModeIntern() { _scalerProc = newScalerProc; - if (!_screen || !_hwscreen) + if (!_screen || !_hwScreen) return; // Blit everything to the screen - _forceFull = true; + _forceRedraw = true; // Even if the old and new scale factors are the same, we may have a // different scaler for the cursor now. @@ -136,7 +136,7 @@ void DINGUXSdlGraphicsManager::initSize(uint w, uint h) { } void DINGUXSdlGraphicsManager::drawMouse() { - if (!_mouseVisible || !_mouseSurface) { + if (!_cursorVisible || !_mouseSurface) { _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0; return; } @@ -146,11 +146,11 @@ void DINGUXSdlGraphicsManager::drawMouse() { int hotX, hotY; if (_videoMode.mode == GFX_HALF && !_overlayVisible) { - dst.x = _mouseCurState.x / 2; - dst.y = _mouseCurState.y / 2; + dst.x = _cursorX / 2; + dst.y = _cursorY / 2; } else { - dst.x = _mouseCurState.x; - dst.y = _mouseCurState.y; + dst.x = _cursorX; + dst.y = _cursorY; } if (!_overlayVisible) { @@ -193,7 +193,7 @@ void DINGUXSdlGraphicsManager::drawMouse() { // Note that SDL_BlitSurface() and addDirtyRect() will both perform any // clipping necessary - if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0) + if (SDL_BlitSurface(_mouseSurface, NULL, _hwScreen, &dst) != 0) error("SDL_BlitSurface failed: %s", SDL_GetError()); // The screen will be updated using real surface coordinates, i.e. @@ -226,8 +226,8 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { int scale1; #if defined(DEBUG) && ! defined(_WIN32_WCE) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?) - assert(_hwscreen != NULL); - assert(_hwscreen->map->sw_data != NULL); + assert(_hwScreen != NULL); + assert(_hwScreen->map->sw_data != NULL); #endif // If the shake position changed, fill the dirty area with blackness @@ -237,11 +237,11 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { if (_videoMode.aspectRatioCorrection && !_overlayVisible) blackrect.h = real2Aspect(blackrect.h - 1) + 1; - SDL_FillRect(_hwscreen, &blackrect, 0); + SDL_FillRect(_hwScreen, &blackrect, 0); _currentShakePos = _newShakePos; - _forceFull = true; + _forceRedraw = true; } // Check whether the palette was changed in the meantime and update the @@ -253,7 +253,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { _paletteDirtyEnd = 0; - _forceFull = true; + _forceRedraw = true; } if (!_overlayVisible) { @@ -274,7 +274,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { // Add the area covered by the mouse cursor to the list of dirty rects if // we have to redraw the mouse. - if (_mouseNeedsRedraw) + if (_cursorNeedsRedraw) undrawMouse(); #ifdef USE_OSD @@ -282,7 +282,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { #endif // Force a full redraw if requested - if (_forceFull) { + if (_forceRedraw) { _numDirtyRects = 1; _dirtyRectList[0].x = 0; _dirtyRectList[0].y = 0; @@ -291,7 +291,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { } // Only draw anything if necessary - if (_numDirtyRects > 0 || _mouseNeedsRedraw) { + if (_numDirtyRects > 0 || _cursorNeedsRedraw) { SDL_Rect *r; SDL_Rect dst; uint32 srcPitch, dstPitch; @@ -307,10 +307,10 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { } SDL_LockSurface(srcSurf); - SDL_LockSurface(_hwscreen); + SDL_LockSurface(_hwScreen); srcPitch = srcSurf->pitch; - dstPitch = _hwscreen->pitch; + dstPitch = _hwScreen->pitch; for (r = _dirtyRectList; r != lastRect; ++r) { register int dst_y = r->y + _currentShakePos; @@ -350,11 +350,11 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { dst_y = dst_y / 2; scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch, - (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h); + (byte *)_hwScreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h); } 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 + r->x * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h); } } @@ -372,17 +372,17 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { #ifdef USE_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); + r->h = stretch200To240((uint8 *) _hwScreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1); #endif } SDL_UnlockSurface(srcSurf); - SDL_UnlockSurface(_hwscreen); + SDL_UnlockSurface(_hwScreen); // Readjust the dirty rect list in case we are doing a full update. // This is necessary if shaking is active. - if (_forceFull) { + if (_forceRedraw) { _dirtyRectList[0].y = 0; - _dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? effectiveScreenHeight() / 2 : effectiveScreenHeight(); + _dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? _videoMode.hardwareHeight / 2 : _videoMode.hardwareHeight; } drawMouse(); @@ -391,26 +391,26 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { drawOSD(); #endif // Finally, blit all our changes to the screen - SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList); + SDL_UpdateRects(_hwScreen, _numDirtyRects, _dirtyRectList); } _numDirtyRects = 0; - _forceFull = false; - _mouseNeedsRedraw = false; + _forceRedraw = false; + _cursorNeedsRedraw = false; } void DINGUXSdlGraphicsManager::showOverlay() { if (_videoMode.mode == GFX_HALF) { - _mouseCurState.x = _mouseCurState.x / 2; - _mouseCurState.y = _mouseCurState.y / 2; + _cursorX = _cursorX / 2; + _cursorY = _cursorY / 2; } SurfaceSdlGraphicsManager::showOverlay(); } void DINGUXSdlGraphicsManager::hideOverlay() { if (_videoMode.mode == GFX_HALF) { - _mouseCurState.x = _mouseCurState.x * 2; - _mouseCurState.y = _mouseCurState.y * 2; + _cursorX = _cursorX * 2; + _cursorY = _cursorY * 2; } SurfaceSdlGraphicsManager::hideOverlay(); } @@ -439,17 +439,20 @@ bool DINGUXSdlGraphicsManager::loadGFXMode() { _videoMode.overlayHeight = _videoMode.screenHeight / 2; _videoMode.fullscreen = true; } else { - _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; - if (_videoMode.aspectRatioCorrection) - _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); + if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) + _videoMode.aspectRatioCorrection = false; _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; - _videoMode.hardwareHeight = effectiveScreenHeight(); - } + _videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor; + if (_videoMode.aspectRatioCorrection) { + _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); + _videoMode.hardwareHeight = real2Aspect(_videoMode.hardwareHeight); + } + } return SurfaceSdlGraphicsManager::loadGFXMode(); } @@ -488,7 +491,7 @@ bool DINGUXSdlGraphicsManager::getFeatureState(OSystem::Feature f) { } void DINGUXSdlGraphicsManager::warpMouse(int x, int y) { - if (_mouseCurState.x != x || _mouseCurState.y != y) { + if (_cursorX != x || _cursorY != y) { if (_videoMode.mode == GFX_HALF && !_overlayVisible) { x = x / 2; y = y / 2; |