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 @@ -293,6 +293,12 @@ RENDERER_HANDLER(path_append_rect)
293293
294294void Renderer::begin_path_paint ()
295295{
296+ if (state ().paint_style .has <NonnullRefPtr<Gfx::PaintStyle>>()) {
297+ VERIFY (!m_original_paint_style);
298+ m_original_paint_style = state ().paint_style .get <NonnullRefPtr<Gfx::PaintStyle>>();
299+ auto translation = Gfx::AffineTransform ().translate (m_current_path.bounding_box ().x (), m_current_path.bounding_box ().y ());
300+ state ().paint_style = { MUST (Gfx::OffsetPaintStyle::create (state ().paint_style .get <NonnullRefPtr<Gfx::PaintStyle>>(), translation)) };
301+ }
296302 auto bounding_box = state ().clipping_paths .current .bounding_box ();
297303 m_painter.clear_clip_rect ();
298304 if (m_rendering_preferences.show_clipping_paths ) {
@@ -306,6 +312,11 @@ void Renderer::end_path_paint()
306312 m_current_path.clear ();
307313 m_painter.clear_clip_rect ();
308314 state ().clipping_paths .current = state ().clipping_paths .next ;
315+
316+ if (m_original_paint_style) {
317+ state ().paint_style = m_original_paint_style.release_nonnull ();
318+ m_original_paint_style = nullptr ;
319+ }
309320}
310321
311322RENDERER_HANDLER (path_stroke)
Original file line number Diff line number Diff line change @@ -173,6 +173,8 @@ class Renderer {
173173 Gfx::AffineTransform mutable m_text_rendering_matrix;
174174
175175 HashMap<FontCacheKey, NonnullRefPtr<PDFFont>> m_font_cache;
176+ // Used to offset the PaintStyle's origin when rendering a pattern.
177+ RefPtr<Gfx::PaintStyle> m_original_paint_style;
176178};
177179
178180}
You can’t perform that action at this time.
0 commit comments