aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-06-17 14:10:48 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commitdfdb194957e8b1634d1aa08bf2bc0659c038c9ac (patch)
treee5c8de01d29305c3a521342b0999f27683c7f5d5 /engines
parent36df662863add2b9d88b5ecdbc11d06b25b3ecb3 (diff)
downloadscummvm-rg350-dfdb194957e8b1634d1aa08bf2bc0659c038c9ac.tar.gz
scummvm-rg350-dfdb194957e8b1634d1aa08bf2bc0659c038c9ac.tar.bz2
scummvm-rg350-dfdb194957e8b1634d1aa08bf2bc0659c038c9ac.zip
DIRECTOR: Fix Matte ink rendering
Diffstat (limited to 'engines')
-rw-r--r--engines/director/score.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9e10edebc7..3f0e37f210 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1098,7 +1098,29 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
Graphics::Surface tmp;
tmp.copyFrom(sprite);
- Graphics::FloodFill ff(&tmp, *(byte *)tmp.getBasePtr(0, 0), 0, true);
+ // Searching white color in the corners
+ int whiteColor = -1;
+
+ for (int corner = 0; corner < 4; corner++) {
+ int x = (corner & 0x1) ? tmp.w - 1 : 0;
+ int y = (corner & 0x2) ? tmp.h - 1 : 0;
+
+ byte color = *(byte *)tmp.getBasePtr(x, y);
+
+ if (_vm->getPalette()[color * 3 + 0] == 0xff &&
+ _vm->getPalette()[color * 3 + 1] == 0xff &&
+ _vm->getPalette()[color * 3 + 2] == 0xff) {
+ whiteColor = color;
+ break;
+ }
+ }
+
+ if (whiteColor == -1) {
+ warning("No white color for Matte image");
+ whiteColor = *(byte *)tmp.getBasePtr(0, 0);
+ }
+
+ Graphics::FloodFill ff(&tmp, whiteColor, 0, true);
for (int yy = 0; yy < tmp.h; yy++) {
ff.addSeed(0, yy);