mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
Removed unused area convolution code from VectorRenderer
svn-id: r36148
This commit is contained in:
parent
e21f5febdc
commit
f465abb75d
@ -37,17 +37,6 @@
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
const VectorRenderer::ConvolutionDataSet VectorRenderer::_convolutionData[VectorRenderer::kConvolutionMAX] = {
|
||||
{ {{1, 1, 1}, {1, 8, 1}, {1, 1, 1}}, 16, 0 }, // soft blur matrix
|
||||
{ {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}, 18, 0 }, // hard blur matrix
|
||||
{ {{1, 2, 1}, {2, 4, 2}, {1, 2, 1}}, 16, 0 }, // gaussian blur matrix
|
||||
{ {{2, 0, 0}, {0, -1, 0}, {0, 0, -1}}, 1, 127}, // emboss matrix
|
||||
{ {{-1, -1, -1}, {-1, 9, -1}, {-1, -1, -1}}, 1, 0}, // sharpen matrix
|
||||
{ {{1, 1, 1}, {1, -7, 1}, {1, 1, 1}}, 1, 0} // edge find matrix
|
||||
};
|
||||
#endif
|
||||
|
||||
/********************************************************************
|
||||
* DRAWSTEP handling functions
|
||||
********************************************************************/
|
||||
|
@ -128,24 +128,6 @@ public:
|
||||
kTriangleRight
|
||||
};
|
||||
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
enum ConvolutionData {
|
||||
kConvolutionSoftBlur,
|
||||
kConvolutionHardBlur,
|
||||
kConvolutionGaussianBlur,
|
||||
kConvolutionEmboss,
|
||||
kConvolutionSharpen,
|
||||
kConvolutionEdgeDetect,
|
||||
kConvolutionMAX
|
||||
};
|
||||
|
||||
struct ConvolutionDataSet {
|
||||
int matrix[3][3];
|
||||
int divisor;
|
||||
int offset;
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Draws a line by considering the special cases for optimization.
|
||||
*
|
||||
@ -517,34 +499,6 @@ public:
|
||||
virtual void disableShadows() { _disableShadows = true; }
|
||||
virtual void enableShadows() { _disableShadows = false; }
|
||||
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
/**
|
||||
* Applies a convolution matrix on the given surface area.
|
||||
* Call applyConvolutionMatrix() instead if you want to use
|
||||
* the embedded matrixes (blur/sharpen masks, bevels, etc).
|
||||
*
|
||||
* @param area Area in which the convolution matrix will be applied.
|
||||
* @param filter Convolution matrix (3X3)
|
||||
* @param filterDiv Divisor for the convolution matrix.
|
||||
* Make sure this equals the total sum of the elements
|
||||
* of the matrix or brightness data will be distorted.
|
||||
* @param offset Offset on the convolution area.
|
||||
*/
|
||||
virtual void areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset) = 0;
|
||||
|
||||
/**
|
||||
* Applies one of the predefined convolution effects on the given area.
|
||||
*
|
||||
* WARNING: Because of performance issues, this is currently disabled on all renderers.
|
||||
*
|
||||
* @param id Id of the convolution data set (see VectorRenderer::ConvolutionData)
|
||||
* @param area Area in which the convolution effect will be applied.
|
||||
*/
|
||||
virtual void applyConvolutionMatrix(const ConvolutionData id, const Common::Rect &area) {
|
||||
areaConvolution(area, _convolutionData[id].matrix, _convolutionData[id].divisor, _convolutionData[id].offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Applies a whole-screen shading effect, used before opening a new dialog.
|
||||
* Currently supports screen dimmings and luminance (b&w).
|
||||
@ -564,10 +518,6 @@ protected:
|
||||
|
||||
int _gradientFactor; /**< Multiplication factor of the active gradient */
|
||||
int _gradientBytes[3]; /**< Color bytes of the active gradient, used to speed up calculation */
|
||||
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
static const ConvolutionDataSet _convolutionData[kConvolutionMAX];
|
||||
#endif
|
||||
};
|
||||
|
||||
} // end of namespace Graphics
|
||||
|
@ -194,43 +194,6 @@ VectorRenderer *createRenderer(int mode) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
template <typename PixelType, typename PixelFormat>
|
||||
void VectorRendererSpec<PixelType, PixelFormat>::
|
||||
areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset) {
|
||||
PixelType *ptr = 0;
|
||||
int newR, newG, newB;
|
||||
uint8 r, g, b;
|
||||
int yVal;
|
||||
|
||||
for (int y = area.top; y < area.bottom; ++y) {
|
||||
for (int x = area.left; x < area.right; ++x) {
|
||||
newR = newG = newB = 0;
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
yVal = MIN(MAX(y - 1 + j, 0), area.bottom - 1);
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
ptr = (PixelType *)Base::_activeSurface->getBasePtr(MIN(MAX(x - 1 + j, 0), area.right - 1), yVal);
|
||||
colorToRGB<PixelFormat>((uint32)*ptr, r, g, b);
|
||||
|
||||
newR += r * filter[j][i];
|
||||
newG += g * filter[j][i];
|
||||
newB += b * filter[j][i];
|
||||
}
|
||||
}
|
||||
|
||||
newR = (newR / filterDiv) + offset;
|
||||
newG = (newG / filterDiv) + offset;
|
||||
newB = (newB / filterDiv) + offset;
|
||||
|
||||
ptr = (PixelType *)Base::_activeSurface->getBasePtr(x, y);
|
||||
*ptr = RGBToColor<PixelFormat>(CLIP(newR, 0, 255), CLIP(newG, 0, 255), CLIP(newB, 0, 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename PixelType, typename PixelFormat>
|
||||
void VectorRendererSpec<PixelType, PixelFormat>::
|
||||
setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2) {
|
||||
|
@ -225,10 +225,6 @@ protected:
|
||||
*/
|
||||
inline void colorFill(PixelType *first, PixelType *last, PixelType color);
|
||||
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
void areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset);
|
||||
#endif
|
||||
|
||||
PixelType _fgColor; /**< Foreground color currently being used to draw on the renderer */
|
||||
PixelType _bgColor; /**< Background color currently being used to draw on the renderer */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user