[cairo] [PATCH 2/4] image: _cairo_image_surface_fixup_unbounded_boxes() proper handling of unaligned boxes

Taekyun Kim podain77 at gmail.com
Tue Jul 5 00:17:55 PDT 2011


From: Taekyun Kim <tkq.kim at samsung.com>

Input boxes might be unaligned, so we have to round down coordinates
rather than just discarding fractional part.
---
 src/cairo-image-surface.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 21ede2c..92223fc 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1853,10 +1853,10 @@ _cairo_image_surface_fixup_unbounded_boxes (cairo_image_surface_t *dst,
     if (likely (status == CAIRO_STATUS_SUCCESS)) {
 	for (chunk = &clear.chunks; chunk != NULL; chunk = chunk->next) {
 	    for (i = 0; i < chunk->count; i++) {
-		int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x);
-		int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y);
-		int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x);
-		int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y);
+		int x1 = _cairo_fixed_integer_round_down (chunk->base[i].p1.x);
+		int y1 = _cairo_fixed_integer_round_down (chunk->base[i].p1.y);
+		int x2 = _cairo_fixed_integer_round_down (chunk->base[i].p2.x);
+		int y2 = _cairo_fixed_integer_round_down (chunk->base[i].p2.y);
 
 		pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
 			     PIXMAN_FORMAT_BPP (dst->pixman_format),
-- 
1.7.1



More information about the cairo mailing list