SDL/GRAPHICS: remove disableScaling() hack from scaler plugins

This commit is contained in:
Eric Culp 2012-06-07 16:03:03 -04:00 committed by Filippos Karapetis
parent 90e855d1ab
commit c8bcb3912f
7 changed files with 12 additions and 46 deletions

View file

@ -1177,9 +1177,6 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
width = _videoMode.overlayWidth;
height = _videoMode.overlayHeight;
scalerProc = Normal1x;
// The overlay does not need to be scaled
(*_scalerPlugin)->disableScaling();
scale1 = 1;
}
@ -1254,8 +1251,16 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
assert(scalerProc != NULL);
// (byte *)_hwscreen->pixels + rx1 * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
(*_scalerPlugin)->scale((byte *)srcSurf->pixels + (r->x + _maxExtraPixels) * 2 + (r->y + _maxExtraPixels) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + rx1 * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h, r->x, r->y);
if (_overlayVisible) {
uint tmpFactor = (*_normalPlugin)->getFactor();
(*_normalPlugin)->setFactor(1);
(*_normalPlugin)->scale((byte *)srcSurf->pixels + (r->x + _maxExtraPixels) * 2 + (r->y + _maxExtraPixels) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + rx1 * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h, r->x, r->y);
(*_normalPlugin)->setFactor(tmpFactor);
} else {
(*_scalerPlugin)->scale((byte *)srcSurf->pixels + (r->x + _maxExtraPixels) * 2 + (r->y + _maxExtraPixels) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + rx1 * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h, r->x, r->y);
}
}
r->x = dst_x;
@ -1369,9 +1374,6 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
}
}
if (_overlayVisible)
(*_scalerPlugin)->enableScaling();
_numDirtyRects = 0;
_forceRedraw = false;
_cursorNeedsRedraw = false;

View file

@ -41,11 +41,7 @@ void DotMatrixPlugin::initialize(Graphics::PixelFormat format) {
void DotMatrixPlugin::scale(const uint8 *srcPtr, uint32 srcPitch,
uint8 *dstPtr, uint32 dstPitch, int width, int height, int x, int y) {
if (!_doScale) {
scale1x(srcPtr, srcPitch, dstPtr, dstPitch, width, height, _format.bytesPerPixel);
} else {
scaleIntern(srcPtr, srcPitch, dstPtr, dstPitch, width, height, x, y);
}
scaleIntern(srcPtr, srcPitch, dstPtr, dstPitch, width, height, x, y);
}
uint DotMatrixPlugin::increaseFactor() {

View file

@ -128,10 +128,6 @@ void HQPlugin::deinitialize() {
void HQPlugin::scale(const uint8 *srcPtr, uint32 srcPitch,
uint8 *dstPtr, uint32 dstPitch, int width, int height, int x, int y) {
if (!_doScale) {
scale1x(srcPtr, srcPitch, dstPtr, dstPitch, width, height, _format.bytesPerPixel);
return;
}
switch (_factor) {
case 2:
HQ2x(srcPtr, srcPitch, dstPtr, dstPitch, width, height);

View file

@ -73,10 +73,6 @@ void Normal4x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
void NormalPlugin::scale(const uint8 *srcPtr, uint32 srcPitch,
uint8 *dstPtr, uint32 dstPitch, int width, int height, int x, int y) {
if (!_doScale) {
Normal1x(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
return;
}
switch (_factor) {
case 1:
Normal1x(srcPtr, srcPitch, dstPtr, dstPitch, width, height);

View file

@ -37,11 +37,7 @@ void SAIPlugin::deinitialize() {
void SAIPlugin::scale(const uint8 *srcPtr, uint32 srcPitch,
uint8 *dstPtr, uint32 dstPitch, int width, int height, int x, int y) {
if (!_doScale) {
scale1x(srcPtr, srcPitch, dstPtr, dstPitch, width, height, _format.bytesPerPixel);
} else {
_2xSaI(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
}
_2xSaI(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
}
uint SAIPlugin::increaseFactor() {

View file

@ -22,18 +22,6 @@
#include "graphics/scalerplugin.h"
#include "graphics/scaler.h"
ScalerPluginObject::ScalerPluginObject() {
_doScale = true;
}
void ScalerPluginObject::disableScaling() {
_doScale = false;
}
void ScalerPluginObject::enableScaling() {
_doScale = true;
}
void ScalerPluginObject::scale1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr,
uint32 dstPitch, int width, int height, int bytesPerPixel) {
assert(bytesPerPixel == 2); // TODO add support for 4 bytes

View file

@ -28,8 +28,6 @@
class ScalerPluginObject : public PluginObject {
public:
ScalerPluginObject();
virtual ~ScalerPluginObject() {}
/**
@ -103,16 +101,10 @@ public:
static void scale1o5x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr,
uint32 dstPitch, int width, int height, int bytesPerPixel);
// temporary HACK
virtual void disableScaling();
virtual void enableScaling();
protected:
uint _factor;
Common::Array<uint> _factors;
Graphics::PixelFormat _format;
bool _doScale; // < temporary
};
typedef PluginSubclass<ScalerPluginObject> ScalerPlugin;