[cairo] [PATCH 1/4] image: _cairo_image_surface_fixup_unbounded_boxes() bug fix
Taekyun Kim
podain77 at gmail.com
Tue Jul 5 00:17:54 PDT 2011
From: Taekyun Kim <tkq.kim at samsung.com>
Even if boxes contains zero or single boxes, we cannot assume
that extents->bounded is tight. So we have to make extents tight
before giving it to _cairo_image_surface_fixup_unbounded().
---
src/cairo-image-surface.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index a2345b2..21ede2c 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1778,8 +1778,30 @@ _cairo_image_surface_fixup_unbounded_boxes (cairo_image_surface_t *dst,
struct _cairo_boxes_chunk *chunk;
int i;
- if (boxes->num_boxes <= 1 && clip_region == NULL)
- return _cairo_image_surface_fixup_unbounded (dst, extents, NULL);
+ if (clip_region == NULL) {
+ cairo_composite_rectangles_t tight_extents;
+
+ if (boxes->num_boxes == 0) {
+ tight_extents = *extents;
+ tight_extents.bounded.x = 0;
+ tight_extents.bounded.y = 0;
+ tight_extents.bounded.width = 0;
+ tight_extents.bounded.height = 0;
+
+ return _cairo_image_surface_fixup_unbounded (dst, &tight_extents, NULL);
+ } else if (boxes->num_boxes == 1) {
+ box = boxes->chunks.base[0];
+ tight_extents = *extents;
+ tight_extents.bounded.x = _cairo_fixed_integer_round_down(box.p1.x);
+ tight_extents.bounded.y = _cairo_fixed_integer_round_down(box.p1.y);
+ tight_extents.bounded.width =
+ _cairo_fixed_integer_round_down(box.p2.x) - tight_extents.bounded.x;
+ tight_extents.bounded.height =
+ _cairo_fixed_integer_round_down(box.p2.y) - tight_extents.bounded.y;
+
+ return _cairo_image_surface_fixup_unbounded (dst, &tight_extents, NULL);
+ }
+ }
_cairo_boxes_init (&clear);
--
1.7.1
More information about the cairo
mailing list