mirror of https://github.com/stella-emu/stella.git
Connect tia.filter.
This commit is contained in:
parent
fd136e0d49
commit
5977c8561a
|
@ -249,3 +249,12 @@ void FBSurfaceSDL2::applyAttributes()
|
||||||
{
|
{
|
||||||
reinitializeBlitter();
|
reinitializeBlitter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void FBSurfaceSDL2::setScalingInterpolation(FrameBuffer::ScalingInterpolation interpolation)
|
||||||
|
{
|
||||||
|
if (interpolation == myInterpolationMode) return;
|
||||||
|
|
||||||
|
myInterpolationMode = interpolation;
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
|
@ -62,6 +62,8 @@ class FBSurfaceSDL2 : public FBSurface
|
||||||
void reload() override;
|
void reload() override;
|
||||||
void resize(uInt32 width, uInt32 height) override;
|
void resize(uInt32 width, uInt32 height) override;
|
||||||
|
|
||||||
|
void setScalingInterpolation(FrameBuffer::ScalingInterpolation) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void applyAttributes() override;
|
void applyAttributes() override;
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ class FBSurfaceSDL2 : public FBSurface
|
||||||
FrameBufferSDL2& myFB;
|
FrameBufferSDL2& myFB;
|
||||||
|
|
||||||
unique_ptr<Blitter> myBlitter;
|
unique_ptr<Blitter> myBlitter;
|
||||||
const FrameBuffer::ScalingInterpolation myInterpolationMode;
|
FrameBuffer::ScalingInterpolation myInterpolationMode;
|
||||||
|
|
||||||
SDL_Surface* mySurface;
|
SDL_Surface* mySurface;
|
||||||
SDL_Rect mySrcR, myDstR;
|
SDL_Rect mySrcR, myDstR;
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "FrameBufferConstants.hxx"
|
#include "FrameBufferConstants.hxx"
|
||||||
|
#include "FrameBuffer.hxx"
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -335,6 +336,11 @@ class FBSurface
|
||||||
*/
|
*/
|
||||||
Attributes& attributes() { return myAttributes; }
|
Attributes& attributes() { return myAttributes; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Configure scaling interpolation.
|
||||||
|
*/
|
||||||
|
virtual void setScalingInterpolation(FrameBuffer::ScalingInterpolation) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The child class chooses which (if any) of the actual attributes
|
The child class chooses which (if any) of the actual attributes
|
||||||
can be applied.
|
can be applied.
|
||||||
|
|
|
@ -293,6 +293,8 @@ FBInitStatus FrameBuffer::createDisplay(const string& title,
|
||||||
Logger::info(post_about);
|
Logger::info(post_about);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (myTIASurface) myTIASurface->updateSurfaceSettings();
|
||||||
|
|
||||||
return FBInitStatus::Success;
|
return FBInitStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,19 @@
|
||||||
#include "PNGLibrary.hxx"
|
#include "PNGLibrary.hxx"
|
||||||
#include "TIASurface.hxx"
|
#include "TIASurface.hxx"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
FrameBuffer::ScalingInterpolation interpolationModeFromSettings(const Settings& settings)
|
||||||
|
{
|
||||||
|
const string setting = settings.getString("tia.filter");
|
||||||
|
|
||||||
|
if (setting == "sharp") return FrameBuffer::ScalingInterpolation::sharp;
|
||||||
|
if (setting == "soft") return FrameBuffer::ScalingInterpolation::blur;
|
||||||
|
if (setting == "none") return FrameBuffer::ScalingInterpolation::none;
|
||||||
|
|
||||||
|
return FrameBuffer::ScalingInterpolation::sharp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
TIASurface::TIASurface(OSystem& system)
|
TIASurface::TIASurface(OSystem& system)
|
||||||
: myOSystem(system),
|
: myOSystem(system),
|
||||||
|
@ -44,7 +57,7 @@ TIASurface::TIASurface(OSystem& system)
|
||||||
myTiaSurface = myFB.allocateSurface(
|
myTiaSurface = myFB.allocateSurface(
|
||||||
AtariNTSC::outWidth(TIAConstants::frameBufferWidth),
|
AtariNTSC::outWidth(TIAConstants::frameBufferWidth),
|
||||||
TIAConstants::frameBufferHeight,
|
TIAConstants::frameBufferHeight,
|
||||||
FrameBuffer::ScalingInterpolation::sharp
|
interpolationModeFromSettings(myOSystem.settings())
|
||||||
);
|
);
|
||||||
|
|
||||||
// Generate scanline data, and a pre-defined scanline surface
|
// Generate scanline data, and a pre-defined scanline surface
|
||||||
|
@ -55,7 +68,7 @@ TIASurface::TIASurface(OSystem& system)
|
||||||
scanData[i] = 0x00000000;
|
scanData[i] = 0x00000000;
|
||||||
scanData[i+1] = 0xff000000;
|
scanData[i+1] = 0xff000000;
|
||||||
}
|
}
|
||||||
mySLineSurface = myFB.allocateSurface(1, scanHeight, FrameBuffer::ScalingInterpolation::sharp, scanData);
|
mySLineSurface = myFB.allocateSurface(1, scanHeight, interpolationModeFromSettings(myOSystem.settings()), scanData);
|
||||||
|
|
||||||
// Base TIA surface for use in taking snapshots in 1x mode
|
// Base TIA surface for use in taking snapshots in 1x mode
|
||||||
myBaseTiaSurface = myFB.allocateSurface(TIAConstants::frameBufferWidth*2,
|
myBaseTiaSurface = myFB.allocateSurface(TIAConstants::frameBufferWidth*2,
|
||||||
|
@ -458,3 +471,10 @@ void TIASurface::renderForSnapshot()
|
||||||
mySLineSurface->render();
|
mySLineSurface->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void TIASurface::updateSurfaceSettings()
|
||||||
|
{
|
||||||
|
myTiaSurface->setScalingInterpolation(interpolationModeFromSettings(myOSystem.settings()));
|
||||||
|
mySLineSurface->setScalingInterpolation(interpolationModeFromSettings(myOSystem.settings()));
|
||||||
|
}
|
||||||
|
|
|
@ -156,6 +156,11 @@ class TIASurface
|
||||||
*/
|
*/
|
||||||
void saveSnapShot() { mySaveSnapFlag = true; }
|
void saveSnapShot() { mySaveSnapFlag = true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Update surface settings.
|
||||||
|
*/
|
||||||
|
void updateSurfaceSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
Average current calculated buffer's pixel with previous calculated buffer's pixel (50:50).
|
Average current calculated buffer's pixel with previous calculated buffer's pixel (50:50).
|
||||||
|
|
|
@ -56,6 +56,7 @@ class FBSurfaceLIBRETRO : public FBSurface
|
||||||
void free() override { }
|
void free() override { }
|
||||||
void reload() override { }
|
void reload() override { }
|
||||||
void resize(uInt32 width, uInt32 height) override { }
|
void resize(uInt32 width, uInt32 height) override { }
|
||||||
|
void setScalingInterpolation(FrameBuffer::ScalingInterpolation) override { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void applyAttributes() override { }
|
void applyAttributes() override { }
|
||||||
|
|
Loading…
Reference in New Issue