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 889fb0e651
commit 33c4e81bb0
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);
else
{
posX = myWindowedPos.x,
posX = myWindowedPos.x;
posY = myWindowedPos.y;
// 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,
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)
{

View File

@ -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<VideoModeList> 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<shared_ptr<FBSurface>> mySurfaceList;

View File

@ -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);