aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorVicent Marti2008-08-02 16:23:58 +0000
committerVicent Marti2008-08-02 16:23:58 +0000
commitc5980b6211bdb11c144c23f71470f4dde5ace3a9 (patch)
treeb1d80c55b9a726cfd4b58b166eb9e35ca69f91d7 /graphics
parent7cb23c76a267955790fa58380d65fe55b4a5dcd1 (diff)
downloadscummvm-rg350-c5980b6211bdb11c144c23f71470f4dde5ace3a9.tar.gz
scummvm-rg350-c5980b6211bdb11c144c23f71470f4dde5ace3a9.tar.bz2
scummvm-rg350-c5980b6211bdb11c144c23f71470f4dde5ace3a9.zip
Screen/dialog dimming.
svn-id: r33532
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRenderer.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index fa986e2f08..b85ad8a9c9 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -436,6 +436,8 @@ public:
areaConvolution(area, _convolutionData[id].matrix, _convolutionData[id].divisor, _convolutionData[id].offset);
#endif
}
+
+ virtual void applyScreenShading(GUI::Theme::ShadingStyle) = 0;
protected:
Surface *_activeSurface; /** Pointer to the surface currently being drawn */
@@ -451,6 +453,8 @@ protected:
int _gradientBytes[3]; /** Color bytes of the active gradient, used to speed up calculation */
static const ConvolutionDataSet _convolutionData[kConvolutionMAX];
+
+ static const int _dimPercentValue = 256 * 50 / 100;
};
/**
@@ -605,6 +609,29 @@ public:
src_ptr += src_pitch;
}
}
+
+ virtual void applyScreenShading(GUI::Theme::ShadingStyle shadingStyle) {
+ int pixels = _activeSurface->w * _activeSurface->h;
+ PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(0, 0);
+ uint8 r, g, b;
+ uint lum;
+
+ if (shadingStyle == GUI::Theme::kShadingDim) {
+ while (pixels--) {
+ colorToRGB<PixelFormat>(*ptr, r, g, b);
+ r = r * _dimPercentValue >> 8;
+ g = g * _dimPercentValue >> 8;
+ b = b * _dimPercentValue >> 8;
+ *ptr++ = RGBToColor<PixelFormat>(r, g, b);
+ }
+ } else if (shadingStyle == GUI::Theme::kShadingLuminance) {
+ while (pixels--) {
+ colorToRGB<PixelFormat>(*ptr, r, g, b);
+ lum = (r >> 2) + (g >> 1) + (b >> 3);
+ *ptr++ = RGBToColor<PixelFormat>(lum, lum, lum);
+ }
+ }
+ }
protected: