aboutsummaryrefslogtreecommitdiff
path: root/generic/Item.c
diff options
context:
space:
mode:
authorlecoanet2002-12-09 14:53:30 +0000
committerlecoanet2002-12-09 14:53:30 +0000
commit8b4f53549859b38da0e44a17f8bd1cd6373d0f81 (patch)
tree4538559c2bd0fba2ca1ebf9209a741097abe1a16 /generic/Item.c
parentf47dcb672f7331cac412fd93873384702b599064 (diff)
downloadtkzinc-8b4f53549859b38da0e44a17f8bd1cd6373d0f81.zip
tkzinc-8b4f53549859b38da0e44a17f8bd1cd6373d0f81.tar.gz
tkzinc-8b4f53549859b38da0e44a17f8bd1cd6373d0f81.tar.bz2
tkzinc-8b4f53549859b38da0e44a17f8bd1cd6373d0f81.tar.xz
* Initialisation/destruction d'une display list pour chaque
item (potentiellement). * Mise � jour du code de clipping pour tenir compte de la nouvelle structure des tristrips.
Diffstat (limited to 'generic/Item.c')
-rw-r--r--generic/Item.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/generic/Item.c b/generic/Item.c
index bb9933f..9a9cfc1 100644
--- a/generic/Item.c
+++ b/generic/Item.c
@@ -474,7 +474,7 @@ ZnConfigureAttributes(WidgetInfo *wi,
case ZN_CONFIG_FONT:
{
Tk_Font font;
- char *name = "";
+ Tk_Uid name = "";
if (*((Tk_Font *) valp)) {
name = Tk_NameOfFont(*((Tk_Font *) valp));
}
@@ -1070,7 +1070,7 @@ AttributeToObj(WidgetInfo *wi,
Tcl_Obj *result)
{
char *valp = ((char *) record) + desc->offset;
- char *str = "";
+ Tk_Uid str = "";
Tcl_Obj *o;
int i;
@@ -1571,13 +1571,13 @@ ExtractItem(Item item)
/* Disconnect all dependents on me. */
ZnDisconnectDependentItems(item);
/*
- * Remove me from item list.
- */
- ZnGroupExtractItem(item);
- /*
* Remove me as a clip item.
*/
ZnGroupRemoveClip(group, item);
+ /*
+ * Remove me from item list.
+ */
+ ZnGroupExtractItem(item);
}
}
@@ -1832,7 +1832,9 @@ ZnCreateItem(WidgetInfo *wi,
item->transfo = NULL;
item->parent = NULL;
item->connected_item = ZN_NO_ITEM;
-
+#ifdef GLX
+ item->gl_list = 0;
+#endif
ResetBBox(&item->item_bounding_box);
/* Init item specific attributes */
@@ -2246,7 +2248,7 @@ ZnPushClip(WidgetInfo *wi,
ClipState *previous_clip=NULL;
Region reg, reg_op, reg_to;
XRectangle rect;
- XPoint xpts[3], *xp2, *xpts2;
+ XPoint xpts[3];
if (tristrip->num_strips == 0) {
return;
@@ -2290,28 +2292,24 @@ ZnPushClip(WidgetInfo *wi,
for (j = 0; j < tristrip->num_strips; j++) {
num_pts = tristrip->strips[j].num_points;
p = tristrip->strips[j].points;
- /*
- * In case of a fan we benefit from the fact that
- * ALL the contour vertices are included in
- * the tristrip, so we can use the corresponding
- * polygon instead of going through all the triangles.
- */
if (tristrip->strips[j].fan) {
- /* Skip the center */
+ xpts[0].x = REAL_TO_INT(p->x);
+ xpts[0].y = REAL_TO_INT(p->y);
p++;
- num_pts--;
- xp2 = xpts2 = ZnMalloc(num_pts*sizeof(XPoint));
- for (i = 0 ; i < num_pts; i++, p++, xp2++) {
- xp2->x = (short) p->x;
- xp2->y = (short) p->y;
+ xpts[1].x = REAL_TO_INT(p->x);
+ xpts[1].y = REAL_TO_INT(p->y);
+ p++;
+ for (i = 2; i < num_pts; i++, p++) {
+ xpts[2].x = REAL_TO_INT(p->x);
+ xpts[2].y = REAL_TO_INT(p->y);
+ reg_op = XPolygonRegion(xpts, 3, EvenOddRule);
+ reg_to = XCreateRegion();
+ XUnionRegion(reg, reg_op, reg_to);
+ XDestroyRegion(reg);
+ XDestroyRegion(reg_op);
+ reg = reg_to;
+ xpts[1] = xpts[2];
}
- reg_op = XPolygonRegion(xpts2, num_pts, EvenOddRule);
- reg_to = XCreateRegion();
- XUnionRegion(reg, reg_op, reg_to);
- XDestroyRegion(reg);
- XDestroyRegion(reg_op);
- reg = reg_to;
- ZnFree(xpts2);
}
else {
xpts[0].x = p->x;
@@ -2513,6 +2511,16 @@ Invalidate(Item item,
if (ISSET(item->flags, VISIBLE_BIT)) {
/*printf("invalidate graphics for item %d\n", item->id);*/
ZnDamage(item->wi, &item->item_bounding_box);
+#ifdef GLX
+ /*
+ * Remove the item display list so that it will be recreated
+ * to reflect the changes.
+ */
+ if (item->gl_list) {
+ glDeleteLists(item->gl_list, 1);
+ item->gl_list = 0;
+ }
+#endif
}
}
}