File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed 
Userland/Libraries/LibPDF Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -415,6 +415,12 @@ PDFErrorOr<void> Renderer::restore_previous_clip_after_graphics_state_restore()
415415void  Renderer::begin_path_paint ()
416416{
417417    m_current_path.transform (state ().ctm );
418+     if  (state ().paint_style .has <NonnullRefPtr<Gfx::PaintStyle>>()) {
419+         VERIFY (!m_original_paint_style);
420+         m_original_paint_style = state ().paint_style .get <NonnullRefPtr<Gfx::PaintStyle>>();
421+         auto  translation = Gfx::AffineTransform ().translate (m_current_path.bounding_box ().x (), m_current_path.bounding_box ().y ());
422+         state ().paint_style  = { MUST (Gfx::OffsetPaintStyle::create (state ().paint_style .get <NonnullRefPtr<Gfx::PaintStyle>>(), translation)) };
423+     }
418424}
419425
420426PDFErrorOr<void > Renderer::end_path_paint ()
@@ -424,6 +430,11 @@ PDFErrorOr<void> Renderer::end_path_paint()
424430        m_add_path_as_clip = AddPathAsClip::No;
425431    }
426432
433+     if  (m_original_paint_style) {
434+         state ().paint_style  = m_original_paint_style.release_nonnull ();
435+         m_original_paint_style = nullptr ;
436+     }
437+ 
427438    //  "Once a path has been painted, it is no longer defined; there is then no current path
428439    //   until a new one is begun with the m or re operator."
429440    m_current_path.clear ();
Original file line number Diff line number Diff line change @@ -293,6 +293,8 @@ class Renderer {
293293    //  Only used for m_rendering_preferences.show_clipping_paths.
294294    void  show_clipping_paths ();
295295    Vector<Gfx::Path> m_clip_paths_to_show_for_debugging;
296+     //  Used to offset the PaintStyle's origin when rendering a pattern.
297+     RefPtr<Gfx::PaintStyle> m_original_paint_style;
296298};
297299
298300}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments