image: Fix compositing of unaligned boxes

The input of _fill_unaligned_boxes is (supposed to be) composed only
of disjoint rectangles, that can safely be passed to the rectilinear
span converter, but this function artificially introduces intersecting
rectangles when drawing non-aligned boxes.

Using non-intersecting rectangles is easy and makes the code correct.

Fixes rectilinear-grid.

Reviewed-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Andrea Canciani 2010-11-28 14:32:51 +01:00
parent 7b29f1d5d8
commit ff35af3fd7

View file

@ -2692,7 +2692,13 @@ _fill_unaligned_boxes (cairo_image_surface_t *dst,
x1, y1, x2 - x1, y2 - y1,
pixel);
/* top */
/*
* Corners have to be included only once if the rects
* are passed to the rectangular scan converter
* because it can only handle disjoint rectangles.
*/
/* top (including top-left and top-right corners) */
if (! _cairo_fixed_is_integer (box[i].p1.y)) {
b.p1.x = box[i].p1.x;
b.p1.y = box[i].p1.y;
@ -2704,31 +2710,31 @@ _fill_unaligned_boxes (cairo_image_surface_t *dst,
goto CLEANUP_CONVERTER;
}
/* left */
/* left (no corners) */
if (! _cairo_fixed_is_integer (box[i].p1.x)) {
b.p1.x = box[i].p1.x;
b.p1.y = box[i].p1.y;
b.p1.y = _cairo_fixed_from_int (y1);
b.p2.x = _cairo_fixed_from_int (x1);
b.p2.y = box[i].p2.y;
b.p2.y = _cairo_fixed_from_int (y2);
status = _cairo_rectangular_scan_converter_add_box (&converter, &b, 1);
if (unlikely (status))
goto CLEANUP_CONVERTER;
}
/* right */
/* right (no corners) */
if (! _cairo_fixed_is_integer (box[i].p2.x)) {
b.p1.x = _cairo_fixed_from_int (x2);
b.p1.y = box[i].p1.y;
b.p1.y = _cairo_fixed_from_int (y1);
b.p2.x = box[i].p2.x;
b.p2.y = box[i].p2.y;
b.p2.y = _cairo_fixed_from_int (y2);
status = _cairo_rectangular_scan_converter_add_box (&converter, &b, 1);
if (unlikely (status))
goto CLEANUP_CONVERTER;
}
/* bottom */
/* bottom (including bottom-left and bottom-right corners) */
if (! _cairo_fixed_is_integer (box[i].p2.y)) {
b.p1.x = box[i].p1.x;
b.p1.y = _cairo_fixed_from_int (y2);