From 1d764bd787a20ab4b8d6edd79d3bc7db459e3eb0 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Tue, 27 Aug 2019 08:07:14 +0200 Subject: GRAPHICS: Vector renderer clipping rect related cleanups Selecting whether a clipping variant of a draw call needs to be used is no longer the responsibility to the caller. The clipping rect is now part of the state of the renderer. Also fix some of the draw calls to better apply the clipping rect. --- gui/ThemeEngine.cpp | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 666b9b3d8a..e27ee7ac9d 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -875,7 +875,7 @@ void ThemeEngine::drawDD(DrawData type, const Common::Rect &r, uint32 dynamic, b if (drawData->_layer == _layerToDraw) { Common::List::const_iterator step; for (step = drawData->_steps.begin(); step != drawData->_steps.end(); ++step) { - _vectorRenderer->drawStepClip(area, _clip, *step, dynamic); + _vectorRenderer->drawStep(area, _clip, *step, dynamic); } addDirtyRect(extendedRect); @@ -912,23 +912,6 @@ void ThemeEngine::drawDDText(TextData type, TextColor color, const Common::Rect addDirtyRect(dirty); } -void ThemeEngine::drawBitmap(const Graphics::Surface *bitmap, const Common::Rect &r, bool alpha) { - if (_layerToDraw == kDrawLayerBackground) - return; - - Common::Rect area = r; - area.clip(_screen.w, _screen.h); - - if (alpha) - _vectorRenderer->blitKeyBitmapClip(bitmap, area, _clip); - else - _vectorRenderer->blitSubSurfaceClip(bitmap, area, _clip); - - Common::Rect dirtyRect = area; - dirtyRect.clip(_clip); - addDirtyRect(dirtyRect); -} - /********************************************************** * Widget drawing functions *********************************************************/ @@ -1123,11 +1106,22 @@ void ThemeEngine::drawPopUpWidget(const Common::Rect &r, const Common::String &s } } -void ThemeEngine::drawSurface(const Common::Rect &r, const Graphics::Surface &surface, bool themeTrans) { +void ThemeEngine::drawSurface(const Common::Point &p, const Graphics::Surface &surface, bool themeTrans) { if (!ready()) return; - drawBitmap(&surface, r, themeTrans); + if (_layerToDraw == kDrawLayerBackground) + return; + + _vectorRenderer->setClippingRect(_clip); + if (themeTrans) + _vectorRenderer->blitKeyBitmap(&surface, p); + else + _vectorRenderer->blitSubSurface(&surface, p); + + Common::Rect dirtyRect = Common::Rect(p.x, p.y, p.x + surface.w, p.y + surface.h); + dirtyRect.clip(_clip); + addDirtyRect(dirtyRect); } void ThemeEngine::drawWidgetBackground(const Common::Rect &r, uint16 hints, WidgetBackground background) { @@ -1911,4 +1905,8 @@ Common::Rect ThemeEngine::swapClipRect(const Common::Rect &newRect) { return oldRect; } +void ThemeEngine::disableClipRect() { + _clip = Common::Rect(_screen.w, _screen.h); +} + } // End of namespace GUI. -- cgit v1.2.3