GRAPHICS/BASE: Adds definitions for scaler plugins
This includes a class for plugin implementations to inherit from and code necessary for plugin managers to use scalers
This commit is contained in:
parent
26e2a9711f
commit
a3af191753
3 changed files with 79 additions and 1 deletions
|
@ -39,6 +39,7 @@ int pluginTypeVersions[PLUGIN_TYPE_MAX] = {
|
|||
PLUGIN_TYPE_ENGINE_VERSION,
|
||||
PLUGIN_TYPE_MUSIC_VERSION,
|
||||
PLUGIN_TYPE_DETECTION_VERSION,
|
||||
PLUGIN_TYPE_SCALER_VERSION,
|
||||
};
|
||||
|
||||
|
||||
|
@ -942,3 +943,15 @@ DECLARE_SINGLETON(MusicManager);
|
|||
const PluginList &MusicManager::getPlugins() const {
|
||||
return PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC);
|
||||
}
|
||||
|
||||
// Scaler plugins
|
||||
|
||||
#include "graphics/scalerplugin.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(ScalerManager);
|
||||
}
|
||||
|
||||
const ScalerPlugin::List &ScalerManager::getPlugins() const {
|
||||
return (const ScalerPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_SCALER);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ enum PluginType {
|
|||
PLUGIN_TYPE_ENGINE,
|
||||
PLUGIN_TYPE_MUSIC,
|
||||
PLUGIN_TYPE_DETECTION,
|
||||
/* PLUGIN_TYPE_SCALER, */ // TODO: Add graphics scaler plugins
|
||||
PLUGIN_TYPE_SCALER,
|
||||
|
||||
PLUGIN_TYPE_MAX
|
||||
};
|
||||
|
@ -54,6 +54,7 @@ enum PluginType {
|
|||
#define PLUGIN_TYPE_ENGINE_VERSION 2
|
||||
#define PLUGIN_TYPE_MUSIC_VERSION 1
|
||||
#define PLUGIN_TYPE_DETECTION_VERSION 1
|
||||
#define PLUGIN_TYPE_SCALER_VERSION 1
|
||||
|
||||
extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
|
||||
|
||||
|
|
64
graphics/scalerplugin.h
Normal file
64
graphics/scalerplugin.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRAPHICS_SCALERPLUGIN_H
|
||||
#define GRAPHICS_SCALERPLUGIN_H
|
||||
|
||||
#include "base/plugins.h"
|
||||
|
||||
class ScalerPluginObject : public PluginObject {
|
||||
public:
|
||||
virtual ~ScalerPluginObject() {}
|
||||
virtual void scale(const uint8 *srcPtr, uint32 srcPitch,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height) = 0;
|
||||
|
||||
virtual int getFactor() = 0;
|
||||
|
||||
/**
|
||||
* Increase the factor of scaling.
|
||||
* @return the new factor
|
||||
*/
|
||||
virtual int increaseFactor() = 0;
|
||||
|
||||
/**
|
||||
* Decrease the factor of scaling.
|
||||
* @return the new factor
|
||||
*/
|
||||
virtual int decreaseFactor() = 0;
|
||||
};
|
||||
|
||||
typedef PluginSubclass<ScalerPluginObject> ScalerPlugin;
|
||||
|
||||
/**
|
||||
* Singleton class to manage scaler plugins
|
||||
*/
|
||||
class ScalerManager : public Common::Singleton<ScalerManager> {
|
||||
private:
|
||||
friend class Common::Singleton<SingletonBaseType>;
|
||||
|
||||
public:
|
||||
const ScalerPlugin::List &getPlugins() const;
|
||||
};
|
||||
|
||||
/** Convenience shortcut for accessing singleton */
|
||||
#define ScalerMan ScalerManager::instance()
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue