mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-02 03:48:00 +02:00
PDF: Fix regression in EXTEND_NONE gradients
The test for opaque gradients in _cairo_pdf_surface_add_pdf_pattern()
must be identical to the test in
_cairo_pdf_surface_emit_pattern_stops() other wise the PDF file will
reference a smask that does not exist.
The _cairo_pattern_is_opaque() test is too strict for PDF as PDF can
draw EXTEND_NONE gradients with opaque color stops without requiring a
smask.
(cherry picked from commit 7a17ef3176)
This commit is contained in:
parent
7450a3c8a7
commit
f747ea81fb
1 changed files with 14 additions and 1 deletions
|
|
@ -1202,6 +1202,18 @@ _cairo_pdf_surface_add_source_surface (cairo_pdf_surface_t *surface,
|
|||
return status;
|
||||
}
|
||||
|
||||
static cairo_bool_t
|
||||
_gradient_stops_are_opaque (const cairo_gradient_pattern_t *gradient)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < gradient->n_stops; i++)
|
||||
if (! CAIRO_COLOR_IS_OPAQUE (&gradient->stops[i].color))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_pdf_surface_add_pdf_pattern (cairo_pdf_surface_t *surface,
|
||||
const cairo_pattern_t *pattern,
|
||||
|
|
@ -1235,7 +1247,8 @@ _cairo_pdf_surface_add_pdf_pattern (cairo_pdf_surface_t *surface,
|
|||
if (pattern->type == CAIRO_PATTERN_TYPE_LINEAR ||
|
||||
pattern->type == CAIRO_PATTERN_TYPE_RADIAL)
|
||||
{
|
||||
if (_cairo_pattern_is_opaque (pattern, extents) == FALSE) {
|
||||
cairo_gradient_pattern_t *gradient = (cairo_gradient_pattern_t *) pattern;
|
||||
if (! _gradient_stops_are_opaque (gradient)) {
|
||||
pdf_pattern.gstate_res = _cairo_pdf_surface_new_object (surface);
|
||||
if (pdf_pattern.gstate_res.id == 0) {
|
||||
cairo_pattern_destroy (pdf_pattern.pattern);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue