mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 16:03:05 +00:00
Cache the transparent colour instead of calling a function for every pixel.
svn-id: r42192
This commit is contained in:
parent
b2c24dd640
commit
61fa4d27d5
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user