aboutsummaryrefslogtreecommitdiff
path: root/generic/Rectangle.c
diff options
context:
space:
mode:
authorlecoanet2003-12-11 08:14:20 +0000
committerlecoanet2003-12-11 08:14:20 +0000
commit39b9113abe334703f49dadc04e70af0557bd4298 (patch)
treebd6e2d076634abcfc451d279246c8f7cae0682fb /generic/Rectangle.c
parent9c9b36fa1e164b5d23c6f50c50c2205a3dc44b99 (diff)
downloadtkzinc-39b9113abe334703f49dadc04e70af0557bd4298.zip
tkzinc-39b9113abe334703f49dadc04e70af0557bd4298.tar.gz
tkzinc-39b9113abe334703f49dadc04e70af0557bd4298.tar.bz2
tkzinc-39b9113abe334703f49dadc04e70af0557bd4298.tar.xz
* (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.
Diffstat (limited to 'generic/Rectangle.c')
-rw-r--r--generic/Rectangle.c22
1 files 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);