aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorVicent Marti2008-09-10 18:43:24 +0000
committerVicent Marti2008-09-10 18:43:24 +0000
commit81715eae04f522af5a39645f97e5c88f10ccef67 (patch)
treeb77e23076b0c0afcc597078ffd14056a11bacbc8 /graphics
parent2de0d7d42e100b56861c1f95ba8a6bab2cf9ff0d (diff)
downloadscummvm-rg350-81715eae04f522af5a39645f97e5c88f10ccef67.tar.gz
scummvm-rg350-81715eae04f522af5a39645f97e5c88f10ccef67.tar.bz2
scummvm-rg350-81715eae04f522af5a39645f97e5c88f10ccef67.zip
Fixed bottleneck: Screen dimming.
svn-id: r34482
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRendererSpec.cpp38
1 files changed, 17 insertions, 21 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 7e1164b2de..b129bbfc79 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -371,15 +371,17 @@ applyScreenShading(GUI::Theme::ShadingStyle shadingStyle) {
PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(0, 0);
uint8 r, g, b;
uint lum;
+
+ uint32 shiftMask = (uint32)(
+ (1 << PixelFormat::kGreenShift) |
+ (1 << PixelFormat::kRedShift) |
+ (1 << PixelFormat::kBlueShift));
+
+ shiftMask = (~shiftMask) >> 1;
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);
- }
+ while (pixels--)
+ *ptr++ = (*ptr >> 1) & shiftMask;
} else if (shadingStyle == GUI::Theme::kShadingLuminance) {
while (pixels--) {
colorToRGB<PixelFormat>(*ptr, r, g, b);
@@ -424,24 +426,18 @@ calcGradient(uint32 pos, uint32 max) {
template <typename PixelType, typename PixelFormat>
void VectorRendererSpec<PixelType, PixelFormat>::
colorFill(PixelType *first, PixelType *last, PixelType color) {
- if (first == last) {
- *first = color;
- return;
- }
-
- register PixelType *ptr = first;
register int count = (last - first);
register int n = (count + 7) >> 3;
switch (count % 8) {
case 0: do {
- *ptr++ = color;
- case 7: *ptr++ = color;
- case 6: *ptr++ = color;
- case 5: *ptr++ = color;
- case 4: *ptr++ = color;
- case 3: *ptr++ = color;
- case 2: *ptr++ = color;
- case 1: *ptr++ = color;
+ *first++ = color;
+ case 7: *first++ = color;
+ case 6: *first++ = color;
+ case 5: *first++ = color;
+ case 4: *first++ = color;
+ case 3: *first++ = color;
+ case 2: *first++ = color;
+ case 1: *first++ = color;
} while (--n > 0);
}
}