[Scummvm-cvs-logs] SF.net SVN: scummvm:[34482] scummvm/branches/gsoc2008-gui/graphics/ VectorRendererSpec.cpp
Tanoku at users.sourceforge.net
Tanoku at users.sourceforge.net
Wed Sep 10 20:43:25 CEST 2008
Revision: 34482
http://scummvm.svn.sourceforge.net/scummvm/?rev=34482&view=rev
Author: Tanoku
Date: 2008-09-10 18:43:24 +0000 (Wed, 10 Sep 2008)
Log Message:
-----------
Fixed bottleneck: Screen dimming.
Modified Paths:
--------------
scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.cpp
Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.cpp 2008-09-10 18:01:02 UTC (rev 34481)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.cpp 2008-09-10 18:43:24 UTC (rev 34482)
@@ -371,15 +371,17 @@
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 @@
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);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list