From e8fe2f4ffeeb863bdb616a96ae36c0524a9a2f65 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 6 Jul 2024 20:11:00 +0100 Subject: [PATCH] LibPDF: Use `draw_rect()` to show debug clipping rects Using the path rasterizer here is much slower than simply drawing four lines. This also more accurately shows the (real) clip as the bounding box is truncated to an int before adding it as a clip rect. Fixes #23056 --- Userland/Libraries/LibPDF/Renderer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index 0b24f2a4eb2043..7b2796416e7c74 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -305,12 +305,12 @@ RENDERER_HANDLER(path_append_rect) void Renderer::activate_clip() { - auto bounding_box = state().clipping_paths.current.bounding_box(); + auto bounding_box = state().clipping_paths.current.bounding_box().to_type(); m_painter.clear_clip_rect(); if (m_rendering_preferences.show_clipping_paths) { - m_painter.stroke_path(rect_path(bounding_box), Color::Black, 1); + m_painter.draw_rect(bounding_box, Color::Black); } - m_painter.add_clip_rect(bounding_box.to_type()); + m_painter.add_clip_rect(bounding_box); } void Renderer::deactivate_clip()