DIRECTOR: add comment on invertChannel.

This commit is contained in:
ysj1173886760 2021-08-16 16:34:31 +08:00
parent fb80649d69
commit e9399b6121

View File

@ -100,13 +100,14 @@ void Window::invertChannel(Channel *channel, const Common::Rect &destRect) {
byte *src = (byte *)_composeSurface->getBasePtr(srcRect.left, srcRect.top + i);
const byte *msk = mask ? (const byte *)mask->getBasePtr(xoff, yoff + i) : nullptr;
// if this will cause efficiency problem, then we shall cache the inverted color in wm
for (int j = 0; j < srcRect.width(); j++, src++)
if (!mask || (msk && !(*msk++))) {
byte r, g, b;
g_director->_wm->decomposeColor(*src, r, g, b);
r = 255 - r;
g = 255 - g;
b = 255 - b;
r = ~r;
g = ~g;
b = ~b;
*src = g_director->_wm->findBestColor(r, g, b);
}
}