[Scummvm-git-logs] scummvm master -> 46b9bed44d1985288dde3c994484e76331ea4feb
npjg
nathanael.gentrydb8 at gmail.com
Thu Jul 9 13:40:31 UTC 2020
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ed36fd4a37 DIRECTOR: Standardize cast colour access
e3cf71185d DIRECTOR: Standardize channel colour access
ea48193089 DIRECTOR: Add manual ink fixup mode
46b9bed44d DIRECTOR: Add extra conditions on shape inks
Commit: ed36fd4a37eec366ab0198400c225c2a66988e2e
https://github.com/scummvm/scummvm/commit/ed36fd4a37eec366ab0198400c225c2a66988e2e
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-09T09:40:14-04:00
Commit Message:
DIRECTOR: Standardize cast colour access
Changed paths:
engines/director/castmember.cpp
engines/director/castmember.h
engines/director/channel.cpp
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index 54275597c3..6b58e32f15 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -430,14 +430,6 @@ void TextCastMember::setColors(int *fgcolor, int *bgcolor) {
((Graphics::MacText *)_widget)->_fullRefresh = true;
}
-void TextCastMember::getColors(int *fgcolor, int *bgcolor) {
- if (fgcolor)
- *fgcolor = _fgcolor;
-
- if (bgcolor)
- *bgcolor = _bgcolor;
-}
-
Graphics::TextAlign TextCastMember::getAlignment() {
switch (_textAlign) {
case kTextAlignRight:
diff --git a/engines/director/castmember.h b/engines/director/castmember.h
index 6e1a1a5a63..c87af64606 100644
--- a/engines/director/castmember.h
+++ b/engines/director/castmember.h
@@ -65,7 +65,8 @@ public:
virtual void createWidget() {}
virtual void setColors(int *fgcolor, int *bgcolor) { return; }
- virtual void getColors(int *fgcolor, int *bgcolor) { return; }
+ virtual uint getForeColor() { return 0; }
+ virtual uint getBackColor() { return 0; }
CastType _type;
Common::Rect _initialRect;
@@ -91,7 +92,6 @@ public:
void createMatte();
Graphics::Surface *getMatte();
- // virtual void setColors(int *fgcolor, int *bgcolor) override;
Image::ImageDecoder *_img;
Graphics::FloodFill *_matte;
@@ -137,22 +137,25 @@ public:
class ShapeCastMember : public CastMember {
public:
ShapeCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version);
+ virtual uint getForeColor() override { return _fgCol; }
+ virtual uint getBackColor() override { return _bgCol; }
ShapeType _shapeType;
uint16 _pattern;
- byte _fgCol;
- byte _bgCol;
byte _fillType;
byte _lineThickness;
byte _lineDirection;
InkType _ink;
+
+private:
+ byte _fgCol;
+ byte _bgCol;
};
class TextCastMember : public CastMember {
public:
TextCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version, bool asButton = false);
virtual void setColors(int *fgcolor, int *bgcolor) override;
- virtual void getColors(int *fgcolor, int *bgcolor) override;
void setText(const char *text);
virtual void createWidget() override;
@@ -162,8 +165,8 @@ public:
virtual bool setEditable(bool editable) override;
Graphics::TextAlign getAlignment();
- uint getBackColor() { return _bgcolor; }
- uint getForeColor() { return _fgcolor; }
+ virtual uint getBackColor() override { return _bgcolor; }
+ virtual uint getForeColor() override { return _fgcolor; }
SizeType _borderSize;
SizeType _gutterSize;
diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 4daa5a91ed..379bb6903b 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -232,8 +232,8 @@ MacShape *Channel::getShape() {
}
if (g_director->getVersion() > 3) {
- shape->foreColor = sc->_fgCol;
- shape->backColor = sc->_bgCol;
+ shape->foreColor = sc->getForeColor();
+ shape->backColor = sc->getBackColor();
shape->lineSize = sc->_lineThickness;
shape->ink = sc->_ink;
}
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 44d2f20a25..cfca2adb29 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -995,7 +995,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
switch (field) {
case kTheBackColor:
- member->getColors(nullptr, &d.u.i);
+ d.u.i = member->getBackColor();
break;
case kTheCastType:
d.u.i = castType;
@@ -1004,7 +1004,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
d = Datum(castInfo->fileName);
break;
case kTheForeColor:
- member->getColors(&d.u.i, nullptr);
+ d.u.i = member->getForeColor();
break;
case kTheHeight:
d.u.i = cast->getCastMemberInitialRect(id).height();
Commit: e3cf71185daaae632e90ffa3dafd2daead5d470e
https://github.com/scummvm/scummvm/commit/e3cf71185daaae632e90ffa3dafd2daead5d470e
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-09T09:40:14-04:00
Commit Message:
DIRECTOR: Standardize channel colour access
Changed paths:
engines/director/channel.cpp
engines/director/channel.h
engines/director/stage.cpp
diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 379bb6903b..2463b46b21 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -245,4 +245,34 @@ MacShape *Channel::getShape() {
return shape;
}
+uint Channel::getBackColor() {
+ if (!_sprite->_cast)
+ return _sprite->_backColor;
+
+ switch (_sprite->_cast->_type) {
+ case kCastText:
+ case kCastButton:
+ case kCastShape: {
+ return _sprite->_cast->getBackColor();
+ }
+ default:
+ return _sprite->_backColor;
+ }
+}
+
+uint Channel::getForeColor() {
+ if (!_sprite->_cast)
+ return _sprite->_foreColor;
+
+ switch (_sprite->_cast->_type) {
+ case kCastText:
+ case kCastButton:
+ case kCastShape: {
+ return _sprite->_cast->getForeColor();
+ }
+ default:
+ return _sprite->_foreColor;
+ }
+}
+
} // End of namespace Director
diff --git a/engines/director/channel.h b/engines/director/channel.h
index 14ffc61a60..9f9b63d849 100644
--- a/engines/director/channel.h
+++ b/engines/director/channel.h
@@ -57,6 +57,8 @@ struct Channel {
Common::Rect getBbox();
Common::Point getPosition();
MacShape *getShape();
+ uint getForeColor();
+ uint getBackColor();
Graphics::ManagedSurface *getSurface();
const Graphics::Surface *getMask(bool forceMatte = false);
diff --git a/engines/director/stage.cpp b/engines/director/stage.cpp
index 695505d074..ac2a088a1b 100644
--- a/engines/director/stage.cpp
+++ b/engines/director/stage.cpp
@@ -189,7 +189,7 @@ void Stage::inkBlitFrom(Channel *channel, Common::Rect destRect, Graphics::Manag
destRect.clip(srcRect);
MacShape *ms = channel->getShape();
- DirectorPlotData pd(_wm, channel->getSurface(), blitTo, destRect, channel->_sprite->_ink, channel->_sprite->_backColor, channel->_sprite->_foreColor, g_director->getPaletteColorCount());
+ DirectorPlotData pd(_wm, channel->getSurface(), blitTo, destRect, channel->_sprite->_ink, channel->getBackColor(), channel->getForeColor(), g_director->getPaletteColorCount());
if (ms) {
inkBlitShape(&pd, srcRect, ms);
Commit: ea481930893fb95b5b6e0c68cd85d88d588992c2
https://github.com/scummvm/scummvm/commit/ea481930893fb95b5b6e0c68cd85d88d588992c2
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-09T09:40:14-04:00
Commit Message:
DIRECTOR: Add manual ink fixup mode
This is necessary because texts and shapes, in particular, come already
colourized and we need to adjust the colourization to match the ink style before
we get to the blitting step. This seems faster than copying the surface or just
keeping the text as a mask and colourizing the chunks as we go.
Changed paths:
engines/director/channel.cpp
engines/director/director.h
engines/director/graphics.cpp
engines/director/stage.cpp
diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 2463b46b21..1d7b535900 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -52,7 +52,7 @@ Graphics::ManagedSurface *Channel::getSurface() {
}
const Graphics::Surface *Channel::getMask(bool forceMatte) {
- if (!_sprite->_cast)
+ if (!_sprite->_cast || _sprite->_spriteType == kTextSprite)
return nullptr;
bool needsMatte = _sprite->_ink == kInkTypeMatte ||
@@ -194,7 +194,7 @@ Common::Point Channel::getPosition() {
}
MacShape *Channel::getShape() {
- if (!_sprite->isQDShape() || (_sprite->_cast && _sprite->_cast->_type != kCastShape))
+ if (!_sprite->isQDShape() && (_sprite->_cast && _sprite->_cast->_type != kCastShape))
return nullptr;
MacShape *shape = new MacShape();
diff --git a/engines/director/director.h b/engines/director/director.h
index 1fd8de0aa1..118b6d68a8 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -108,6 +108,7 @@ struct DirectorPlotData {
Common::Point srcPoint;
bool ignoreSrc;
+ bool manualInk;
bool applyColor;
InkType ink;
int numColors;
@@ -120,6 +121,7 @@ struct DirectorPlotData {
src(s), dst(ds), ink(i), backColor(b), foreColor(f), destRect(dr), macPlot(nullptr), numColors(n), _wm(wm) {
ignoreSrc = false;
applyColor = false;
+ manualInk = false;
}
};
diff --git a/engines/director/graphics.cpp b/engines/director/graphics.cpp
index 86b0130f86..8420b71985 100644
--- a/engines/director/graphics.cpp
+++ b/engines/director/graphics.cpp
@@ -817,18 +817,43 @@ void inkDrawPixel(int x, int y, int color, void *data) {
Graphics::macDrawPixel(x, y, color, p->macPlot);
src = *dst;
- if (p->ink == kInkTypeReverse)
- src = 0;
-
*dst = tmpDst;
} else if (!p->src) {
error("Director::inkDrawPixel(): No source surface");
return;
} else {
src = *((const byte *)p->src->getBasePtr(p->srcPoint.x, p->srcPoint.y));
+
+ if (p->manualInk) {
+ switch(p->ink) {
+ case kInkTypeMask:
+ src = (src == p->backColor ? 0xff : p->foreColor);
+ break;
+ case kInkTypeReverse:
+ src = (src == p->foreColor ? 0 : p->numColors - 1);
+ break;
+ case kInkTypeNotReverse:
+ src = (src == p->backColor ? p->numColors - 1 : 0);
+ break;
+ case kInkTypeGhost:
+ src = (src == p->foreColor ? p->backColor : p->numColors - 1);
+ break;
+ case kInkTypeNotGhost:
+ src = (src == p->backColor ? p->numColors - 1 : p->backColor);
+ break;
+ case kInkTypeNotCopy:
+ src = (src == p->foreColor ? p->backColor : p->foreColor);
+ break;
+ case kInkTypeNotTrans:
+ src = (src == p->foreColor ? p->backColor : p->numColors - 1);
+ break;
+ default:
+ break;
+ }
+ }
}
- switch (p->ink) {
+ switch (p->ink) {
case kInkTypeBackgndTrans:
if (src == p->backColor)
break;
diff --git a/engines/director/stage.cpp b/engines/director/stage.cpp
index ac2a088a1b..a2c5efe4be 100644
--- a/engines/director/stage.cpp
+++ b/engines/director/stage.cpp
@@ -194,10 +194,13 @@ void Stage::inkBlitFrom(Channel *channel, Common::Rect destRect, Graphics::Manag
if (ms) {
inkBlitShape(&pd, srcRect, ms);
} else if (pd.src) {
- if (!(channel->_sprite->_cast &&
- (channel->_sprite->_cast->_type == kCastText ||
- channel->_sprite->_cast->_type == kCastButton))) {
- pd.applyColor = needsAppliedColor(&pd);
+ pd.applyColor = needsAppliedColor(&pd);
+ if (channel->_sprite->_spriteType == kTextSprite) {
+ // Copy colourization is already applied to text by default
+ if (pd.ink != kInkTypeCopy)
+ pd.manualInk = true;
+ else
+ pd.applyColor = false;
}
inkBlitSurface(&pd, srcRect, channel->getMask());
Commit: 46b9bed44d1985288dde3c994484e76331ea4feb
https://github.com/scummvm/scummvm/commit/46b9bed44d1985288dde3c994484e76331ea4feb
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-09T09:40:14-04:00
Commit Message:
DIRECTOR: Add extra conditions on shape inks
Changed paths:
engines/director/stage.cpp
diff --git a/engines/director/stage.cpp b/engines/director/stage.cpp
index a2c5efe4be..09b56d2e8a 100644
--- a/engines/director/stage.cpp
+++ b/engines/director/stage.cpp
@@ -210,8 +210,18 @@ void Stage::inkBlitFrom(Channel *channel, Common::Rect destRect, Graphics::Manag
}
void Stage::inkBlitShape(DirectorPlotData *pd, Common::Rect &srcRect, MacShape *ms) {
- if (ms->foreColor == ms->backColor)
+ switch (pd->ink) {
+ case kInkTypeNotTrans:
+ case kInkTypeNotReverse:
+ case kInkTypeNotGhost:
return;
+ case kInkTypeReverse:
+ ms->foreColor = 0;
+ ms->backColor = 0;
+ break;
+ default:
+ break;
+ }
Common::Rect fillRect((int)srcRect.width(), (int)srcRect.height());
fillRect.moveTo(srcRect.left, srcRect.top);
More information about the Scummvm-git-logs
mailing list