mirror of https://github.com/stella-emu/stella.git
Fall back to bilinear filtering if rendertargets are not supported.
This commit is contained in:
parent
3b29476502
commit
02dd24d45f
|
@ -24,6 +24,7 @@
|
|||
"utility": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"functional": "cpp",
|
||||
"iomanip": "cpp"
|
||||
"iomanip": "cpp",
|
||||
"__cxx_version": "cpp"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
#include "FBSurfaceSDL2.hxx"
|
||||
|
||||
#include "ThreadDebugging.hxx"
|
||||
#include "sdl_blitter/BilinearBlitter.hxx"
|
||||
#include "sdl_blitter/HqBlitter.hxx"
|
||||
#include "sdl_blitter/BlitterFactory.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FBSurfaceSDL2::FBSurfaceSDL2(FrameBufferSDL2& buffer,
|
||||
|
@ -29,7 +28,6 @@ FBSurfaceSDL2::FBSurfaceSDL2(FrameBufferSDL2& buffer,
|
|||
myIsVisible(true),
|
||||
myIsStatic(false)
|
||||
{
|
||||
myBlitter = make_unique<HqBlitter>(buffer);
|
||||
createSurface(width, height, data);
|
||||
}
|
||||
|
||||
|
@ -137,7 +135,9 @@ void FBSurfaceSDL2::translateCoords(Int32& x, Int32& y) const
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool FBSurfaceSDL2::render()
|
||||
{
|
||||
if(myIsVisible)
|
||||
if (!myBlitter) reinitializeBlitter();
|
||||
|
||||
if(myIsVisible && myBlitter)
|
||||
{
|
||||
myBlitter->blit(*mySurface);
|
||||
|
||||
|
@ -157,7 +157,7 @@ void FBSurfaceSDL2::invalidate()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceSDL2::free()
|
||||
{
|
||||
myBlitter->free();
|
||||
myBlitter.release();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -215,7 +215,9 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceSDL2::reinitializeBlitter()
|
||||
{
|
||||
myBlitter->reinitialize(mySrcR, myDstR, myAttributes, myIsStatic ? mySurface : nullptr);
|
||||
if (!myBlitter && myFB.isInitialized()) myBlitter = BlitterFactory::createBlitter(myFB);
|
||||
|
||||
if (myBlitter) myBlitter->reinitialize(mySrcR, myDstR, myAttributes, myIsStatic ? mySurface : nullptr);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -434,6 +434,12 @@ SDL_Renderer* FrameBufferSDL2::renderer()
|
|||
return myRenderer;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool FrameBufferSDL2::isInitialized() const
|
||||
{
|
||||
return myRenderer != nullptr;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const SDL_PixelFormat& FrameBufferSDL2::pixelFormat()
|
||||
{
|
||||
|
|
|
@ -118,6 +118,8 @@ class FrameBufferSDL2 : public FrameBuffer
|
|||
|
||||
SDL_Renderer* renderer();
|
||||
|
||||
bool isInitialized() const;
|
||||
|
||||
const SDL_PixelFormat& pixelFormat();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -27,7 +27,8 @@ MODULE_OBJS := \
|
|||
src/common/StaggeredLogger.o \
|
||||
src/common/repository/KeyValueRepositoryConfigfile.o \
|
||||
src/common/sdl_blitter/BilinearBlitter.o \
|
||||
src/common/sdl_blitter/HqBlitter.o
|
||||
src/common/sdl_blitter/HqBlitter.o \
|
||||
src/common/sdl_blitter/BlitterFactory.o \
|
||||
|
||||
MODULE_DIRS += \
|
||||
src/common
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "BlitterFactory.hxx"
|
||||
|
||||
#include "SDL_lib.hxx"
|
||||
#include "BilinearBlitter.hxx"
|
||||
#include "HqBlitter.hxx"
|
||||
|
||||
unique_ptr<Blitter> BlitterFactory::createBlitter(FrameBufferSDL2& fb)
|
||||
{
|
||||
if (!fb.isInitialized()) {
|
||||
throw runtime_error("BlitterFactory requires an initialized framebuffer!");
|
||||
}
|
||||
|
||||
SDL_RendererInfo info;
|
||||
|
||||
SDL_GetRendererInfo(fb.renderer(), &info);
|
||||
|
||||
return (info.flags & SDL_RENDERER_TARGETTEXTURE) ?
|
||||
unique_ptr<Blitter>(new HqBlitter(fb)) : unique_ptr<Blitter>(new BilinearBlitter(fb));
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef BLITTER_FACTORY_HXX
|
||||
#define BLITTER_FACTORY_HXX
|
||||
|
||||
#include "Blitter.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "FrameBufferSDL2.hxx"
|
||||
|
||||
class BlitterFactory {
|
||||
public:
|
||||
|
||||
static unique_ptr<Blitter> createBlitter(FrameBufferSDL2& fb);
|
||||
};
|
||||
|
||||
#endif // BLITTER_FACTORY_HXX
|
Loading…
Reference in New Issue