diff options
author | Denis Kasak | 2009-07-06 19:41:13 +0000 |
---|---|---|
committer | Denis Kasak | 2009-07-06 19:41:13 +0000 |
commit | 61fa4d27d5cbeb6029b07596d2db2af381567e83 (patch) | |
tree | e5f5dd462cd4c2fa258c6b9988f2e5fc3b4e519a | |
parent | b2c24dd640eba57c1c2460a027f021118ca44920 (diff) | |
download | scummvm-rg350-61fa4d27d5cbeb6029b07596d2db2af381567e83.tar.gz scummvm-rg350-61fa4d27d5cbeb6029b07596d2db2af381567e83.tar.bz2 scummvm-rg350-61fa4d27d5cbeb6029b07596d2db2af381567e83.zip |
Cache the transparent colour instead of calling a function for every pixel.
svn-id: r42192
-rw-r--r-- | engines/draci/font.cpp | 4 | ||||
-rw-r--r-- | engines/draci/sprite.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp index 17ff8644cb..8a6f353876 100644 --- a/engines/draci/font.cpp +++ b/engines/draci/font.cpp @@ -162,6 +162,8 @@ void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, bool markDirty) con int ySpaceLeft = dst->h - ty - 1; int yPixelsToDraw = (_fontHeight < ySpaceLeft) ? _fontHeight : ySpaceLeft; + int _transparent = dst->getTransparentColour(); + for (int y = 0; y < yPixelsToDraw; ++y) { for (int x = 0; x <= xPixelsToDraw; ++x) { @@ -189,7 +191,7 @@ void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, bool markDirty) con } // Paint pixel (if not transparent) - if (colour != dst->getTransparentColour()) + if (colour != _transparent) ptr[x] = colour; } diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index bd442e5ee8..32f9d04171 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -142,12 +142,14 @@ void Sprite::draw(Surface *surface, bool markDirty) const { byte *dst = (byte *)surface->getBasePtr(clippedDestRect.left, clippedDestRect.top); byte *src = _data; + int _transparent = surface->getTransparentColour(); + // Blit the sprite to the surface for (int i = sourceRect.top; i < sourceRect.bottom; ++i) { for (int j = sourceRect.left; j < sourceRect.right; ++j) { // Don't blit if the pixel is transparent on the target surface - if (src[i * _width + j] != surface->getTransparentColour()) { + if (src[i * _width + j] != _transparent) { // Draw the sprite mirrored if the _mirror flag is set if (_mirror) { |