[pattern] Pass flags to _cairo_pattern_acquire_surface()

Allow the caller to choose whether or not various conversions take place.
The first flag is used to disable the expansion of reflected patterns into a
repeating surface.
This commit is contained in:
Chris Wilson 2009-05-28 14:16:58 +01:00
parent 4ec451a2fa
commit 51193f1610
7 changed files with 31 additions and 2 deletions

View file

@ -766,6 +766,7 @@ _directfb_prepare_composite (cairo_directfb_surface_t *dst,
status = _cairo_pattern_acquire_surface (src_pattern, &dst->base,
CAIRO_CONTENT_COLOR_ALPHA,
*src_x, *src_y, width, height,
CAIRO_PATTERN_ACQUIRE_NO_REFLECT,
(cairo_surface_t **) &src,
&src_attr);
if (status)

View file

@ -719,6 +719,7 @@ _cairo_glitz_pattern_acquire_surface (const cairo_pattern_t *pattern,
status = _cairo_pattern_acquire_surface (pattern, &dst->base,
CAIRO_CONTENT_COLOR_ALPHA,
x, y, width, height,
CAIRO_PATTERN_ACQUIRE_NONE,
(cairo_surface_t **) &src,
&attr->base);
if (status)

View file

@ -967,6 +967,7 @@ _cairo_image_surface_composite (cairo_operator_t op,
src_x, src_y,
mask_x, mask_y,
width, height,
CAIRO_PATTERN_ACQUIRE_NONE,
(cairo_surface_t **) &src,
(cairo_surface_t **) &mask,
&src_attr, &mask_attr);
@ -1171,6 +1172,7 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op,
status = _cairo_pattern_acquire_surface (pattern, &dst->base,
CAIRO_CONTENT_COLOR_ALPHA,
src_x, src_y, width, height,
CAIRO_PATTERN_ACQUIRE_NONE,
(cairo_surface_t **) &src,
&attributes);
if (unlikely (status))
@ -1402,6 +1404,7 @@ _cairo_image_surface_create_span_renderer (cairo_operator_t op,
CAIRO_CONTENT_COLOR_ALPHA,
rects->src.x, rects->src.y,
width, height,
CAIRO_PATTERN_ACQUIRE_NONE,
(cairo_surface_t **) &renderer->src,
&renderer->src_attributes);
if (status)

View file

@ -1794,6 +1794,7 @@ _cairo_pattern_acquire_surface_for_surface (const cairo_surface_pattern_t *pat
int y,
unsigned int width,
unsigned int height,
unsigned int flags,
cairo_surface_t **out,
cairo_surface_attributes_t *attr)
{
@ -1855,7 +1856,9 @@ _cairo_pattern_acquire_surface_for_surface (const cairo_surface_pattern_t *pat
* images such that the new image, when repeated, has the same effect
* of reflecting the original pattern.
*/
if (attr->extend == CAIRO_EXTEND_REFLECT) {
if (flags & CAIRO_PATTERN_ACQUIRE_NO_REFLECT &&
attr->extend == CAIRO_EXTEND_REFLECT)
{
cairo_t *cr;
cairo_surface_t *src;
int w, h;
@ -2081,6 +2084,7 @@ _cairo_pattern_acquire_surface (const cairo_pattern_t *pattern,
int y,
unsigned int width,
unsigned int height,
unsigned int flags,
cairo_surface_t **surface_out,
cairo_surface_attributes_t *attributes)
{
@ -2170,7 +2174,9 @@ _cairo_pattern_acquire_surface (const cairo_pattern_t *pattern,
status = _cairo_pattern_acquire_surface_for_surface (src, dst,
content,
x, y, width, height,
x, y,
width, height,
flags,
surface_out,
attributes);
} break;
@ -2209,6 +2215,7 @@ _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src,
int mask_y,
unsigned int width,
unsigned int height,
unsigned int flags,
cairo_surface_t **src_out,
cairo_surface_t **mask_out,
cairo_surface_attributes_t *src_attributes,
@ -2249,6 +2256,7 @@ _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src,
src_content,
src_x, src_y,
width, height,
flags,
src_out, src_attributes);
if (unlikely (status))
goto BAIL;
@ -2262,6 +2270,7 @@ _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src,
CAIRO_CONTENT_ALPHA,
mask_x, mask_y,
width, height,
flags,
mask_out, mask_attributes);
if (unlikely (status))
_cairo_pattern_release_surface (src, *src_out, src_attributes);

View file

@ -1124,6 +1124,7 @@ _cairo_xcb_surface_composite (cairo_operator_t op,
src_x, src_y,
mask_x, mask_y,
width, height,
CAIRO_PATTERN_ACQUIRE_NO_REFLECT,
(cairo_surface_t **) &src,
(cairo_surface_t **) &mask,
&src_attr, &mask_attr);
@ -1411,6 +1412,7 @@ _cairo_xcb_surface_composite_trapezoids (cairo_operator_t op,
status = _cairo_pattern_acquire_surface (pattern, &dst->base,
CAIRO_CONTENT_COLOR_ALPHA,
src_x, src_y, width, height,
CAIRO_PATTERN_ACQUIRE_NO_REFLECT,
(cairo_surface_t **) &src,
&attributes);
if (status)
@ -2504,6 +2506,7 @@ _cairo_xcb_surface_show_glyphs (void *abstract_dst,
status = _cairo_pattern_acquire_surface (src_pattern, &dst->base,
CAIRO_CONTENT_COLOR_ALPHA,
0, 0, 1, 1,
CAIRO_PATTERN_ACQUIRE_NONE,
(cairo_surface_t **) &src,
&attributes);
} else {
@ -2520,6 +2523,7 @@ _cairo_xcb_surface_show_glyphs (void *abstract_dst,
CAIRO_CONTENT_COLOR_ALPHA,
glyph_extents.x, glyph_extents.y,
glyph_extents.width, glyph_extents.height,
CAIRO_PATTERN_ACQUIRE_NO_REFLECT,
(cairo_surface_t **) &src,
&attributes);
}

View file

@ -1752,6 +1752,7 @@ _cairo_xlib_surface_composite (cairo_operator_t op,
src_x, src_y,
mask_x, mask_y,
width, height,
CAIRO_PATTERN_ACQUIRE_NO_REFLECT,
(cairo_surface_t **) &src,
(cairo_surface_t **) &mask,
&src_attr, &mask_attr);
@ -1914,6 +1915,7 @@ _cairo_xlib_surface_solid_fill_rectangles (cairo_xlib_surface_t *surface,
0, 0,
ARRAY_LENGTH (dither_pattern[0]),
ARRAY_LENGTH (dither_pattern),
CAIRO_PATTERN_ACQUIRE_NONE,
&solid_surface,
&attrs);
if (unlikely (status))
@ -2163,6 +2165,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op,
status = _cairo_pattern_acquire_surface (pattern, &dst->base,
CAIRO_CONTENT_COLOR_ALPHA,
src_x, src_y, width, height,
CAIRO_PATTERN_ACQUIRE_NO_REFLECT,
(cairo_surface_t **) &src,
&attributes);
if (unlikely (status))
@ -4093,6 +4096,7 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst,
status = _cairo_pattern_acquire_surface (src_pattern, &dst->base,
CAIRO_CONTENT_COLOR_ALPHA,
0, 0, 1, 1,
CAIRO_PATTERN_ACQUIRE_NONE,
(cairo_surface_t **) &src,
&attributes);
if (unlikely (status))
@ -4111,6 +4115,7 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst,
CAIRO_CONTENT_COLOR_ALPHA,
glyph_extents.x, glyph_extents.y,
glyph_extents.width, glyph_extents.height,
CAIRO_PATTERN_ACQUIRE_NO_REFLECT,
(cairo_surface_t **) &src,
&attributes);
if (unlikely (status))

View file

@ -2491,6 +2491,10 @@ _cairo_pattern_is_opaque_solid (const cairo_pattern_t *pattern);
cairo_private cairo_bool_t
_cairo_pattern_is_opaque (const cairo_pattern_t *abstract_pattern);
enum {
CAIRO_PATTERN_ACQUIRE_NONE = 0x0,
CAIRO_PATTERN_ACQUIRE_NO_REFLECT = 0x1,
};
cairo_private cairo_int_status_t
_cairo_pattern_acquire_surface (const cairo_pattern_t *pattern,
cairo_surface_t *dst,
@ -2499,6 +2503,7 @@ _cairo_pattern_acquire_surface (const cairo_pattern_t *pattern,
int y,
unsigned int width,
unsigned int height,
unsigned int flags,
cairo_surface_t **surface_out,
cairo_surface_attributes_t *attributes);
@ -2518,6 +2523,7 @@ _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src,
int mask_y,
unsigned int width,
unsigned int height,
unsigned int flags,
cairo_surface_t **src_out,
cairo_surface_t **mask_out,
cairo_surface_attributes_t *src_attributes,