mirror of https://github.com/stella-emu/stella.git
Moved some framebuffer enums to appropriate file.
This commit is contained in:
parent
cf737d59d0
commit
5da4c9eb1c
|
@ -22,16 +22,16 @@
|
|||
#include "sdl_blitter/BlitterFactory.hxx"
|
||||
|
||||
namespace {
|
||||
BlitterFactory::ScalingAlgorithm scalingAlgorithm(FrameBuffer::ScalingInterpolation interpolation)
|
||||
BlitterFactory::ScalingAlgorithm scalingAlgorithm(ScalingInterpolation interpolation)
|
||||
{
|
||||
switch (interpolation) {
|
||||
case FrameBuffer::ScalingInterpolation::none:
|
||||
case ScalingInterpolation::none:
|
||||
return BlitterFactory::ScalingAlgorithm::nearestNeighbour;
|
||||
|
||||
case FrameBuffer::ScalingInterpolation::blur:
|
||||
case ScalingInterpolation::blur:
|
||||
return BlitterFactory::ScalingAlgorithm::bilinear;
|
||||
|
||||
case FrameBuffer::ScalingInterpolation::sharp:
|
||||
case ScalingInterpolation::sharp:
|
||||
return BlitterFactory::ScalingAlgorithm::quasiInteger;
|
||||
|
||||
default:
|
||||
|
@ -43,7 +43,7 @@ namespace {
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FBSurfaceSDL2::FBSurfaceSDL2(FrameBufferSDL2& buffer,
|
||||
uInt32 width, uInt32 height,
|
||||
FrameBuffer::ScalingInterpolation interpolation,
|
||||
ScalingInterpolation interpolation,
|
||||
const uInt32* staticData)
|
||||
: myFB(buffer),
|
||||
myInterpolationMode(interpolation)
|
||||
|
@ -256,7 +256,7 @@ void FBSurfaceSDL2::applyAttributes()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceSDL2::setScalingInterpolation(FrameBuffer::ScalingInterpolation interpolation)
|
||||
void FBSurfaceSDL2::setScalingInterpolation(ScalingInterpolation interpolation)
|
||||
{
|
||||
if (interpolation == myInterpolationMode) return;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class FBSurfaceSDL2 : public FBSurface
|
|||
{
|
||||
public:
|
||||
FBSurfaceSDL2(FrameBufferSDL2& buffer, uInt32 width, uInt32 height,
|
||||
FrameBuffer::ScalingInterpolation interpolation,
|
||||
ScalingInterpolation interpolation,
|
||||
const uInt32* staticData);
|
||||
~FBSurfaceSDL2() override;
|
||||
|
||||
|
@ -60,7 +60,7 @@ class FBSurfaceSDL2 : public FBSurface
|
|||
void reload() override;
|
||||
void resize(uInt32 width, uInt32 height) override;
|
||||
|
||||
void setScalingInterpolation(FrameBuffer::ScalingInterpolation) override;
|
||||
void setScalingInterpolation(ScalingInterpolation) override;
|
||||
|
||||
protected:
|
||||
void applyAttributes() override;
|
||||
|
@ -98,8 +98,8 @@ class FBSurfaceSDL2 : public FBSurface
|
|||
FrameBufferSDL2& myFB;
|
||||
|
||||
unique_ptr<Blitter> myBlitter;
|
||||
FrameBuffer::ScalingInterpolation myInterpolationMode
|
||||
{FrameBuffer::ScalingInterpolation::none};
|
||||
ScalingInterpolation myInterpolationMode
|
||||
{ScalingInterpolation::none};
|
||||
|
||||
SDL_Surface* mySurface{nullptr};
|
||||
SDL_Rect mySrcR{0, 0, 0, 0}, myDstR{0, 0, 0, 0};
|
||||
|
|
|
@ -568,7 +568,7 @@ void FrameBufferSDL2::setWindowIcon()
|
|||
unique_ptr<FBSurface> FrameBufferSDL2::createSurface(
|
||||
uInt32 w,
|
||||
uInt32 h,
|
||||
FrameBuffer::ScalingInterpolation interpolation,
|
||||
ScalingInterpolation interpolation,
|
||||
const uInt32* data
|
||||
) const
|
||||
{
|
||||
|
|
|
@ -213,7 +213,7 @@ class FrameBufferSDL2 : public FrameBuffer
|
|||
createSurface(
|
||||
uInt32 w,
|
||||
uInt32 h,
|
||||
FrameBuffer::ScalingInterpolation interpolation,
|
||||
ScalingInterpolation interpolation,
|
||||
const uInt32* data
|
||||
) const override;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ FBInitStatus Debugger::initializeVideo()
|
|||
{
|
||||
string title = string("Stella ") + STELLA_VERSION + ": Debugger mode";
|
||||
return myOSystem.frameBuffer().createDisplay(
|
||||
title, FrameBuffer::BufferType::Debugger, mySize
|
||||
title, BufferType::Debugger, mySize
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -630,7 +630,7 @@ FBInitStatus Console::initializeVideo(bool full)
|
|||
const string& title = string("Stella ") + STELLA_VERSION +
|
||||
": \"" + myProperties.get(PropType::Cart_Name) + "\"";
|
||||
fbstatus = myOSystem.frameBuffer().createDisplay(title,
|
||||
FrameBuffer::BufferType::Emulator, size, false);
|
||||
BufferType::Emulator, size, false);
|
||||
if(fbstatus != FBInitStatus::Success)
|
||||
return fbstatus;
|
||||
|
||||
|
|
|
@ -246,6 +246,25 @@ class FBSurface
|
|||
ColorId color, TextAlign align = TextAlign::Left,
|
||||
int deltax = 0, bool useEllipsis = true, ColorId shadowColor = kNone);
|
||||
|
||||
/**
|
||||
The rendering attributes that can be modified for this texture.
|
||||
These probably can only be implemented in child FBSurfaces where
|
||||
the specific functionality actually exists.
|
||||
*/
|
||||
struct Attributes {
|
||||
bool blending{false}; // Blending is enabled
|
||||
uInt32 blendalpha{100}; // Alpha to use in blending mode (0-100%)
|
||||
|
||||
bool operator==(const Attributes& other) const {
|
||||
return blendalpha == other.blendalpha && blending == other.blending;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
Get the currently applied attributes.
|
||||
*/
|
||||
Attributes& attributes() { return myAttributes; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Note: The following methods are FBSurface-specific, and must be
|
||||
// implemented in child classes.
|
||||
|
@ -324,35 +343,17 @@ class FBSurface
|
|||
*/
|
||||
virtual void resize(uInt32 width, uInt32 height) = 0;
|
||||
|
||||
/**
|
||||
The rendering attributes that can be modified for this texture.
|
||||
These probably can only be implemented in child FBSurfaces where
|
||||
the specific functionality actually exists.
|
||||
*/
|
||||
struct Attributes {
|
||||
bool blending{false}; // Blending is enabled
|
||||
uInt32 blendalpha{100}; // Alpha to use in blending mode (0-100%)
|
||||
|
||||
bool operator==(const Attributes& other) const {
|
||||
return blendalpha == other.blendalpha && blending == other.blending;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
Get the currently applied attributes.
|
||||
*/
|
||||
Attributes& attributes() { return myAttributes; }
|
||||
|
||||
/**
|
||||
Configure scaling interpolation.
|
||||
*/
|
||||
virtual void setScalingInterpolation(FrameBuffer::ScalingInterpolation) = 0;
|
||||
virtual void setScalingInterpolation(ScalingInterpolation) = 0;
|
||||
|
||||
/**
|
||||
The child class chooses which (if any) of the actual attributes
|
||||
can be applied.
|
||||
*/
|
||||
virtual void applyAttributes() = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void setPalette(const FullPaletteArray& palette) { myPalette = palette; }
|
||||
|
||||
|
@ -367,7 +368,8 @@ class FBSurface
|
|||
*/
|
||||
bool checkBounds(const uInt32 x, const uInt32 y) const;
|
||||
|
||||
void wrapString(const string& inStr, int pos, string& leftStr, string& rightStr) const;
|
||||
void wrapString(const string& inStr, int pos,
|
||||
string& leftStr, string& rightStr) const;
|
||||
|
||||
/**
|
||||
Check if the given character is a whitespace.
|
||||
|
|
|
@ -51,19 +51,6 @@ class TIASurface;
|
|||
class FrameBuffer
|
||||
{
|
||||
public:
|
||||
enum class BufferType {
|
||||
None,
|
||||
Launcher,
|
||||
Emulator,
|
||||
Debugger
|
||||
};
|
||||
|
||||
enum class ScalingInterpolation {
|
||||
none,
|
||||
sharp,
|
||||
blur
|
||||
};
|
||||
|
||||
// Zoom level step interval
|
||||
static constexpr float ZOOM_STEPS = 0.25;
|
||||
|
||||
|
@ -262,16 +249,16 @@ class FrameBuffer
|
|||
*/
|
||||
void enableGrabMouse(bool enable);
|
||||
|
||||
/**
|
||||
Sets the use of grabmouse.
|
||||
*/
|
||||
bool grabMouseEnabled() const { return myGrabMouse; }
|
||||
|
||||
/**
|
||||
Toggles the use of grabmouse (only has effect in emulation mode).
|
||||
*/
|
||||
void toggleGrabMouse();
|
||||
|
||||
/**
|
||||
Query whether grabmouse is enabled.
|
||||
*/
|
||||
bool grabMouseEnabled() const { return myGrabMouse; }
|
||||
|
||||
/**
|
||||
Informs the Framebuffer of a change in EventHandler state.
|
||||
*/
|
||||
|
@ -291,7 +278,8 @@ class FrameBuffer
|
|||
uInt32 hidpiScaleFactor() const { return myHiDPIEnabled ? 2 : 1; }
|
||||
|
||||
/**
|
||||
These methods are used to load/save position and display of the current window.
|
||||
These methods are used to load/save position and display of the
|
||||
current window.
|
||||
*/
|
||||
string getPositionKey();
|
||||
string getDisplayKey();
|
||||
|
|
|
@ -35,6 +35,19 @@ enum class FBInitStatus {
|
|||
FailNotSupported
|
||||
};
|
||||
|
||||
enum class BufferType {
|
||||
None,
|
||||
Launcher,
|
||||
Emulator,
|
||||
Debugger
|
||||
};
|
||||
|
||||
enum class ScalingInterpolation {
|
||||
none,
|
||||
sharp,
|
||||
blur
|
||||
};
|
||||
|
||||
// Positions for onscreen/overlaid messages
|
||||
enum class MessagePosition {
|
||||
TopLeft,
|
||||
|
|
|
@ -27,19 +27,19 @@
|
|||
#include "TIASurface.hxx"
|
||||
|
||||
namespace {
|
||||
FrameBuffer::ScalingInterpolation interpolationModeFromSettings(const Settings& settings)
|
||||
ScalingInterpolation interpolationModeFromSettings(const Settings& settings)
|
||||
{
|
||||
#ifdef RETRON77
|
||||
// Witv TV / and or scanline interpolation, the image has a height of ~480px. THe R77 runs at 720p, so there
|
||||
// is no benefit from QIS in y-direction. In addition, QIS on the R77 has performance issues if TV effects are
|
||||
// enabled.
|
||||
return settings.getBool("tia.inter") || settings.getInt("tv.filter") != 0
|
||||
? FrameBuffer::ScalingInterpolation::blur
|
||||
: FrameBuffer::ScalingInterpolation::sharp;
|
||||
? ScalingInterpolation::blur
|
||||
: ScalingInterpolation::sharp;
|
||||
#else
|
||||
return settings.getBool("tia.inter") ?
|
||||
FrameBuffer::ScalingInterpolation::blur :
|
||||
FrameBuffer::ScalingInterpolation::sharp;
|
||||
ScalingInterpolation::blur :
|
||||
ScalingInterpolation::sharp;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ TIASurface::TIASurface(OSystem& system)
|
|||
AtariNTSC::outWidth(TIAConstants::frameBufferWidth),
|
||||
TIAConstants::frameBufferHeight,
|
||||
!correctAspect()
|
||||
? FrameBuffer::ScalingInterpolation::none
|
||||
? ScalingInterpolation::none
|
||||
: interpolationModeFromSettings(myOSystem.settings())
|
||||
);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ FBInitStatus Launcher::initializeVideo()
|
|||
{
|
||||
string title = string("Stella ") + STELLA_VERSION;
|
||||
return myOSystem.frameBuffer().createDisplay(
|
||||
title, FrameBuffer::BufferType::Launcher, mySize
|
||||
title, BufferType::Launcher, mySize
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
|
|||
if(mySurface == nullptr)
|
||||
{
|
||||
mySurface = instance().frameBuffer().allocateSurface(
|
||||
myAvail.w, myAvail.h, FrameBuffer::ScalingInterpolation::blur);
|
||||
myAvail.w, myAvail.h, ScalingInterpolation::blur);
|
||||
mySurface->applyAttributes();
|
||||
|
||||
dialog().addSurface(mySurface);
|
||||
|
|
|
@ -55,7 +55,7 @@ class FBSurfaceLIBRETRO : public FBSurface
|
|||
void free() override { }
|
||||
void reload() override { }
|
||||
void resize(uInt32 width, uInt32 height) override { }
|
||||
void setScalingInterpolation(FrameBuffer::ScalingInterpolation) override { }
|
||||
void setScalingInterpolation(ScalingInterpolation) override { }
|
||||
|
||||
protected:
|
||||
void applyAttributes() override { }
|
||||
|
|
|
@ -44,7 +44,7 @@ void FrameBufferLIBRETRO::queryHardware(vector<Common::Size>& fullscreenRes,
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
unique_ptr<FBSurface>
|
||||
FrameBufferLIBRETRO::createSurface(uInt32 w, uInt32 h, FrameBuffer::ScalingInterpolation, const uInt32* data) const
|
||||
FrameBufferLIBRETRO::createSurface(uInt32 w, uInt32 h, ScalingInterpolation, const uInt32* data) const
|
||||
{
|
||||
unique_ptr<FBSurface> ptr = make_unique<FBSurfaceLIBRETRO>
|
||||
(const_cast<FrameBufferLIBRETRO&>(*this), w, h, data);
|
||||
|
|
|
@ -158,7 +158,7 @@ class FrameBufferLIBRETRO : public FrameBuffer
|
|||
@param data If non-null, use the given data values as a static surface
|
||||
*/
|
||||
unique_ptr<FBSurface>
|
||||
createSurface(uInt32 w, uInt32 h, FrameBuffer::ScalingInterpolation, const uInt32* data) const override;
|
||||
createSurface(uInt32 w, uInt32 h, ScalingInterpolation, const uInt32* data) const override;
|
||||
|
||||
/**
|
||||
Grabs or ungrabs the mouse based on the given boolean value.
|
||||
|
|
Loading…
Reference in New Issue