Browse Source

LibPDF: Ensure all subpaths are closed before filling paths

This lets us correctly draw figure 3.4 in pdf_reference_1-7.pdf.
MacDue 2 years ago
parent
commit
6088374ad2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Userland/Libraries/LibPDF/Renderer.cpp

+ 2 - 0
Userland/Libraries/LibPDF/Renderer.cpp

@@ -298,6 +298,7 @@ RENDERER_HANDLER(path_close_and_stroke)
 RENDERER_HANDLER(path_fill_nonzero)
 RENDERER_HANDLER(path_fill_nonzero)
 {
 {
     begin_path_paint();
     begin_path_paint();
+    m_current_path.close_all_subpaths();
     m_anti_aliasing_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);
     end_path_paint();
     end_path_paint();
     return {};
     return {};
@@ -311,6 +312,7 @@ RENDERER_HANDLER(path_fill_nonzero_deprecated)
 RENDERER_HANDLER(path_fill_evenodd)
 RENDERER_HANDLER(path_fill_evenodd)
 {
 {
     begin_path_paint();
     begin_path_paint();
+    m_current_path.close_all_subpaths();
     m_anti_aliasing_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);
     end_path_paint();
     end_path_paint();
     return {};
     return {};