diff options
author | Andrea Canciani <ranma42@gmail.com> | 2012-01-07 16:19:43 +0100 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2012-01-15 18:25:57 +0100 |
commit | a2f419b546f620ede105b5a6b5958260925d9a50 (patch) | |
tree | ac4cb54ec107f59ad1388e06cfd2c66b28791053 /src/cairo-pattern.c | |
parent | 2808bf5b95e84f3a4d8ee7b56c340860d0348a8a (diff) | |
download | cairo-a2f419b546f620ede105b5a6b5958260925d9a50.tar.gz |
rectangle: Implement _cairo_rectangle_contains_rectangle()
And reuse it.
Diffstat (limited to 'src/cairo-pattern.c')
-rw-r--r-- | src/cairo-pattern.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 41d7384ec..ea47b6a33 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -3143,17 +3143,10 @@ _surface_is_opaque (const cairo_surface_pattern_t *pattern, if (! _cairo_surface_get_extents (pattern->surface, &extents)) return TRUE; - if (sample != NULL) { - if (sample->x >= extents.x && - sample->y >= extents.y && - sample->x + sample->width <= extents.x + extents.width && - sample->y + sample->height <= extents.y + extents.height) - { - return TRUE; - } - } + if (sample == NULL) + return FALSE; - return FALSE; + return _cairo_rectangle_contains_rectangle (&extents, sample); } static cairo_bool_t @@ -3166,17 +3159,10 @@ _raster_source_is_opaque (const cairo_raster_source_pattern_t *pattern, if (pattern->base.extend != CAIRO_EXTEND_NONE) return TRUE; - if (sample != NULL) { - if (sample->x >= pattern->extents.x && - sample->y >= pattern->extents.y && - sample->x + sample->width <= pattern->extents.x + pattern->extents.width && - sample->y + sample->height <= pattern->extents.y + pattern->extents.height) - { - return TRUE; - } - } + if (sample == NULL) + return FALSE; - return FALSE; + return _cairo_rectangle_contains_rectangle (&pattern->extents, sample); } static cairo_bool_t |