mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 06:28:01 +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.
This commit is contained in:
parent
6fecbb000d
commit
7a17ef3176
1 changed files with 14 additions and 1 deletions
|
|
@ -1204,6 +1204,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,
|
||||
|
|
@ -1237,7 +1249,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