diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 12d0e3b0d..4038f309c 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -244,6 +244,19 @@ _cairo_pdf_surface_set_size_internal (cairo_pdf_surface_t *surface, &surface->cairo_to_pdf); } +static cairo_bool_t +_path_covers_bbox (cairo_pdf_surface_t *surface, + cairo_path_fixed_t *path) +{ + cairo_box_t box; + + return _cairo_path_fixed_is_rectangle (path, &box) && + box.p1.x <= 0 && + box.p1.y <= 0 && + box.p2.x >= _cairo_fixed_from_double (surface->width) && + box.p2.y >= _cairo_fixed_from_double (surface->height); +} + static cairo_status_t _cairo_pdf_surface_clipper_intersect_clip_path (cairo_surface_clipper_t *clipper, cairo_path_fixed_t *path, @@ -269,6 +282,9 @@ _cairo_pdf_surface_clipper_intersect_clip_path (cairo_surface_clipper_t *clipper return CAIRO_STATUS_SUCCESS; } + if (_path_covers_bbox (surface, path)) + return CAIRO_STATUS_SUCCESS; + return _cairo_pdf_operators_clip (&surface->pdf_operators, path, fill_rule); } diff --git a/test/meta-surface-pattern.pdf.argb32.ref.png b/test/meta-surface-pattern.pdf.argb32.ref.png index 786587c3f..043322280 100644 Binary files a/test/meta-surface-pattern.pdf.argb32.ref.png and b/test/meta-surface-pattern.pdf.argb32.ref.png differ diff --git a/test/meta-surface-pattern.pdf.rgb24.ref.png b/test/meta-surface-pattern.pdf.rgb24.ref.png index f542dabf2..b59a9caf8 100644 Binary files a/test/meta-surface-pattern.pdf.rgb24.ref.png and b/test/meta-surface-pattern.pdf.rgb24.ref.png differ diff --git a/test/scale-offset-image.pdf.xfail.png b/test/scale-offset-image.pdf.xfail.png index 4c7fe2831..3eacbbc86 100644 Binary files a/test/scale-offset-image.pdf.xfail.png and b/test/scale-offset-image.pdf.xfail.png differ diff --git a/test/scale-offset-similar.pdf.xfail.png b/test/scale-offset-similar.pdf.xfail.png index 4b600f4c9..7808aeb9a 100644 Binary files a/test/scale-offset-similar.pdf.xfail.png and b/test/scale-offset-similar.pdf.xfail.png differ