aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-27 12:15:00 +0200
committerEugene Sandulenko2016-08-27 12:15:00 +0200
commit7acd288e365c352602feff3cd03b610ddbe76603 (patch)
treeee3ae731f968f73df86206623e60127a8c81403d
parentea7076028b0382bf88b5f7f447f23e0bc7e28f7f (diff)
downloadscummvm-rg350-7acd288e365c352602feff3cd03b610ddbe76603.tar.gz
scummvm-rg350-7acd288e365c352602feff3cd03b610ddbe76603.tar.bz2
scummvm-rg350-7acd288e365c352602feff3cd03b610ddbe76603.zip
DIRECTOR: Optimized Matte Ink drawing
-rw-r--r--engines/director/frame.cpp47
1 files changed, 27 insertions, 20 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index f88eb8260d..3d5d8b6a4b 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -734,31 +734,38 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
}
if (whiteColor == -1) {
- warning("No white color for Matte image");
- whiteColor = *(byte *)tmp.getBasePtr(0, 0);
- }
+ debugC(1, kDebugImages, "No white color for Matte image");
- Graphics::FloodFill ff(&tmp, whiteColor, 0, true);
+ for (int yy = 0; yy < tmp.h; yy++) {
+ const byte *src = (const byte *)tmp.getBasePtr(0, yy);
+ byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + yy);
- for (int yy = 0; yy < tmp.h; yy++) {
- ff.addSeed(0, yy);
- ff.addSeed(tmp.w - 1, yy);
- }
+ for (int xx = 0; xx < drawRect.width(); xx++, src++, dst++)
+ *dst = *src;
+ }
+ } else {
+ Graphics::FloodFill ff(&tmp, whiteColor, 0, true);
- for (int xx = 0; xx < tmp.w; xx++) {
- ff.addSeed(xx, 0);
- ff.addSeed(xx, tmp.h - 1);
- }
- ff.fillMask();
+ for (int yy = 0; yy < tmp.h; yy++) {
+ ff.addSeed(0, yy);
+ ff.addSeed(tmp.w - 1, yy);
+ }
- 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);
- byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + yy);
+ for (int xx = 0; xx < tmp.w; xx++) {
+ ff.addSeed(xx, 0);
+ ff.addSeed(xx, tmp.h - 1);
+ }
+ ff.fillMask();
- for (int xx = 0; xx < drawRect.width(); xx++, src++, dst++, mask++)
- if (*mask == 0)
- *dst = *src;
+ 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);
+ byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + yy);
+
+ for (int xx = 0; xx < drawRect.width(); xx++, src++, dst++, mask++)
+ if (*mask == 0)
+ *dst = *src;
+ }
}
tmp.free();