From fadb918bbdb68ed07ef7dffbf4e4cdca59408956 Mon Sep 17 00:00:00 2001 From: av-dx Date: Mon, 7 Jun 2021 16:45:56 +0530 Subject: [PATCH] GUI: Fix clipping on bitmap images --- graphics/VectorRendererSpec.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 1bf1c0461ea..ee71272e02c 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -809,17 +809,26 @@ template void VectorRendererSpec:: blitKeyBitmap(const Graphics::ManagedSurface *source, const Common::Point &p, bool themeTrans) { Common::Rect drawRect(p.x, p.y, p.x + source->w, p.y + source->h); + Common::Point np; drawRect.clip(_clippingArea); - drawRect.moveTo(0, 0); + drawRect.translate(-p.x, -p.y); if (drawRect.isEmpty()) { return; } + if (!_clippingArea.contains(p)) { + int16 nx = CLIP(p.x, _clippingArea.left, _clippingArea.right); + int16 ny = CLIP(p.y, _clippingArea.top, _clippingArea.bottom); + np = Common::Point(nx, ny); + } + else { + np = p; + } if (themeTrans) - _activeSurface->transBlitFrom(*source, drawRect, p, _bitmapAlphaColor); + _activeSurface->transBlitFrom(*source, drawRect, np, _bitmapAlphaColor); else - _activeSurface->blitFrom(*source, drawRect, p); + _activeSurface->blitFrom(*source, drawRect, np); } template