aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Augereau2008-07-21 10:13:44 +0000
committerBertrand Augereau2008-07-21 10:13:44 +0000
commitecd44b8f90ec3f1e749f3b8787f6348e95030b0b (patch)
tree3806040e2c9b463964e0b1a06e236cf49a03a630
parent5a71d764e7278fd4c9d83ba80e500e05b9b18fc7 (diff)
downloadscummvm-rg350-ecd44b8f90ec3f1e749f3b8787f6348e95030b0b.tar.gz
scummvm-rg350-ecd44b8f90ec3f1e749f3b8787f6348e95030b0b.tar.bz2
scummvm-rg350-ecd44b8f90ec3f1e749f3b8787f6348e95030b0b.zip
Avoid branching in the inner loop of AGOS drawVertImageCompressed
svn-id: r33167
-rw-r--r--engines/agos/gfx.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp
index 6e91c5d94c..867a411962 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -8,7 +8,7 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+d
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -806,7 +806,6 @@ void AGOSEngine::drawVertImageUncompressed(VC10_state *state) {
void AGOSEngine::drawVertImageCompressed(VC10_state *state) {
assert (state->flags & kDFCompressed) ;
uint w, h;
- byte *src, *dst, *dstPtr;
state->x_skip *= 4; /* reached */
@@ -815,7 +814,7 @@ void AGOSEngine::drawVertImageCompressed(VC10_state *state) {
vc10_skip_cols(state);
- dstPtr = state->surf_addr;
+ byte *dstPtr = state->surf_addr;
if (!(state->flags & kDFNonTrans) && (state->flags & 0x40)) { /* reached */
dstPtr += vcReadVar(252);
}
@@ -823,20 +822,34 @@ void AGOSEngine::drawVertImageCompressed(VC10_state *state) {
do {
byte color;
- src = vc10_depackColumn(state);
- dst = dstPtr;
+ const byte *src = vc10_depackColumn(state);
+ byte *dst = dstPtr;
h = 0;
- do {
- color = (*src / 16);
- if ((state->flags & kDFNonTrans) || color != 0)
+ if (state->flags & kDFNonTrans) {
+ do {
+ byte colors = *src;
+ color = (colors / 16);
dst[0] = color | state->palette;
- color = (*src & 15);
- if ((state->flags & kDFNonTrans) || color != 0)
+ color = (colors & 15);
dst[1] = color | state->palette;
- dst += state->surf_pitch;
- src++;
- } while (++h != state->draw_height);
+ dst += state->surf_pitch;
+ src++;
+ } while (++h != state->draw_height);
+ }
+ else {
+ do {
+ byte colors = *src;
+ color = (colors / 16);
+ if (color != 0)
+ dst[0] = color | state->palette;
+ color = (colors & 15);
+ if (color != 0)
+ dst[1] = color | state->palette;
+ dst += state->surf_pitch;
+ src++;
+ } while (++h != state->draw_height);
+ }
dstPtr += 2;
} while (++w != state->draw_width);
}