diff options
author | Eugene Sandulenko | 2019-12-27 13:30:53 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-12-27 13:39:56 +0100 |
commit | a9f8af5400bd66b033711f2d1f751d2e9d2b44bc (patch) | |
tree | bc3320571303ed7cc7d4e5232c1b07dfb3a28cb4 | |
parent | 38c488f2ca611b9d29b0bd7d61a0a6821940aac4 (diff) | |
download | scummvm-rg350-a9f8af5400bd66b033711f2d1f751d2e9d2b44bc.tar.gz scummvm-rg350-a9f8af5400bd66b033711f2d1f751d2e9d2b44bc.tar.bz2 scummvm-rg350-a9f8af5400bd66b033711f2d1f751d2e9d2b44bc.zip |
DIRECTOR: Clip Matte sprites properly
-rw-r--r-- | engines/director/frame.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index e9f189fcf4..fd94c8dab7 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -973,6 +973,10 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su // Like background trans, but all white pixels NOT ENCLOSED by coloured pixels are transparent Graphics::Surface tmp; tmp.copyFrom(sprite); + Common::Rect srcRect(sprite.w, sprite.h); + + if (!target.clip(srcRect, drawRect)) + return; // Out of screen // Searching white color in the corners int whiteColor = -1; @@ -994,8 +998,8 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su if (whiteColor == -1) { debugC(1, kDebugImages, "Frame::drawMatteSprite(): No white color for Matte image"); - for (int yy = 0; yy < tmp.h; yy++) { - const byte *src = (const byte *)tmp.getBasePtr(0, yy); + for (int yy = 0; yy < srcRect.height(); yy++) { + const byte *src = (const byte *)tmp.getBasePtr(srcRect.left, srcRect.top + yy); byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + yy); for (int xx = 0; xx < drawRect.width(); xx++, src++, dst++) @@ -1015,9 +1019,9 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su } ff.fillMask(); - for (int yy = 0; yy < tmp.h; yy++) { - const byte *src = (const byte *)tmp.getBasePtr(0, yy); - const byte *mask = (const byte *)ff.getMask()->getBasePtr(0, yy); + for (int yy = 0; yy < srcRect.height(); yy++) { + const byte *src = (const byte *)tmp.getBasePtr(srcRect.left, srcRect.top + yy); + const byte *mask = (const byte *)ff.getMask()->getBasePtr(srcRect.left, srcRect.top + yy); byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + yy); for (int xx = 0; xx < drawRect.width(); xx++, src++, dst++, mask++) |