[cairo-commit] ROADMAP src/cairo-pattern.c
Carl Worth
cworth at kemper.freedesktop.org
Fri Jan 26 18:03:54 PST 2007
ROADMAP | 2 +-
src/cairo-pattern.c | 21 +++++++++++++++------
2 files changed, 16 insertions(+), 7 deletions(-)
New commits:
diff-tree a63ceef06c2c015c8e5f0ad7b756ff6801996096 (from ebc1cd91f80ee154c02651b2db034a4335ca021c)
Author: Carl Worth <cworth at cworth.org>
Date: Fri Jan 26 18:03:18 2007 -0800
Fix _cairo_pattern_acquire_surface_for_surface to not clone outside surface extents
Rotation and other transformations would cause extents to be
computed which were outside the bounds of the surface to be
cloned, (and for non repeating patterns). Now we simply
restrict the computed extents to the surface extents.
This fixes the xlib failure of the recent rotate-image-surface-paint
test, (the apparently distinct ps failure remains).
diff --git a/ROADMAP b/ROADMAP
index 06aa816..f2ce1bd 100644
--- a/ROADMAP
+++ b/ROADMAP
@@ -39,7 +39,7 @@ cairo-1.4 (January 2006): Better perform
cairo 1.3.14
============
Bugs to fix:
- "issue with rotated image sources" from Benjamin Otte on mailing list
+ â "issue with rotated image sources" from Benjamin Otte on mailing list
"Problem with linear gradients and reflect mode post-rewrite" from T Rowley on list
8801 text rendering lacking locking in multithreaded apps
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index b488d1f..35c0739 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1159,10 +1159,13 @@ _cairo_pattern_acquire_surface_for_surfa
}
else
{
+ cairo_rectangle_int16_t extents;
+ status = _cairo_surface_get_extents (pattern->surface, &extents);
+ if (status)
+ return status;
+
/* If we're repeating, we just play it safe and clone the entire surface. */
if (attr->extend == CAIRO_EXTEND_REPEAT) {
- cairo_rectangle_int16_t extents;
- status = _cairo_surface_get_extents (pattern->surface, &extents);
x = extents.x;
y = extents.y;
width = extents.width;
@@ -1182,10 +1185,16 @@ _cairo_pattern_acquire_surface_for_surfa
_cairo_matrix_transform_bounding_box (&attr->matrix,
&x1, &y1, &x2, &y2,
&is_tight);
- x = floor (x1);
- y = floor (y1);
- width = ceil (x2) - x;
- height = ceil (y2) - y;
+
+ /* The transform_bounding_box call may have resulted
+ * in a region larger than the surface, but we never
+ * want to clone more than the surface itself, (we
+ * know we're not repeating at this point due to the
+ * above. */
+ x = MAX (0, floor (x1));
+ y = MAX (0, floor (y1));
+ width = MIN (extents.width, ceil (x2)) - x;
+ height = MIN (extents.height, ceil (y2)) - y;
}
x += tx;
y += ty;
More information about the cairo-commit
mailing list