2012-04-25 15:57:18 -04:00
|
|
|
/* 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"
|
2012-05-24 14:31:05 -04:00
|
|
|
#include "graphics/pixelformat.h"
|
2012-04-25 15:57:18 -04:00
|
|
|
|
|
|
|
class ScalerPluginObject : public PluginObject {
|
|
|
|
public:
|
2012-05-24 14:31:05 -04:00
|
|
|
|
2012-05-19 15:36:54 -04:00
|
|
|
ScalerPluginObject();
|
2012-05-24 14:31:05 -04:00
|
|
|
|
2012-04-25 15:57:18 -04:00
|
|
|
virtual ~ScalerPluginObject() {}
|
2012-05-24 14:31:05 -04:00
|
|
|
|
2012-05-24 15:59:28 -04:00
|
|
|
/**
|
|
|
|
* This function will be called before any scaler is used.
|
|
|
|
* Precomputed data should be generated here.
|
|
|
|
* @param format The pixel format to scale.
|
|
|
|
*/
|
2012-05-24 14:31:05 -04:00
|
|
|
virtual void initialize(Graphics::PixelFormat format) = 0;
|
|
|
|
|
2012-05-24 15:59:28 -04:00
|
|
|
/**
|
|
|
|
* This is called when the plugin is not needed. It should clean
|
|
|
|
* up memory from the initialize method.
|
|
|
|
*/
|
2012-05-24 15:41:16 -04:00
|
|
|
virtual void deinitialize() {}
|
|
|
|
|
2012-05-24 15:59:28 -04:00
|
|
|
virtual void scale(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr,
|
|
|
|
uint32 dstPitch, int width, int height, int x, int y) = 0;
|
2012-04-25 15:57:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Increase the factor of scaling.
|
2012-05-24 15:59:28 -04:00
|
|
|
* @return The new factor
|
2012-04-25 15:57:18 -04:00
|
|
|
*/
|
2012-05-28 16:44:49 -04:00
|
|
|
virtual uint increaseFactor() = 0;
|
2012-04-25 15:57:18 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Decrease the factor of scaling.
|
2012-05-24 15:59:28 -04:00
|
|
|
* @return The new factor
|
2012-04-25 15:57:18 -04:00
|
|
|
*/
|
2012-05-28 16:44:49 -04:00
|
|
|
virtual uint decreaseFactor() = 0;
|
2012-05-19 15:36:54 -04:00
|
|
|
|
2012-05-28 16:44:49 -04:00
|
|
|
virtual uint getFactor() const = 0;
|
2012-05-24 15:59:28 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates how far outside the scaling region this scaler "looks"
|
|
|
|
* @return The number of pixels in any direction
|
|
|
|
*/
|
2012-05-28 16:44:49 -04:00
|
|
|
virtual uint extraPixels() const = 0;
|
2012-05-24 14:31:05 -04:00
|
|
|
|
2012-05-24 15:59:28 -04:00
|
|
|
/**
|
|
|
|
* Some scalers are not suitable for scaling the cursor.
|
|
|
|
* Blurring scalers should return false.
|
|
|
|
*/
|
2012-05-28 16:44:49 -04:00
|
|
|
virtual bool canDrawCursor() const = 0;
|
2012-05-24 14:31:05 -04:00
|
|
|
|
|
|
|
// temporary HACK
|
2012-05-19 15:36:54 -04:00
|
|
|
virtual void disableScaling();
|
|
|
|
|
|
|
|
virtual void enableScaling();
|
2012-05-24 14:31:05 -04:00
|
|
|
|
2012-05-19 15:36:54 -04:00
|
|
|
protected:
|
2012-05-28 16:44:49 -04:00
|
|
|
uint _factor;
|
2012-05-24 14:31:05 -04:00
|
|
|
bool _doScale; // < temporary
|
2012-04-25 15:57:18 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2012-05-28 16:26:31 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries all scaler plugins for the maximum number of pixels they
|
|
|
|
* can access out of bounds. Useful for adding extra rows and columns
|
|
|
|
* to surfaces.
|
|
|
|
*/
|
2012-05-28 16:44:49 -04:00
|
|
|
uint getMaxExtraPixels() const;
|
2012-04-25 15:57:18 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Convenience shortcut for accessing singleton */
|
|
|
|
#define ScalerMan ScalerManager::instance()
|
|
|
|
|
|
|
|
#endif
|