From e9399b612136c5e9c4ce0d5c46b84c67ed3377e9 Mon Sep 17 00:00:00 2001 From: ysj1173886760 <1173886760@qq.com> Date: Mon, 16 Aug 2021 16:34:31 +0800 Subject: [PATCH] DIRECTOR: add comment on invertChannel. --- engines/director/window.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/director/window.cpp b/engines/director/window.cpp index d2a2656e617..141855490ae 100644 --- a/engines/director/window.cpp +++ b/engines/director/window.cpp @@ -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); } }