diff options
Diffstat (limited to 'engines/tsage/graphics.cpp')
-rw-r--r-- | engines/tsage/graphics.cpp | 87 |
1 files changed, 62 insertions, 25 deletions
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index fb0b0b0cbb..ce19502524 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -234,9 +234,14 @@ GfxSurface::GfxSurface(const GfxSurface &s) { } GfxSurface::~GfxSurface() { + clear(); +} + +void GfxSurface::clear() { if (_customSurface) { _customSurface->free(); delete _customSurface; + _customSurface = NULL; } } @@ -289,8 +294,11 @@ void GfxSurface::addDirtyRect(const Rect &r) { r2.translate(_bounds.left, _bounds.top); // Add to the dirty rect list - _dirtyRects.push_back(Rect(r2.left, r2.top, - MIN(r2.right + 1, SCREEN_WIDTH), MIN(r2.bottom + 1, SCREEN_HEIGHT))); + r2.right = MIN(r2.right + 1, SCREEN_WIDTH); + r2.bottom = MIN(r2.bottom + 1, SCREEN_HEIGHT); + + if (r2.isValidRect()) + _dirtyRects.push_back(r2); } } @@ -790,35 +798,58 @@ void GfxElement::drawFrame() { lineP++; } } + + // Draw the edge frame + // Outer frame border + surface.hLine(tempRect.left + 2, tempRect.top, tempRect.right - 2, 0); + surface.hLine(tempRect.left + 2, tempRect.bottom, tempRect.right - 2, 0); + surface.vLine(tempRect.left, tempRect.top + 2, tempRect.bottom - 2, 0); + surface.vLine(tempRect.right, tempRect.top + 2, tempRect.bottom - 2, 0); + *((byte *)surface.getBasePtr(tempRect.left + 1, tempRect.top + 1)) = 0; + *((byte *)surface.getBasePtr(tempRect.right - 1, tempRect.top + 1)) = 0; + *((byte *)surface.getBasePtr(tempRect.left + 1, tempRect.bottom - 1)) = 0; + *((byte *)surface.getBasePtr(tempRect.right - 1, tempRect.bottom - 1)) = 0; + + // Inner frame border + surface.hLine(tempRect.left + 2, tempRect.top + 1, tempRect.right - 2, R2_GLOBALS._frameEdgeColour); + surface.hLine(tempRect.left + 2, tempRect.bottom - 1, tempRect.right - 2, R2_GLOBALS._frameEdgeColour); + surface.vLine(tempRect.left + 1, tempRect.top + 2, tempRect.bottom - 2, R2_GLOBALS._frameEdgeColour); + surface.vLine(tempRect.right - 1, tempRect.top + 2, tempRect.bottom - 2, R2_GLOBALS._frameEdgeColour); + *((byte *)surface.getBasePtr(tempRect.left + 2, tempRect.top + 2)) = R2_GLOBALS._frameEdgeColour; + *((byte *)surface.getBasePtr(tempRect.right - 2, tempRect.top + 2)) = R2_GLOBALS._frameEdgeColour; + *((byte *)surface.getBasePtr(tempRect.left + 2, tempRect.bottom - 2)) = R2_GLOBALS._frameEdgeColour; + *((byte *)surface.getBasePtr(tempRect.right - 2, tempRect.bottom - 2)) = R2_GLOBALS._frameEdgeColour; + gfxManager.unlockSurface(); + gfxManager.getSurface().addDirtyRect(tempRect); } else { // Fill dialog content with specified background colour gfxManager.fillRect(tempRect, _colors.background); - } - - --tempRect.bottom; --tempRect.right; - gfxManager.fillArea(tempRect.left, tempRect.top, bgColor); - gfxManager.fillArea(tempRect.left, tempRect.bottom, fgColor); - gfxManager.fillArea(tempRect.right, tempRect.top, fgColor); - gfxManager.fillArea(tempRect.right, tempRect.bottom, fgColor); - - tempRect.collapse(-1, -1); - gfxManager.fillRect2(tempRect.left + 1, tempRect.top, tempRect.width() - 1, 1, bgColor); - gfxManager.fillRect2(tempRect.left, tempRect.top + 1, 1, tempRect.height() - 1, bgColor); - gfxManager.fillRect2(tempRect.left + 1, tempRect.bottom, tempRect.width() - 1, 1, fgColor); - gfxManager.fillRect2(tempRect.right, tempRect.top + 1, 1, tempRect.height() - 1, fgColor); - - gfxManager.fillArea(tempRect.left, tempRect.top, 0); - gfxManager.fillArea(tempRect.left, tempRect.bottom, 0); - gfxManager.fillArea(tempRect.right, tempRect.top, 0); - gfxManager.fillArea(tempRect.right, tempRect.bottom, 0); - tempRect.collapse(-1, -1); - gfxManager.fillRect2(tempRect.left + 2, tempRect.top, tempRect.width() - 3, 1, 0); - gfxManager.fillRect2(tempRect.left, tempRect.top + 2, 1, tempRect.height() - 3, 0); - gfxManager.fillRect2(tempRect.left + 2, tempRect.bottom, tempRect.width() - 3, 1, 0); - gfxManager.fillRect2(tempRect.right, tempRect.top + 2, 1, tempRect.height() - 3, 0); + --tempRect.bottom; --tempRect.right; + gfxManager.fillArea(tempRect.left, tempRect.top, bgColor); + gfxManager.fillArea(tempRect.left, tempRect.bottom, fgColor); + gfxManager.fillArea(tempRect.right, tempRect.top, fgColor); + gfxManager.fillArea(tempRect.right, tempRect.bottom, fgColor); + + tempRect.collapse(-1, -1); + gfxManager.fillRect2(tempRect.left + 1, tempRect.top, tempRect.width() - 1, 1, bgColor); + gfxManager.fillRect2(tempRect.left, tempRect.top + 1, 1, tempRect.height() - 1, bgColor); + gfxManager.fillRect2(tempRect.left + 1, tempRect.bottom, tempRect.width() - 1, 1, fgColor); + gfxManager.fillRect2(tempRect.right, tempRect.top + 1, 1, tempRect.height() - 1, fgColor); + + gfxManager.fillArea(tempRect.left, tempRect.top, 0); + gfxManager.fillArea(tempRect.left, tempRect.bottom, 0); + gfxManager.fillArea(tempRect.right, tempRect.top, 0); + gfxManager.fillArea(tempRect.right, tempRect.bottom, 0); + + tempRect.collapse(-1, -1); + gfxManager.fillRect2(tempRect.left + 2, tempRect.top, tempRect.width() - 3, 1, 0); + gfxManager.fillRect2(tempRect.left, tempRect.top + 2, 1, tempRect.height() - 3, 0); + gfxManager.fillRect2(tempRect.left + 2, tempRect.bottom, tempRect.width() - 3, 1, 0); + gfxManager.fillRect2(tempRect.right, tempRect.top + 2, 1, tempRect.height() - 3, 0); + } gfxManager.unlockSurface(); } @@ -1322,6 +1353,12 @@ void GfxManager::copyFrom(GfxSurface &src, int destX, int destY) { _surface.copyFrom(src, destX, destY); } +void GfxManager::copyFrom(GfxSurface &src, const Rect &srcBounds, const Rect &destBounds) { + _surface.setBounds(_bounds); + + _surface.copyFrom(src, srcBounds, destBounds); +} + /*--------------------------------------------------------------------------*/ |