mirror of https://github.com/stella-emu/stella.git
add non-integral TIA zoom steps (partially addresses #263)
This commit is contained in:
parent
49585250fd
commit
95d8bb870d
|
@ -138,16 +138,9 @@ bool FrameBuffer::initialize()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Determine possible TIA windowed zoom levels
|
// Determine possible TIA windowed zoom levels
|
||||||
uInt32 minZoom = 2 * hidpiScaleFactor();
|
myTIAMaxZoom = maxZoomForScreen(
|
||||||
uInt32 maxZoom = maxWindowSizeForScreen(
|
|
||||||
TIAConstants::viewableWidth, TIAConstants::viewableHeight,
|
TIAConstants::viewableWidth, TIAConstants::viewableHeight,
|
||||||
myAbsDesktopSize.w, myAbsDesktopSize.h);
|
myAbsDesktopSize.w, myAbsDesktopSize.h);
|
||||||
for(uInt32 zoom = minZoom; zoom <= maxZoom; ++zoom)
|
|
||||||
{
|
|
||||||
ostringstream desc;
|
|
||||||
desc << "Zoom " << zoom << "x";
|
|
||||||
VarList::push_back(myTIAZoomLevels, desc.str(), zoom);
|
|
||||||
}
|
|
||||||
|
|
||||||
setUIPalette();
|
setUIPalette();
|
||||||
|
|
||||||
|
@ -842,10 +835,10 @@ void FrameBuffer::toggleGrabMouse()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
|
double FrameBuffer::maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight,
|
||||||
uInt32 screenWidth, uInt32 screenHeight) const
|
uInt32 screenWidth, uInt32 screenHeight) const
|
||||||
{
|
{
|
||||||
uInt32 multiplier = 1;
|
double multiplier = 1;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
// Figure out the zoomed size of the window
|
// Figure out the zoomed size of the window
|
||||||
|
@ -855,9 +848,9 @@ uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
|
||||||
if((width > screenWidth) || (height > screenHeight))
|
if((width > screenWidth) || (height > screenHeight))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++multiplier;
|
multiplier += ZOOM_STEPS;
|
||||||
}
|
}
|
||||||
return multiplier > 1 ? multiplier - 1 : 1;
|
return multiplier > 1 ? multiplier - ZOOM_STEPS : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -883,7 +876,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
||||||
{
|
{
|
||||||
// TIA windowed modes
|
// TIA windowed modes
|
||||||
uInt32 minZoom = 2 * hidpiScaleFactor();
|
uInt32 minZoom = 2 * hidpiScaleFactor();
|
||||||
uInt32 maxZoom = maxWindowSizeForScreen(baseWidth, baseHeight,
|
myTIAMaxZoom = maxZoomForScreen(baseWidth, baseHeight,
|
||||||
myAbsDesktopSize.w, myAbsDesktopSize.h);
|
myAbsDesktopSize.w, myAbsDesktopSize.h);
|
||||||
|
|
||||||
#if 0 // FIXME - does this apply any longer??
|
#if 0 // FIXME - does this apply any longer??
|
||||||
|
@ -894,7 +887,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Determine all zoom levels
|
// Determine all zoom levels
|
||||||
for(uInt32 zoom = minZoom; zoom <= maxZoom; ++zoom)
|
for(double zoom = minZoom; zoom <= myTIAMaxZoom; zoom += ZOOM_STEPS)
|
||||||
{
|
{
|
||||||
ostringstream desc;
|
ostringstream desc;
|
||||||
desc << "Zoom " << zoom << "x";
|
desc << "Zoom " << zoom << "x";
|
||||||
|
@ -907,21 +900,21 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
||||||
// TIA fullscreen mode
|
// TIA fullscreen mode
|
||||||
for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i)
|
for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i)
|
||||||
{
|
{
|
||||||
maxZoom = maxWindowSizeForScreen(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
|
||||||
// them when necessary
|
// them when necessary
|
||||||
VideoMode mode1(baseWidth*maxZoom, baseHeight*maxZoom,
|
VideoMode mode1(baseWidth * myTIAMaxZoom, baseHeight * myTIAMaxZoom,
|
||||||
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
||||||
VideoMode::Stretch::Preserve, overscan,
|
VideoMode::Stretch::Preserve, overscan,
|
||||||
"Preserve aspect, no stretch", maxZoom, i);
|
"Preserve aspect, no stretch", myTIAMaxZoom, i);
|
||||||
myFullscreenModeLists[i].add(mode1);
|
myFullscreenModeLists[i].add(mode1);
|
||||||
VideoMode mode2(baseWidth*maxZoom, baseHeight*maxZoom,
|
VideoMode mode2(baseWidth * myTIAMaxZoom, baseHeight * myTIAMaxZoom,
|
||||||
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
||||||
VideoMode::Stretch::Fill, overscan,
|
VideoMode::Stretch::Fill, overscan,
|
||||||
"Ignore aspect, full stretch", maxZoom, i);
|
"Ignore aspect, full stretch", myTIAMaxZoom, i);
|
||||||
myFullscreenModeLists[i].add(mode2);
|
myFullscreenModeLists[i].add(mode2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -970,7 +963,7 @@ const FrameBuffer::VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen)
|
||||||
myCurrentModeList->setByStretch(myOSystem.settings().getBool("tia.fs_stretch")
|
myCurrentModeList->setByStretch(myOSystem.settings().getBool("tia.fs_stretch")
|
||||||
? VideoMode::Stretch::Fill : VideoMode::Stretch::Preserve);
|
? VideoMode::Stretch::Fill : VideoMode::Stretch::Preserve);
|
||||||
else
|
else
|
||||||
myCurrentModeList->setByZoom(myOSystem.settings().getInt("tia.zoom"));
|
myCurrentModeList->setByZoom(myOSystem.settings().getFloat("tia.zoom"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return myCurrentModeList->current();
|
return myCurrentModeList->current();
|
||||||
|
@ -992,7 +985,7 @@ 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, double overscan, const string& desc,
|
||||||
uInt32 zoomLevel, Int32 fsindex)
|
double zoomLevel, Int32 fsindex)
|
||||||
: stretch(smode),
|
: stretch(smode),
|
||||||
description(desc),
|
description(desc),
|
||||||
zoom(zoomLevel),
|
zoom(zoomLevel),
|
||||||
|
@ -1125,7 +1118,7 @@ void FrameBuffer::VideoModeList::next()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBuffer::VideoModeList::setByZoom(uInt32 zoom)
|
void FrameBuffer::VideoModeList::setByZoom(double zoom)
|
||||||
{
|
{
|
||||||
for(uInt32 i = 0; i < myModeList.size(); ++i)
|
for(uInt32 i = 0; i < myModeList.size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,12 +63,12 @@ class FrameBuffer
|
||||||
Common::Size screen;
|
Common::Size screen;
|
||||||
Stretch stretch;
|
Stretch stretch;
|
||||||
string description;
|
string description;
|
||||||
uInt32 zoom;
|
double 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, double overscan = 1.0,
|
||||||
const string& desc = "", uInt32 zoomLevel = 1, Int32 fsindex = -1);
|
const string& desc = "", double zoomLevel = 1, Int32 fsindex = -1);
|
||||||
|
|
||||||
friend ostream& operator<<(ostream& os, const VideoMode& vm)
|
friend ostream& operator<<(ostream& os, const VideoMode& vm)
|
||||||
{
|
{
|
||||||
|
@ -80,6 +80,9 @@ class FrameBuffer
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Zoom level step interval
|
||||||
|
static constexpr double ZOOM_STEPS = 0.25;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Creates a new Frame Buffer
|
Creates a new Frame Buffer
|
||||||
|
@ -195,9 +198,9 @@ class FrameBuffer
|
||||||
const VariantList& supportedRenderers() const { return myRenderers; }
|
const VariantList& supportedRenderers() const { return myRenderers; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the supported TIA zoom levels (windowed mode) for the framebuffer.
|
Get the maximum supported TIA zoom level (windowed mode) for the framebuffer.
|
||||||
*/
|
*/
|
||||||
const VariantList& supportedTIAZoomLevels() const { return myTIAZoomLevels; }
|
const double supportedTIAMaxZoom() const { return myTIAMaxZoom; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the TIA surface associated with the framebuffer.
|
Get the TIA surface associated with the framebuffer.
|
||||||
|
@ -451,7 +454,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.
|
||||||
*/
|
*/
|
||||||
uInt32 maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
|
double maxZoomForScreen(uInt32 baseWidth, uInt32 baseHeight,
|
||||||
uInt32 screenWidth, uInt32 screenHeight) const;
|
uInt32 screenWidth, uInt32 screenHeight) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -490,7 +493,7 @@ class FrameBuffer
|
||||||
const FrameBuffer::VideoMode& current() const;
|
const FrameBuffer::VideoMode& current() const;
|
||||||
void next();
|
void next();
|
||||||
|
|
||||||
void setByZoom(uInt32 zoom);
|
void setByZoom(double 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)
|
||||||
|
@ -591,8 +594,8 @@ class FrameBuffer
|
||||||
VideoModeList myWindowedModeList;
|
VideoModeList myWindowedModeList;
|
||||||
vector<VideoModeList> myFullscreenModeLists;
|
vector<VideoModeList> myFullscreenModeLists;
|
||||||
|
|
||||||
// Names of the TIA zoom levels that can be used for this framebuffer
|
// Maximum TIA zoom level that can be used for this framebuffer
|
||||||
VariantList myTIAZoomLevels;
|
double 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;
|
||||||
|
|
|
@ -123,24 +123,18 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
wid.push_back(myTIAPalette);
|
wid.push_back(myTIAPalette);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// TIA filters (will be dynamically filled later)
|
|
||||||
myTIAZoom = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
|
|
||||||
lineHeight, items, "TIA zoom ", lwidth);
|
|
||||||
wid.push_back(myTIAZoom);
|
|
||||||
ypos += lineHeight + VGAP;
|
|
||||||
|
|
||||||
/*SliderWidget* s = new SliderWidget(myTab, font, xpos, ypos - 1, swidth, lineHeight,
|
|
||||||
"TIA zoom", lwidth, 0, fontWidth * 4, "%");
|
|
||||||
s->setMinValue(200); s->setMaxValue(500);
|
|
||||||
s->setTickmarkInterval(3); // just for testing now; TODO: remove or redefine
|
|
||||||
wid.push_back(s);
|
|
||||||
ypos += lineHeight + VGAP;*/
|
|
||||||
|
|
||||||
// TIA interpolation
|
// TIA interpolation
|
||||||
myTIAInterpolate = new CheckboxWidget(myTab, font, xpos, ypos + 1, "TIA interpolation ");
|
myTIAInterpolate = new CheckboxWidget(myTab, font, xpos, ypos + 1, "TIA interpolation ");
|
||||||
wid.push_back(myTIAInterpolate);
|
wid.push_back(myTIAInterpolate);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
|
// TIA zoom levels (will be dynamically filled later)
|
||||||
|
myTIAZoom = new SliderWidget(myTab, font, xpos, ypos - 1, swidth, lineHeight,
|
||||||
|
"TIA zoom", lwidth, 0, fontWidth * 4, "%");
|
||||||
|
myTIAZoom->setMinValue(200); myTIAZoom->setStepValue(FrameBuffer::ZOOM_STEPS * 100);
|
||||||
|
wid.push_back(myTIAZoom);
|
||||||
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// Aspect ratio (NTSC mode)
|
// Aspect ratio (NTSC mode)
|
||||||
myNAspectRatio =
|
myNAspectRatio =
|
||||||
new SliderWidget(myTab, font, xpos, ypos-1, swidth, lineHeight,
|
new SliderWidget(myTab, font, xpos, ypos-1, swidth, lineHeight,
|
||||||
|
@ -340,12 +334,12 @@ void VideoDialog::loadConfig()
|
||||||
// Renderer settings
|
// Renderer settings
|
||||||
myRenderer->setSelected(instance().settings().getString("video"), "default");
|
myRenderer->setSelected(instance().settings().getString("video"), "default");
|
||||||
|
|
||||||
// TIA Filter
|
// 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
|
||||||
const VariantList& items = instance().frameBuffer().supportedTIAZoomLevels();
|
myTIAZoom->setMaxValue(instance().frameBuffer().supportedTIAMaxZoom() * 100);
|
||||||
myTIAZoom->addItems(items);
|
myTIAZoom->setTickmarkIntervals((instance().frameBuffer().supportedTIAMaxZoom() - 2) * 2);
|
||||||
myTIAZoom->setSelected(instance().settings().getString("tia.zoom"), "3");
|
myTIAZoom->setValue(instance().settings().getFloat("tia.zoom") * 100);
|
||||||
|
|
||||||
// TIA Palette
|
// TIA Palette
|
||||||
myTIAPalette->setSelected(
|
myTIAPalette->setSelected(
|
||||||
|
@ -417,9 +411,8 @@ void VideoDialog::saveConfig()
|
||||||
instance().settings().setValue("video",
|
instance().settings().setValue("video",
|
||||||
myRenderer->getSelectedTag().toString());
|
myRenderer->getSelectedTag().toString());
|
||||||
|
|
||||||
// TIA Filter
|
// TIA zoom levels
|
||||||
instance().settings().setValue("tia.zoom",
|
instance().settings().setValue("tia.zoom", myTIAZoom->getValue() / 100.0);
|
||||||
myTIAZoom->getSelectedTag().toString());
|
|
||||||
|
|
||||||
// TIA Palette
|
// TIA Palette
|
||||||
instance().settings().setValue("palette",
|
instance().settings().setValue("palette",
|
||||||
|
@ -502,7 +495,7 @@ void VideoDialog::setDefaults()
|
||||||
case 0: // General
|
case 0: // General
|
||||||
{
|
{
|
||||||
myRenderer->setSelectedIndex(0);
|
myRenderer->setSelectedIndex(0);
|
||||||
myTIAZoom->setSelected("3", "");
|
myTIAZoom->setValue(300);
|
||||||
myTIAPalette->setSelected("standard", "");
|
myTIAPalette->setSelected("standard", "");
|
||||||
myTIAInterpolate->setState(false);
|
myTIAInterpolate->setState(false);
|
||||||
myNAspectRatio->setValue(91);
|
myNAspectRatio->setValue(91);
|
||||||
|
|
|
@ -55,7 +55,7 @@ class VideoDialog : public Dialog
|
||||||
|
|
||||||
// General options
|
// General options
|
||||||
PopUpWidget* myRenderer;
|
PopUpWidget* myRenderer;
|
||||||
PopUpWidget* myTIAZoom; // TODO: SliderWidget
|
SliderWidget* myTIAZoom;
|
||||||
PopUpWidget* myTIAPalette;
|
PopUpWidget* myTIAPalette;
|
||||||
CheckboxWidget* myTIAInterpolate;
|
CheckboxWidget* myTIAInterpolate;
|
||||||
SliderWidget* myNAspectRatio;
|
SliderWidget* myNAspectRatio;
|
||||||
|
|
Loading…
Reference in New Issue