From 1779d653f359b1a4943e1e0cb4038b7dd3325552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ximo=20Casta=C3=B1eda?= Date: Sat, 8 Oct 2022 17:14:25 +0200 Subject: [PATCH] GraphicsContext: fix clipBounds Transform gives the affine transform of the local drawing state, which may not be enough when we have several states stacked. We also need all four rectangle corners in case of rotations. Fixes the problems in https://dev.haiku-os.org/ticket/17305 for SVG. The ones with transparency layers have different cause. --- .../graphics/haiku/GraphicsContextHaiku.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/Source/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp index 7016e6284e65..7cbb447fef31 100644 --- a/Source/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp +++ b/Source/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp @@ -724,17 +724,19 @@ IntRect GraphicsContextHaiku::clipBounds() const m_view->GetClippingRegion(®ion); BRect rect = region.Frame(); - BPoint points[2]; + BPoint points[4]; points[0] = rect.LeftTop(); points[1] = rect.RightBottom(); + points[2] = rect.LeftBottom(); + points[3] = rect.RightTop(); - BAffineTransform t = m_view->Transform(); - t.ApplyInverse(points, 2); + BAffineTransform t = m_view->TransformTo(B_VIEW_COORDINATES); + t.ApplyInverse(points, 4); - rect.left = std::min(points[0].x, points[1].x); - rect.right = std::max(points[0].x, points[1].x); - rect.top = std::min(points[0].y, points[1].y); - rect.bottom = std::max(points[0].y, points[1].y); + rect.left = std::min({points[0].x, points[1].x, points[2].x, points[3].x}); + rect.right = std::max({points[0].x, points[1].x, points[2].x, points[3].x}); + rect.top = std::min({points[0].y, points[1].y, points[2].y, points[3].y}); + rect.bottom = std::max({points[0].y, points[1].y, points[2].y, points[3].y}); return IntRect(rect); }