diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index ed280c4afb..bb180f26e9 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -31,6 +31,7 @@ Renderer::Renderer(RefPtr document, Page const& page, RefPtrheight() - pos.y() - size.height()); + m_current_path.move_to(pos); m_current_path.line_to({ pos.x() + size.width(), pos.y() }); m_current_path.line_to({ pos.x() + size.width(), pos.y() + size.height() }); @@ -217,7 +223,7 @@ RENDERER_HANDLER(path_append_rect) RENDERER_HANDLER(path_stroke) { - m_painter.stroke_path(m_current_path, state().stroke_color, state().line_width); + m_anti_aliasing_painter.stroke_path(m_current_path, state().stroke_color, state().line_width); m_current_path.clear(); return {}; } @@ -231,7 +237,7 @@ RENDERER_HANDLER(path_close_and_stroke) RENDERER_HANDLER(path_fill_nonzero) { - m_painter.fill_path(m_current_path, state().paint_color, Gfx::Painter::WindingRule::Nonzero); + m_anti_aliasing_painter.fill_path(m_current_path, state().paint_color, Gfx::Painter::WindingRule::Nonzero); m_current_path.clear(); return {}; } @@ -244,21 +250,21 @@ RENDERER_HANDLER(path_fill_nonzero_deprecated) RENDERER_HANDLER(path_fill_evenodd) { - m_painter.fill_path(m_current_path, state().paint_color, Gfx::Painter::WindingRule::EvenOdd); + m_anti_aliasing_painter.fill_path(m_current_path, state().paint_color, Gfx::Painter::WindingRule::EvenOdd); m_current_path.clear(); return {}; } RENDERER_HANDLER(path_fill_stroke_nonzero) { - m_painter.stroke_path(m_current_path, state().stroke_color, state().line_width); + m_anti_aliasing_painter.stroke_path(m_current_path, state().stroke_color, state().line_width); TRY(handle_path_fill_nonzero(args)); return {}; } RENDERER_HANDLER(path_fill_stroke_evenodd) { - m_painter.stroke_path(m_current_path, state().stroke_color, state().line_width); + m_anti_aliasing_painter.stroke_path(m_current_path, state().stroke_color, state().line_width); TRY(handle_path_fill_evenodd(args)); return {}; } diff --git a/Userland/Libraries/LibPDF/Renderer.h b/Userland/Libraries/LibPDF/Renderer.h index 3a57c866d1..cccc83fb36 100644 --- a/Userland/Libraries/LibPDF/Renderer.h +++ b/Userland/Libraries/LibPDF/Renderer.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -121,6 +122,7 @@ private: RefPtr m_bitmap; Page const& m_page; Gfx::Painter m_painter; + Gfx::AntiAliasingPainter m_anti_aliasing_painter; Gfx::Path m_current_path; Vector m_graphics_state_stack;