[Scummvm-git-logs] scummvm master -> 9f24eabcf8f17a0b86e22313bfd366da3ae0242a
npjg
nathanael.gentrydb8 at gmail.com
Fri Jul 3 14:43:00 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9f24eabcf8 DIRECTOR: Move to bitwise rendering of reverse sprites
Commit: 9f24eabcf8f17a0b86e22313bfd366da3ae0242a
https://github.com/scummvm/scummvm/commit/9f24eabcf8f17a0b86e22313bfd366da3ae0242a
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-03T10:40:24-04:00
Commit Message:
DIRECTOR: Move to bitwise rendering of reverse sprites
Some functionality may be lost here, as the old drawReverseSprite seems to have
dealt with more edge cases, but these can be reimplemented as they are needed.
With my bitwise method, reverse ink issues in Warlock and our colour testing
movie are fixed.
Changed paths:
engines/director/graphics.cpp
engines/director/stage.cpp
diff --git a/engines/director/graphics.cpp b/engines/director/graphics.cpp
index e54c938220..14313e8ef4 100644
--- a/engines/director/graphics.cpp
+++ b/engines/director/graphics.cpp
@@ -816,6 +816,9 @@ void inkDrawPixel(int x, int y, int color, void *data) {
Graphics::macDrawPixel(x, y, color, p->macPlot);
tmpSrc = *dst;
+ if (p->ink == kInkTypeReverse)
+ tmpSrc = 0;
+
*dst = tmpDst;
src = &tmpSrc;
} else {
diff --git a/engines/director/stage.cpp b/engines/director/stage.cpp
index 59d9bf70f6..4354852499 100644
--- a/engines/director/stage.cpp
+++ b/engines/director/stage.cpp
@@ -183,15 +183,11 @@ void Stage::inkBlitFrom(Channel *channel, Common::Rect destRect, Graphics::Manag
// Otherwise, we are drawing a cast type that does have a built-in surface, so
// blit from that.
- // TODO: Work these ink types into inkDrawPixel.
+ // TODO: Work this ink type into inkDrawPixel.
if (sprite->_ink == kInkTypeMatte) {
drawMatteSprite(channel, srcRect, destRect, blitTo);
return;
- } else if (sprite->_ink == kInkTypeReverse) {
- drawReverseSprite(channel, srcRect, destRect, blitTo);
- return;
}
- // Otherwise, fall through to inkDrawPixel
pd.srcPoint.y = MAX(abs(srcRect.top - destRect.top), 0);
for (int i = 0; i < destRect.height(); i++, pd.srcPoint.y++) {
@@ -265,46 +261,4 @@ void Stage::drawMatteSprite(Channel *channel, Common::Rect &srcRect, Common::Rec
tmp.free();
}
-void Stage::drawReverseSprite(Channel *channel, Common::Rect &srcRect, Common::Rect &destRect, Graphics::ManagedSurface *blitTo) {
- uint8 skipColor = g_director->getPaletteColorCount() - 1;
- for (int ii = 0; ii < destRect.height(); ii++) {
- const byte *src = (const byte *)channel->getSurface()->getBasePtr(MAX(abs(srcRect.left - destRect.left), 0), MAX(abs(srcRect.top - destRect.top - ii), 0));
- byte *dst = (byte *)blitTo->getBasePtr(destRect.left, destRect.top + ii);
- byte srcColor = *src;
-
- for (int j = 0; j < destRect.width(); j++, src++, dst++) {
- if (!channel->_sprite->_cast || channel->_sprite->_cast->_type == kCastShape)
- srcColor = 0x0;
- else
- srcColor = *src;
- uint16 targetSprite = g_director->getCurrentMovie()->getScore()->getSpriteIDFromPos(Common::Point(destRect.left + j, destRect.top + ii));
- if ((targetSprite != 0)) {
- // TODO: This entire reverse colour attempt needs a lot more testing on
- // a lot more colour depths.
- if (srcColor != skipColor) {
- if (!g_director->getCurrentMovie()->getScore()->_channels[targetSprite]->_sprite->_cast || g_director->getCurrentMovie()->getScore()->_channels[targetSprite]->_sprite->_cast->_type != kCastBitmap) {
- if (*dst == 0 || *dst == 255) {
- *dst = g_director->transformColor(*dst);
- } else if (srcColor == 255 || srcColor == 0) {
- *dst = g_director->transformColor(*dst - 40);
- } else {
- *dst = g_director->transformColor(*src - 40);
- }
- } else {
- if (*dst == 0 && g_director->getVersion() == 3 &&
- g_director->getCurrentMovie()->getScore()->_channels[targetSprite]->_sprite->_cast->_type == kCastBitmap &&
- ((BitmapCastMember*)g_director->getCurrentMovie()->getScore()->_channels[targetSprite]->_sprite->_cast)->_bitsPerPixel > 1) {
- *dst = g_director->transformColor(*src - 40);
- } else {
- *dst ^= g_director->transformColor(srcColor);
- }
- }
- }
- } else if (srcColor != skipColor) {
- *dst = g_director->transformColor(srcColor);
- }
- }
- }
-}
-
} // end of namespace Director
More information about the Scummvm-git-logs
mailing list