diff options
author | Eugene Sandulenko | 2010-10-19 20:50:29 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-19 20:50:29 +0000 |
commit | 0d1d4818947c085cb3714b73024738cb99f5fca9 (patch) | |
tree | e3b137a3f24b622f58d5e4e96859ba3a07fae933 /engines | |
parent | 490d4aef0ef1c0649f1ff8e81ce315c830562c11 (diff) | |
download | scummvm-rg350-0d1d4818947c085cb3714b73024738cb99f5fca9.tar.gz scummvm-rg350-0d1d4818947c085cb3714b73024738cb99f5fca9.tar.bz2 scummvm-rg350-0d1d4818947c085cb3714b73024738cb99f5fca9.zip |
SWORD25: Properly implement GraphicEngine::fill()
Now all transitions and dimming out screen at exit dialog is supported.
svn-id: r53620
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sword25/gfx/graphicengine.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index a94395628b..c16107c81c 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -222,13 +222,47 @@ bool GraphicEngine::GetVsync() const { bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) { Common::Rect rect(_width - 1, _height - 1); + int ca = (color >> 24) & 0xff; + + if (ca == 0) + return true; + + int cr = (color >> 16) & 0xff; + int cg = (color >> 8) & 0xff; + int cb = (color >> 0) & 0xff; + if (fillRectPtr) { rect = *fillRectPtr; } - if (fillRectPtr->width() > 0 && fillRectPtr->height() > 0) { - _backSurface.fillRect(rect, color); - g_system->copyRectToScreen((byte *)_backSurface.getBasePtr(fillRectPtr->left, fillRectPtr->top), _backSurface.pitch, fillRectPtr->left, fillRectPtr->top, fillRectPtr->width(), fillRectPtr->height()); + if (rect.width() == 800 && rect.height() == 600) + debug(0, "[%d, %d, %d, %d], 0x%08x", rect.left, rect.top, rect.right, rect.bottom, color); + + if (rect.width() > 0 && rect.height() > 0) { + if (ca == 0xff) { + _backSurface.fillRect(rect, color); + } else { + byte *outo = (byte *)_backSurface.getBasePtr(rect.left, rect.top); + byte *out; + + for (int i = rect.top; i < rect.bottom; i++) { + out = outo; + for (int j = rect.left; j < rect.right; j++) { + *out += (byte)(((cb - *out) * ca) >> 8); + out++; + *out += (byte)(((cg - *out) * ca) >> 8); + out++; + *out += (byte)(((cr - *out) * ca) >> 8); + out++; + *out = 255; + out++; + } + + outo += _backSurface.pitch; + } + } + + g_system->copyRectToScreen((byte *)_backSurface.getBasePtr(rect.left, rect.top), _backSurface.pitch, rect.left, rect.top, rect.width(), rect.height()); } return true; |