AGS: Refactor ScummVM GfxFilter from being static global

This commit is contained in:
Paul Gilbert 2022-05-31 21:04:12 -07:00
parent 62840d8cc2
commit 4d15fc94c8
5 changed files with 9 additions and 8 deletions

View File

@ -740,14 +740,14 @@ size_t ScummVMRendererGraphicsFactory::GetFilterCount() const {
const GfxFilterInfo *ScummVMRendererGraphicsFactory::GetFilterInfo(size_t index) const {
switch (index) {
case 0:
return &ScummVMRendererGfxFilter::FilterInfo;
return _G(scummvmGfxFilter);
default:
return nullptr;
}
}
String ScummVMRendererGraphicsFactory::GetDefaultFilterID() const {
return ScummVMRendererGfxFilter::FilterInfo.Id;
return _GP(scummvmGfxFilter).Id;
}
/* static */ ScummVMRendererGraphicsFactory *ScummVMRendererGraphicsFactory::GetFactory() {
@ -763,7 +763,7 @@ ScummVMRendererGraphicsDriver *ScummVMRendererGraphicsFactory::EnsureDriverCreat
}
ScummVMRendererGfxFilter *ScummVMRendererGraphicsFactory::CreateFilter(const String &id) {
if (ScummVMRendererGfxFilter::FilterInfo.Id.CompareNoCase(id) == 0)
if (_GP(scummvmGfxFilter).Id.CompareNoCase(id) == 0)
return new ScummVMRendererGfxFilter();
return nullptr;
}

View File

@ -20,16 +20,15 @@
*/
#include "ags/engine/gfx/gfxfilter_scummvm_renderer.h"
#include "ags/globals.h"
namespace AGS3 {
namespace AGS {
namespace Engine {
namespace ALSW {
const GfxFilterInfo ScummVMRendererGfxFilter::FilterInfo = GfxFilterInfo("StdScale", "Nearest-neighbour");
const GfxFilterInfo &ScummVMRendererGfxFilter::GetInfo() const {
return FilterInfo;
return _GP(scummvmGfxFilter);
}
} // namespace ALSW

View File

@ -41,8 +41,6 @@ public:
virtual ~ScummVMRendererGfxFilter() {}
virtual const GfxFilterInfo &GetInfo() const;
static const GfxFilterInfo FilterInfo;
};
} // namespace ALSW

View File

@ -253,6 +253,8 @@ Globals::Globals() {
_StaticInventoryArray = new StaticArray();
_StaticDialogArray = new StaticArray();
_scummvmGfxFilter = new AGS::Engine::GfxFilterInfo("StdScale", "Nearest-neighbour");
// gfxfilter_aad3d.cpp globals
_aad3dFilterInfo = new AGS::Engine::GfxFilterInfo("Linear", "Linear interpolation");
@ -511,6 +513,7 @@ Globals::~Globals() {
delete _StaticRegionArray;
delete _StaticInventoryArray;
delete _StaticDialogArray;
delete _scummvmGfxFilter;
// gfxfilter_aad3d.cpp globals
delete _aad3dFilterInfo;

View File

@ -859,6 +859,7 @@ public:
*/
const AGS::Engine::GfxFilterInfo *_allegroFilterInfo;
AGS::Engine::GfxFilterInfo *_scummvmGfxFilter;
/**@}*/