diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp | 30 | ||||
-rw-r--r-- | backends/graphics/gph/gph-graphics.cpp | 16 | ||||
-rw-r--r-- | backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp | 27 | ||||
-rw-r--r-- | backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h | 4 |
4 files changed, 37 insertions, 40 deletions
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp index 427053f647..fc9ed4dce9 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp @@ -39,8 +39,8 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { #define DownscaleAllByHalf 0 #endif -DINGUXSdlGraphicsManager::DINGUXSdlGraphicsManager(SdlEventSource *boss, SdlWindow *window) - : SurfaceSdlGraphicsManager(boss, window) { +DINGUXSdlGraphicsManager::DINGUXSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window) + : SurfaceSdlGraphicsManager(sdlEventSource, window) { } const OSystem::GraphicsMode *DINGUXSdlGraphicsManager::getSupportedGraphicsModes() const { @@ -189,7 +189,6 @@ void DINGUXSdlGraphicsManager::drawMouse() { // The screen will be updated using real surface coordinates, i.e. // they will not be scaled or aspect-ratio corrected. - addDirtyRect(dst.x, dst.y, dst.w, dst.h, true); } @@ -204,7 +203,7 @@ void DINGUXSdlGraphicsManager::undrawMouse() { if (_mouseBackup.w != 0 && _mouseBackup.h != 0) { if (_videoMode.mode == GFX_HALF && !_overlayVisible) { - addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); + addDirtyRect(x * 2, y * 2, _mouseBackup.w * 2, _mouseBackup.h * 2); } else { addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); } @@ -305,8 +304,8 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { for (r = _dirtyRectList; r != lastRect; ++r) { dst = *r; - dst.x++; // Shift rect by one since 2xSai needs to access the data around - dst.y++; // any pixel to scale it, and we want to avoid mem access crashes. + dst.x++; // Shift rect by one since 2xSai needs to access the data around + dst.y++; // any pixel to scale it, and we want to avoid mem access crashes. if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0) error("SDL_BlitSurface failed: %s", SDL_GetError()); @@ -345,7 +344,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { assert(scalerProc != NULL); - if ((_videoMode.mode == GFX_HALF) && (scalerProc == DownscaleAllByHalf)) { + if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf) { if (dst_x % 2 == 1) { dst_x--; dst_w++; @@ -361,7 +360,6 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { 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); - } else { scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch, (byte *)_hwScreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h); @@ -379,7 +377,6 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { r->x = dst_x; r->y = dst_y; - #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, _videoMode.filtering); @@ -402,6 +399,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { #ifdef USE_OSD drawOSD(); #endif + // Finally, blit all our changes to the screen SDL_UpdateRects(_hwScreen, _numDirtyRects, _dirtyRectList); } @@ -413,16 +411,16 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { void DINGUXSdlGraphicsManager::showOverlay() { if (_videoMode.mode == GFX_HALF) { - _cursorX = _cursorX / 2; - _cursorY = _cursorY / 2; + _cursorX /= 2; + _cursorY /= 2; } SurfaceSdlGraphicsManager::showOverlay(); } void DINGUXSdlGraphicsManager::hideOverlay() { if (_videoMode.mode == GFX_HALF) { - _cursorX = _cursorX * 2; - _cursorY = _cursorY * 2; + _cursorX *= 2; + _cursorY *= 2; } SurfaceSdlGraphicsManager::hideOverlay(); } @@ -497,7 +495,7 @@ bool DINGUXSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { switch (f) { case OSystem::kFeatureAspectRatioCorrection: - return _videoMode.aspectRatioCorrection; + return _videoMode.aspectRatioCorrection; case OSystem::kFeatureCursorPalette: return !_cursorPaletteDisabled; default: @@ -508,8 +506,8 @@ bool DINGUXSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { void DINGUXSdlGraphicsManager::warpMouse(int x, int y) { if (_cursorX != x || _cursorY != y) { if (_videoMode.mode == GFX_HALF && !_overlayVisible) { - x = x / 2; - y = y / 2; + x /= 2; + y /= 2; } } SurfaceSdlGraphicsManager::warpMouse(x, y); diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index cc8ef38f98..c54c6f26a5 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -272,7 +272,6 @@ void GPHGraphicsManager::internUpdateScreen() { width = _videoMode.overlayWidth; height = _videoMode.overlayHeight; scalerProc = Normal1x; - scale1 = 1; } @@ -346,7 +345,7 @@ void GPHGraphicsManager::internUpdateScreen() { assert(scalerProc != NULL); - if ((_videoMode.mode == GFX_HALF) && (scalerProc == DownscaleAllByHalf)) { + if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf) { if (dst_x % 2 == 1) { dst_x--; dst_w++; @@ -379,7 +378,6 @@ void GPHGraphicsManager::internUpdateScreen() { r->x = dst_x; r->y = dst_y; - #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, _videoMode.filtering); @@ -414,16 +412,16 @@ void GPHGraphicsManager::internUpdateScreen() { void GPHGraphicsManager::showOverlay() { if (_videoMode.mode == GFX_HALF) { - _cursorX = _cursorX / 2; - _cursorY = _cursorY / 2; + _cursorX /= 2; + _cursorY /= 2; } SurfaceSdlGraphicsManager::showOverlay(); } void GPHGraphicsManager::hideOverlay() { if (_videoMode.mode == GFX_HALF) { - _cursorX = _cursorX * 2; - _cursorY = _cursorY * 2; + _cursorX *= 2; + _cursorY *= 2; } SurfaceSdlGraphicsManager::hideOverlay(); } @@ -502,8 +500,8 @@ bool GPHGraphicsManager::getFeatureState(OSystem::Feature f) const { void GPHGraphicsManager::warpMouse(int x, int y) { if (_cursorX != x || _cursorY != y) { if (_videoMode.mode == GFX_HALF && !_overlayVisible) { - x = x / 2; - y = y / 2; + x /= 2; + y /= 2; } } SurfaceSdlGraphicsManager::warpMouse(x, y); diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp index 3fa1465aac..4e64060992 100644 --- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp +++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp @@ -35,10 +35,6 @@ #include "graphics/scaler/downscaler.h" #include "graphics/surface.h" -enum { - GFX_HALF = 12 -}; - static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { {"1x", "Fullscreen", GFX_NORMAL}, {"½x", "Downscale", GFX_HALF}, @@ -46,7 +42,7 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { }; LinuxmotoSdlGraphicsManager::LinuxmotoSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window) - : SurfaceSdlGraphicsManager(sdlEventSource, window) { + : SurfaceSdlGraphicsManager(sdlEventSource, window) { } const OSystem::GraphicsMode *LinuxmotoSdlGraphicsManager::getSupportedGraphicsModes() const { @@ -116,7 +112,7 @@ void LinuxmotoSdlGraphicsManager::initSize(uint w, uint h, const Graphics::Pixel _videoMode.screenWidth = w; _videoMode.screenHeight = h; - if (w > 320 || h > 240) { + if (w > 320 || h > 240) { setGraphicsMode(GFX_HALF); setGraphicsModeIntern(); _window->toggleMouseGrab(); @@ -127,6 +123,7 @@ void LinuxmotoSdlGraphicsManager::initSize(uint w, uint h, const Graphics::Pixel bool LinuxmotoSdlGraphicsManager::loadGFXMode() { debug("Game ScreenMode = %d*%d",_videoMode.screenWidth, _videoMode.screenHeight); + if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) { _videoMode.aspectRatioCorrection = false; setGraphicsMode(GFX_HALF); @@ -135,6 +132,7 @@ bool LinuxmotoSdlGraphicsManager::loadGFXMode() { setGraphicsMode(GFX_NORMAL); debug("GraphicsMode set to NORMAL"); } + if (_videoMode.mode == GFX_HALF && !_overlayVisible) { _videoMode.overlayWidth = 320; _videoMode.overlayHeight = 240; @@ -231,7 +229,7 @@ void LinuxmotoSdlGraphicsManager::undrawMouse() { if (_mouseBackup.w != 0 && _mouseBackup.h != 0) { if (_videoMode.mode == GFX_HALF && !_overlayVisible) { - addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); + addDirtyRect(x * 2, y * 2, _mouseBackup.w * 2, _mouseBackup.h * 2); } else { addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); } @@ -244,7 +242,7 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() { ScalerProc *scalerProc; int scale1; -#if defined(DEBUG) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?) +#if defined(DEBUG) assert(_hwScreen != NULL); assert(_hwScreen->map->sw_data != NULL); #endif @@ -268,8 +266,8 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() { // screen surface accordingly. if (_screen && _paletteDirtyEnd != 0) { SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart, - _paletteDirtyStart, - _paletteDirtyEnd - _paletteDirtyStart); + _paletteDirtyStart, + _paletteDirtyEnd - _paletteDirtyStart); _paletteDirtyEnd = 0; @@ -319,8 +317,8 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() { for (r = _dirtyRectList; r != lastRect; ++r) { dst = *r; - dst.x++; // Shift rect by one since 2xSai needs to access the data around - dst.y++; // any pixel to scale it, and we want to avoid mem access crashes. + dst.x++; // Shift rect by one since 2xSai needs to access the data around + dst.y++; // any pixel to scale it, and we want to avoid mem access crashes. if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0) error("SDL_BlitSurface failed: %s", SDL_GetError()); @@ -356,12 +354,11 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() { assert(scalerProc != NULL); if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf) { - - if (dst_x%2==1) { + if (dst_x % 2 == 1) { dst_x--; dst_w++; } - if (dst_y%2==1) { + if (dst_y % 2 == 1) { dst_y--; dst_h++; } diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h index ec5ebff729..0a538bed39 100644 --- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h +++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h @@ -25,6 +25,10 @@ #include "backends/graphics/surfacesdl/surfacesdl-graphics.h" +enum { + GFX_HALF = 12 +}; + class LinuxmotoSdlGraphicsManager : public SurfaceSdlGraphicsManager { public: LinuxmotoSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window); |