diff options
author | Bastien Bouclet | 2019-08-27 08:07:14 +0200 |
---|---|---|
committer | Bastien Bouclet | 2019-10-07 21:47:42 +0200 |
commit | 1d764bd787a20ab4b8d6edd79d3bc7db459e3eb0 (patch) | |
tree | b6e201244aabf6c87b40905cc1097c0955c73991 /gui/ThemeEngine.cpp | |
parent | b87ebdce2101a9943f727168526fe89725ebe759 (diff) | |
download | scummvm-rg350-1d764bd787a20ab4b8d6edd79d3bc7db459e3eb0.tar.gz scummvm-rg350-1d764bd787a20ab4b8d6edd79d3bc7db459e3eb0.tar.bz2 scummvm-rg350-1d764bd787a20ab4b8d6edd79d3bc7db459e3eb0.zip |
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.
Diffstat (limited to 'gui/ThemeEngine.cpp')
-rw-r--r-- | gui/ThemeEngine.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
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<Graphics::DrawStep>::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. |