Fix minor compile warnings, including using float instead of double in a few places.

This commit is contained in:
Stephen Anthony 2019-05-18 20:48:13 -02:30
parent f31df8e7d0
commit 58e8a5f036
4 changed files with 23 additions and 19 deletions

View File

@ -221,7 +221,7 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode)
posX = posY = SDL_WINDOWPOS_CENTERED_DISPLAY(displayIndex); posX = posY = SDL_WINDOWPOS_CENTERED_DISPLAY(displayIndex);
else else
{ {
posX = myWindowedPos.x, posX = myWindowedPos.x;
posY = myWindowedPos.y; posY = myWindowedPos.y;
// make sure the window is at least partially visibile // make sure the window is at least partially visibile

View File

@ -835,10 +835,10 @@ void FrameBuffer::toggleGrabMouse()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
double FrameBuffer::maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight, float FrameBuffer::maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight,
uInt32 screenWidth, uInt32 screenHeight) const uInt32 screenWidth, uInt32 screenHeight) const
{ {
double multiplier = 1; float multiplier = 1;
for(;;) for(;;)
{ {
// Figure out the zoomed size of the window // Figure out the zoomed size of the window
@ -868,7 +868,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
EventHandlerState state = myOSystem.eventHandler().state(); EventHandlerState state = myOSystem.eventHandler().state();
bool tiaMode = (state != EventHandlerState::DEBUGGER && bool tiaMode = (state != EventHandlerState::DEBUGGER &&
state != EventHandlerState::LAUNCHER); 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, // TIA mode allows zooming at integral factors in windowed modes,
// and also non-integral factors in fullscreen mode // and also non-integral factors in fullscreen mode
@ -887,7 +887,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
#endif #endif
// Determine all zoom levels // Determine all zoom levels
for(double zoom = minZoom; zoom <= myTIAMaxZoom; zoom += ZOOM_STEPS) for(float zoom = minZoom; zoom <= myTIAMaxZoom; zoom += ZOOM_STEPS)
{ {
ostringstream desc; ostringstream desc;
desc << "Zoom " << zoom << "x"; desc << "Zoom " << zoom << "x";
@ -901,7 +901,8 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i) for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i)
{ {
myTIAMaxZoom = maxZoomForScreen(baseWidth, baseHeight, 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 // Add both normal aspect and filled modes
// It's easier to define them both now, and simply switch between // 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, FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
Stretch smode, double overscan, const string& desc, Stretch smode, float overscan, const string& desc,
double zoomLevel, Int32 fsindex) float zoomLevel, Int32 fsindex)
: stretch(smode), : stretch(smode),
description(desc), description(desc),
zoom(zoomLevel), 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) for(uInt32 i = 0; i < myModeList.size(); ++i)
{ {

View File

@ -63,12 +63,12 @@ class FrameBuffer
Common::Size screen; Common::Size screen;
Stretch stretch; Stretch stretch;
string description; string description;
double zoom; float zoom;
Int32 fsIndex; Int32 fsIndex;
VideoMode(); VideoMode();
VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Stretch smode, double overscan = 1.0, VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Stretch smode, float overscan = 1.0,
const string& desc = "", double zoomLevel = 1, Int32 fsindex = -1); const string& desc = "", float zoomLevel = 1, Int32 fsindex = -1);
friend ostream& operator<<(ostream& os, const VideoMode& vm) friend ostream& operator<<(ostream& os, const VideoMode& vm)
{ {
@ -81,7 +81,7 @@ class FrameBuffer
}; };
// Zoom level step interval // Zoom level step interval
static constexpr double ZOOM_STEPS = 0.25; static constexpr float ZOOM_STEPS = 0.25;
public: public:
/** /**
@ -198,9 +198,11 @@ class FrameBuffer
const VariantList& supportedRenderers() const { return myRenderers; } 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. 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 Calculate the maximum level by which the base window can be zoomed and
still fit in the given screen dimensions. still fit in the given screen dimensions.
*/ */
double maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight, float maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight,
uInt32 screenWidth, uInt32 screenHeight) const; uInt32 screenWidth, uInt32 screenHeight) const;
/** /**
@ -493,7 +495,7 @@ class FrameBuffer
const FrameBuffer::VideoMode& current() const; const FrameBuffer::VideoMode& current() const;
void next(); void next();
void setByZoom(double zoom); void setByZoom(float zoom);
void setByStretch(FrameBuffer::VideoMode::Stretch stretch); void setByStretch(FrameBuffer::VideoMode::Stretch stretch);
friend ostream& operator<<(ostream& os, const VideoModeList& l) friend ostream& operator<<(ostream& os, const VideoModeList& l)
@ -595,7 +597,7 @@ class FrameBuffer
vector<VideoModeList> myFullscreenModeLists; vector<VideoModeList> myFullscreenModeLists;
// Maximum TIA zoom level that can be used for this framebuffer // 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 // Holds a reference to all the surfaces that have been created
vector<shared_ptr<FBSurface>> mySurfaceList; vector<shared_ptr<FBSurface>> mySurfaceList;

View File

@ -337,6 +337,7 @@ void VideoDialog::loadConfig()
// TIA zoom levels // TIA zoom levels
// These are dynamically loaded, since they depend on the size of // These are dynamically loaded, since they depend on the size of
// the desktop and which renderer we're using // the desktop and which renderer we're using
myTIAZoom->setMinValue(instance().frameBuffer().supportedTIAMinZoom() * 100);
myTIAZoom->setMaxValue(instance().frameBuffer().supportedTIAMaxZoom() * 100); myTIAZoom->setMaxValue(instance().frameBuffer().supportedTIAMaxZoom() * 100);
myTIAZoom->setTickmarkIntervals((instance().frameBuffer().supportedTIAMaxZoom() - 2) * 2); myTIAZoom->setTickmarkIntervals((instance().frameBuffer().supportedTIAMaxZoom() - 2) * 2);
myTIAZoom->setValue(instance().settings().getFloat("tia.zoom") * 100); myTIAZoom->setValue(instance().settings().getFloat("tia.zoom") * 100);