aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorVicent Marti2008-09-19 17:15:20 +0000
committerVicent Marti2008-09-19 17:15:20 +0000
commitc7e07102b69a5fd66a89605c619e008060744bf4 (patch)
treea93afc9c4bbda4e06dfd1d5ece308f899321b882 /graphics
parent81715eae04f522af5a39645f97e5c88f10ccef67 (diff)
downloadscummvm-rg350-c7e07102b69a5fd66a89605c619e008060744bf4.tar.gz
scummvm-rg350-c7e07102b69a5fd66a89605c619e008060744bf4.tar.bz2
scummvm-rg350-c7e07102b69a5fd66a89605c619e008060744bf4.zip
Unrolled a loop.
Misc fixes. svn-id: r34604
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRendererSpec.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index b129bbfc79..375dfca20a 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -372,16 +372,27 @@ applyScreenShading(GUI::Theme::ShadingStyle shadingStyle) {
uint8 r, g, b;
uint lum;
- uint32 shiftMask = (uint32)(
+ const uint32 shiftMask = (uint32)~(
(1 << PixelFormat::kGreenShift) |
(1 << PixelFormat::kRedShift) |
- (1 << PixelFormat::kBlueShift));
-
- shiftMask = (~shiftMask) >> 1;
+ (1 << PixelFormat::kBlueShift)) >> 1;
if (shadingStyle == GUI::Theme::kShadingDim) {
- while (pixels--)
- *ptr++ = (*ptr >> 1) & shiftMask;
+
+ int n = (pixels + 7) >> 3;
+ switch (pixels % 8) {
+ case 0: do {
+ *ptr++ = (*ptr >> 1) & shiftMask;
+ case 7: *ptr++ = (*ptr >> 1) & shiftMask;
+ case 6: *ptr++ = (*ptr >> 1) & shiftMask;
+ case 5: *ptr++ = (*ptr >> 1) & shiftMask;
+ case 4: *ptr++ = (*ptr >> 1) & shiftMask;
+ case 3: *ptr++ = (*ptr >> 1) & shiftMask;
+ case 2: *ptr++ = (*ptr >> 1) & shiftMask;
+ case 1: *ptr++ = (*ptr >> 1) & shiftMask;
+ } while (--n > 0);
+ }
+
} else if (shadingStyle == GUI::Theme::kShadingLuminance) {
while (pixels--) {
colorToRGB<PixelFormat>(*ptr, r, g, b);