From 33c4e81bb0040748c682c01da9a94dcd9570bd99 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 18 May 2019 20:48:13 -0230 Subject: [PATCH] Fix minor compile warnings, including using float instead of double in a few places. --- src/common/FrameBufferSDL2.cxx | 2 +- src/emucore/FrameBuffer.cxx | 19 ++++++++++--------- src/emucore/FrameBuffer.hxx | 20 +++++++++++--------- src/gui/VideoDialog.cxx | 1 + 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/common/FrameBufferSDL2.cxx b/src/common/FrameBufferSDL2.cxx index aacb09810..d0b488be1 100644 --- a/src/common/FrameBufferSDL2.cxx +++ b/src/common/FrameBufferSDL2.cxx @@ -221,7 +221,7 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode) posX = posY = SDL_WINDOWPOS_CENTERED_DISPLAY(displayIndex); else { - posX = myWindowedPos.x, + posX = myWindowedPos.x; posY = myWindowedPos.y; // make sure the window is at least partially visibile diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 0256baeac..f5601dd07 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -835,10 +835,10 @@ void FrameBuffer::toggleGrabMouse() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -double FrameBuffer::maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight, - uInt32 screenWidth, uInt32 screenHeight) const +float FrameBuffer::maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight, + uInt32 screenWidth, uInt32 screenHeight) const { - double multiplier = 1; + float multiplier = 1; for(;;) { // Figure out the zoomed size of the window @@ -868,7 +868,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) EventHandlerState state = myOSystem.eventHandler().state(); bool tiaMode = (state != EventHandlerState::DEBUGGER && state != EventHandlerState::LAUNCHER); - double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0; + float overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0; // TIA mode allows zooming at integral factors in windowed modes, // and also non-integral factors in fullscreen mode @@ -887,7 +887,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) #endif // Determine all zoom levels - for(double zoom = minZoom; zoom <= myTIAMaxZoom; zoom += ZOOM_STEPS) + for(float zoom = minZoom; zoom <= myTIAMaxZoom; zoom += ZOOM_STEPS) { ostringstream desc; desc << "Zoom " << zoom << "x"; @@ -901,7 +901,8 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i) { myTIAMaxZoom = maxZoomForScreen(baseWidth, baseHeight, - myFullscreenDisplays[i].w * overscan, myFullscreenDisplays[i].h * overscan); + myFullscreenDisplays[i].w * overscan, + myFullscreenDisplays[i].h * overscan); // Add both normal aspect and filled modes // It's easier to define them both now, and simply switch between @@ -984,8 +985,8 @@ FrameBuffer::VideoMode::VideoMode() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, - Stretch smode, double overscan, const string& desc, - double zoomLevel, Int32 fsindex) + Stretch smode, float overscan, const string& desc, + float zoomLevel, Int32 fsindex) : stretch(smode), description(desc), zoom(zoomLevel), @@ -1118,7 +1119,7 @@ void FrameBuffer::VideoModeList::next() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FrameBuffer::VideoModeList::setByZoom(double zoom) +void FrameBuffer::VideoModeList::setByZoom(float zoom) { for(uInt32 i = 0; i < myModeList.size(); ++i) { diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index 48c8ddd9d..231b540d3 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -63,12 +63,12 @@ class FrameBuffer Common::Size screen; Stretch stretch; string description; - double zoom; + float zoom; Int32 fsIndex; VideoMode(); - VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Stretch smode, double overscan = 1.0, - const string& desc = "", double zoomLevel = 1, Int32 fsindex = -1); + VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Stretch smode, float overscan = 1.0, + const string& desc = "", float zoomLevel = 1, Int32 fsindex = -1); friend ostream& operator<<(ostream& os, const VideoMode& vm) { @@ -81,7 +81,7 @@ class FrameBuffer }; // Zoom level step interval - static constexpr double ZOOM_STEPS = 0.25; + static constexpr float ZOOM_STEPS = 0.25; public: /** @@ -198,9 +198,11 @@ class FrameBuffer const VariantList& supportedRenderers() const { return myRenderers; } /** - Get the maximum supported TIA zoom level (windowed mode) for the framebuffer. + Get the minimum/maximum supported TIA zoom level (windowed mode) + for the framebuffer. */ - const double supportedTIAMaxZoom() const { return myTIAMaxZoom; } + float supportedTIAMinZoom() const { return 2 * hidpiScaleFactor(); } + float supportedTIAMaxZoom() const { return myTIAMaxZoom; } /** Get the TIA surface associated with the framebuffer. @@ -454,7 +456,7 @@ class FrameBuffer Calculate the maximum level by which the base window can be zoomed and still fit in the given screen dimensions. */ - double maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight, + float maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight, uInt32 screenWidth, uInt32 screenHeight) const; /** @@ -493,7 +495,7 @@ class FrameBuffer const FrameBuffer::VideoMode& current() const; void next(); - void setByZoom(double zoom); + void setByZoom(float zoom); void setByStretch(FrameBuffer::VideoMode::Stretch stretch); friend ostream& operator<<(ostream& os, const VideoModeList& l) @@ -595,7 +597,7 @@ class FrameBuffer vector myFullscreenModeLists; // Maximum TIA zoom level that can be used for this framebuffer - double myTIAMaxZoom; + float myTIAMaxZoom; // Holds a reference to all the surfaces that have been created vector> mySurfaceList; diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 98f0c689d..637f6fc8e 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -337,6 +337,7 @@ void VideoDialog::loadConfig() // TIA zoom levels // These are dynamically loaded, since they depend on the size of // the desktop and which renderer we're using + myTIAZoom->setMinValue(instance().frameBuffer().supportedTIAMinZoom() * 100); myTIAZoom->setMaxValue(instance().frameBuffer().supportedTIAMaxZoom() * 100); myTIAZoom->setTickmarkIntervals((instance().frameBuffer().supportedTIAMaxZoom() - 2) * 2); myTIAZoom->setValue(instance().settings().getFloat("tia.zoom") * 100);