From 39b9113abe334703f49dadc04e70af0557bd4298 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Thu, 11 Dec 2003 08:14:20 +0000 Subject: * (ComputeCoordinates): Reduced the rounding of the bounding box to 0.5 pixels instead of 1. * (ComputeCoordinates): Fixed the way ALIGNED was computed it didn't work with skew, and had other bugs. * (GetClipVertices): Fixed a bug on the tristrip returned when the rectangle is not aligned on axes. The order of the returned triangle vertices didn't describe a rectangle. --- generic/Rectangle.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/generic/Rectangle.c b/generic/Rectangle.c index fd6e78b..5c9f91c 100644 --- a/generic/Rectangle.c +++ b/generic/Rectangle.c @@ -345,17 +345,17 @@ ComputeCoordinates(ZnItem item, item->item_bounding_box.corner.x += lw2; item->item_bounding_box.corner.y += lw2; } - item->item_bounding_box.orig.x -= 1; - item->item_bounding_box.orig.y -= 1; - item->item_bounding_box.corner.x += 1; - item->item_bounding_box.corner.y += 1; + item->item_bounding_box.orig.x -= 0.5; + item->item_bounding_box.orig.y -= 0.5; + item->item_bounding_box.corner.x += 0.5; + item->item_bounding_box.corner.y += 0.5; delta = rect->dev[0].y - rect->dev[1].y; delta = ABS(delta); aligned = delta < X_PRECISION_LIMIT; - delta = rect->dev[0].x - rect->dev[1].x; + delta = rect->dev[0].x - rect->dev[3].x; delta = ABS(delta); - aligned |= delta < X_PRECISION_LIMIT; + aligned &= delta < X_PRECISION_LIMIT; ASSIGN(rect->flags, ALIGNED_BIT, aligned); #ifdef GL @@ -777,7 +777,7 @@ GetClipVertices(ZnItem item, if (ISSET(rect->flags, ALIGNED_BIT)) { ZnListAssertSize(item->wi->work_pts, 2); - points = (ZnPoint *) ZnListArray(item->wi->work_pts); + points = ZnListArray(item->wi->work_pts); ZnTriStrip1(tristrip, points, 2, False); tristrip->strips[0].fan = False; @@ -799,7 +799,13 @@ GetClipVertices(ZnItem item, } } else { - ZnTriStrip1(tristrip, rect->dev, 4, False); + ZnListAssertSize(item->wi->work_pts, 4); + points = ZnListArray(item->wi->work_pts); + points[0] = rect->dev[1]; + points[1] = rect->dev[2]; + points[2] = rect->dev[0]; + points[3] = rect->dev[3]; + ZnTriStrip1(tristrip, points, 4, False); } return ISSET(rect->flags, ALIGNED_BIT); -- cgit v1.1