mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 09:18:11 +02:00
[PS/PDF] Accept CAIRO_EXTEND_REFLECT surface patterns natively
With the hack in _cairo_pattern_acquire_surface to return a 2x2 surface for reflected patterns, we can now accept REFLECT surface patterns natively in all backends. SVG was already doing that. The PDF case needed some changes to go through _cairo_pattern_acquire_surface. A similar change to the recent change in SVG.
This commit is contained in:
parent
3405fb870e
commit
7c39276366
2 changed files with 17 additions and 6 deletions
|
|
@ -870,6 +870,8 @@ emit_surface_pattern (cairo_pdf_surface_t *surface,
|
|||
cairo_surface_pattern_t *pattern)
|
||||
{
|
||||
cairo_pdf_resource_t stream;
|
||||
cairo_surface_t *pat_surface;
|
||||
cairo_surface_attributes_t pat_attr;
|
||||
cairo_image_surface_t *image;
|
||||
void *image_extra;
|
||||
cairo_status_t status = CAIRO_STATUS_SUCCESS;
|
||||
|
|
@ -883,10 +885,17 @@ emit_surface_pattern (cairo_pdf_surface_t *surface,
|
|||
|
||||
_cairo_pdf_surface_pause_content_stream (surface);
|
||||
|
||||
status = _cairo_surface_acquire_source_image (pattern->surface, &image, &image_extra);
|
||||
status = _cairo_pattern_acquire_surface ((cairo_pattern_t *)pattern,
|
||||
(cairo_surface_t *)surface,
|
||||
0, 0, -1, -1,
|
||||
&pat_surface, &pat_attr);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
status = _cairo_surface_acquire_source_image (pat_surface, &image, &image_extra);
|
||||
if (status)
|
||||
goto BAIL2;
|
||||
|
||||
status = emit_image (surface, image, &image_resource);
|
||||
if (status)
|
||||
goto BAIL;
|
||||
|
|
@ -929,12 +938,12 @@ emit_surface_pattern (cairo_pdf_surface_t *surface,
|
|||
}
|
||||
break;
|
||||
case CAIRO_EXTEND_REPEAT:
|
||||
case CAIRO_EXTEND_REFLECT:
|
||||
xstep = image->width;
|
||||
ystep = image->height;
|
||||
break;
|
||||
/* All the rest should have been analyzed away, so this case
|
||||
* should be unreachable. */
|
||||
case CAIRO_EXTEND_REFLECT:
|
||||
case CAIRO_EXTEND_PAD:
|
||||
default:
|
||||
ASSERT_NOT_REACHED;
|
||||
|
|
@ -1018,7 +1027,9 @@ emit_surface_pattern (cairo_pdf_surface_t *surface,
|
|||
stream.id, stream.id, alpha.id);
|
||||
|
||||
BAIL:
|
||||
_cairo_surface_release_source_image (pattern->surface, image, image_extra);
|
||||
_cairo_surface_release_source_image (pat_surface, image, image_extra);
|
||||
BAIL2:
|
||||
_cairo_pattern_release_surface ((cairo_pattern_t *)pattern, pat_surface, &pat_attr);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
@ -2559,8 +2570,8 @@ _surface_pattern_supported (cairo_surface_pattern_t *pattern)
|
|||
switch (extend) {
|
||||
case CAIRO_EXTEND_NONE:
|
||||
case CAIRO_EXTEND_REPEAT:
|
||||
return TRUE;
|
||||
case CAIRO_EXTEND_REFLECT:
|
||||
return TRUE;
|
||||
case CAIRO_EXTEND_PAD:
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1355,8 +1355,8 @@ surface_pattern_supported (const cairo_surface_pattern_t *pattern)
|
|||
switch (extend) {
|
||||
case CAIRO_EXTEND_NONE:
|
||||
case CAIRO_EXTEND_REPEAT:
|
||||
return TRUE;
|
||||
case CAIRO_EXTEND_REFLECT:
|
||||
return TRUE;
|
||||
case CAIRO_EXTEND_PAD:
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1759,12 +1759,12 @@ emit_surface_pattern (cairo_ps_surface_t *surface,
|
|||
ystep = MAX (image->height, surface->height);
|
||||
break;
|
||||
case CAIRO_EXTEND_REPEAT:
|
||||
case CAIRO_EXTEND_REFLECT:
|
||||
xstep = image->width;
|
||||
ystep = image->height;
|
||||
break;
|
||||
/* All the rest should have been analyzed away, so these cases
|
||||
* should be unreachable. */
|
||||
case CAIRO_EXTEND_REFLECT:
|
||||
case CAIRO_EXTEND_PAD:
|
||||
default:
|
||||
ASSERT_NOT_REACHED;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue