mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
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.
This commit is contained in:
parent
e3cf71185d
commit
ea48193089
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user