aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-27 16:24:57 +0100
committerEugene Sandulenko2019-12-27 16:24:57 +0100
commit90f0a6db772c24def379463ecdf9642ffc780bbd (patch)
tree6a90e989d5785ecc4ba3b4143cf68034d83e9fd5
parentda9bd9a102dd1e8ea7e1b8c88500bb456b597e07 (diff)
downloadscummvm-rg350-90f0a6db772c24def379463ecdf9642ffc780bbd.tar.gz
scummvm-rg350-90f0a6db772c24def379463ecdf9642ffc780bbd.tar.bz2
scummvm-rg350-90f0a6db772c24def379463ecdf9642ffc780bbd.zip
DIRECTOR: Clip to scene dimensions all Ink-based rendering
-rw-r--r--engines/director/frame.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index aa892aa36a..f7a3e84daf 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -917,12 +917,16 @@ void Frame::inkBasedBlit(Graphics::ManagedSurface &targetSurface, const Graphics
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
uint8 skipColor = _vm->getPaletteColorCount() - 1; // FIXME is it always white (last entry in pallette) ?
+ Common::Rect srcRect(sprite.w, sprite.h);
+
+ if (!target.clip(srcRect, drawRect))
+ return; // Out of screen
- for (int ii = 0; ii < sprite.h; ii++) {
- const byte *src = (const byte *)sprite.getBasePtr(0, ii);
+ for (int ii = 0; ii < srcRect.height(); ii++) {
+ const byte *src = (const byte *)sprite.getBasePtr(srcRect.left, srcRect.top + ii);
byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
- for (int j = 0; j < drawRect.width(); j++) {
+ for (int j = 0; j < srcRect.width(); j++) {
if (*src != skipColor)
*dst = *src;
@@ -933,12 +937,17 @@ void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graph
}
void Frame::drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
+ Common::Rect srcRect(sprite.w, sprite.h);
+
+ if (!target.clip(srcRect, drawRect))
+ return; // Out of screen
+
uint8 skipColor = _vm->getPaletteColorCount() - 1;
- for (int ii = 0; ii < sprite.h; ii++) {
- const byte *src = (const byte *)sprite.getBasePtr(0, ii);
+ for (int ii = 0; ii < srcRect.height(); ii++) {
+ const byte *src = (const byte *)sprite.getBasePtr(srcRect.left, srcRect.top + ii);
byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
- for (int j = 0; j < drawRect.width(); j++) {
+ for (int j = 0; j < srcRect.width(); j++) {
if ((getSpriteIDFromPos(Common::Point(drawRect.left + j, drawRect.top + ii)) != 0) && (*src != skipColor))
*dst = (_vm->getPaletteColorCount() - 1) - *src; // Oposite color
@@ -949,12 +958,17 @@ void Frame::drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Su
}
void Frame::drawReverseSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
+ Common::Rect srcRect(sprite.w, sprite.h);
+
+ if (!target.clip(srcRect, drawRect))
+ return; // Out of screen
+
uint8 skipColor = _vm->getPaletteColorCount() - 1;
- for (int ii = 0; ii < sprite.h; ii++) {
- const byte *src = (const byte *)sprite.getBasePtr(0, ii);
+ for (int ii = 0; ii < srcRect.height(); ii++) {
+ const byte *src = (const byte *)sprite.getBasePtr(srcRect.left, srcRect.top + ii);
byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
- for (int j = 0; j < drawRect.width(); j++) {
+ for (int j = 0; j < srcRect.width(); j++) {
if ((getSpriteIDFromPos(Common::Point(drawRect.left + j, drawRect.top + ii)) != 0)) {
if (*src != skipColor) {
*dst = (*dst == *src ? (*src == 0 ? 0xff : 0) : *src);
@@ -975,7 +989,7 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
Common::Rect srcRect(sprite.w, sprite.h);
if (!target.clip(srcRect, drawRect))
- return; // Out of screen
+ return; // Out of screen
// Searching white color in the corners
int whiteColor = -1;
@@ -1023,7 +1037,7 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
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++)
+ for (int xx = 0; xx < srcRect.width(); xx++, src++, dst++, mask++)
if (*mask == 0)
*dst = *src;
}