aboutsummaryrefslogtreecommitdiff
path: root/generic/tkZinc.c
diff options
context:
space:
mode:
authorlecoanet2003-06-16 14:52:44 +0000
committerlecoanet2003-06-16 14:52:44 +0000
commit3af8ffc8b0510f7aab319f578b39c7c54d1d0f28 (patch)
treeeb3bc4068af0e72a7fa8bc37a02725a155bdfe7b /generic/tkZinc.c
parent27186257062c6a01049226895af09a486e158c97 (diff)
downloadtkzinc-3af8ffc8b0510f7aab319f578b39c7c54d1d0f28.zip
tkzinc-3af8ffc8b0510f7aab319f578b39c7c54d1d0f28.tar.gz
tkzinc-3af8ffc8b0510f7aab319f578b39c7c54d1d0f28.tar.bz2
tkzinc-3af8ffc8b0510f7aab319f578b39c7c54d1d0f28.tar.xz
* Use of the new ZnGetGradientPixel when possible
* (ZincObjCmd): Fixed a core dump when destroying zinc after an error occured during the first Configure. The tesselator got inited a bit late.
Diffstat (limited to 'generic/tkZinc.c')
-rw-r--r--generic/tkZinc.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index 0b4c53a..4232e96 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -786,6 +786,12 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
ZnInitClipStack(wi);
ZnInitTransformStack(wi);
+ /*
+ * Allocate a GLU tesselator.
+ */
+ wi->tess = gluNewTess();
+ wi->tess_combine_list = NULL;
+
for (num = 0; num < ZN_NUM_ALPHA_STEPS; num++) {
char name[TCL_INTEGER_SPACE+12];
@@ -814,12 +820,6 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
wi->damaged_area.corner.y = wi->height = wi->opt_height;
/*
- * Allocate a GLU tesselator.
- */
- wi->tess = gluNewTess();
- wi->tess_combine_list = NULL;
-
- /*
* Allocate double buffer pixmap/image.
*/
if (wi->render) {
@@ -5492,13 +5492,13 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
XColor *color;
unsigned short alpha;
- color = ZnGetGradientColor(wi->back_color, 0.0, &alpha);
- Tk_SetWindowBackground(wi->win, ZnPixel(color));
+ Tk_SetWindowBackground(wi->win, ZnGetGradientPixel(wi->back_color, 0.0));
if (wi->relief_grad) {
ZnFreeGradient(wi->relief_grad);
wi->relief_grad = NULL;
}
if (wi->relief != ZN_RELIEF_FLAT) {
+ color = ZnGetGradientColor(wi->back_color, 0.0, &alpha);
wi->relief_grad = ZnGetReliefGradient(interp, wi->win,
Tk_NameOfColor(color), alpha);
}
@@ -6769,6 +6769,7 @@ Destroy(char *mem_ptr) /* Info about the widget. */
}
# endif
#endif
+
if (wi->tess) {
gluDeleteTess(wi->tess);
}
@@ -6955,6 +6956,9 @@ Repair(ZnWInfo *wi)
int_height - (int) wi->damaged_area.corner.y,
(int) (wi->damaged_area.corner.x - wi->damaged_area.orig.x),
(int) (wi->damaged_area.corner.y - wi->damaged_area.orig.y));
+ /*printf("Repair : limiting to: %g %g %g %g\n",
+ wi->damaged_area.orig.x, wi->damaged_area.orig.y,
+ wi->damaged_area.corner.x, wi->damaged_area.corner.y);*/
#else
/*
* We do not use the damaged area for GL rendering,
@@ -7084,7 +7088,7 @@ Repair(ZnWInfo *wi)
/* Fill the background of the double buffer pixmap. */
if (wi->tile == ZnUnspecifiedImage) {
- values.foreground = ZnPixel(ZnGetGradientColor(wi->back_color, 0.0, NULL));
+ values.foreground = ZnGetGradientPixel(wi->back_color, 0.0);
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCForeground, &values);
}
@@ -7096,7 +7100,6 @@ Repair(ZnWInfo *wi)
GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin,
&values);
}
- /*printf("Repair : filling rectangle: %d %d %d %d\n", r.x, r.y, r.width, r.height);*/
XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, r.x, r.y, r.width, r.height);
/* Draw the items */
@@ -7134,8 +7137,7 @@ Repair(ZnWInfo *wi)
(ZnDim) wi->border_width);
}
else {
- XSetForeground(wi->dpy, wi->gc,
- ZnPixel(ZnGetGradientColor(wi->back_color, 0.0, NULL)));
+ XSetForeground(wi->dpy, wi->gc, ZnGetGradientPixel(wi->back_color, 0.0));
XSetFillStyle(wi->dpy, wi->gc, FillSolid);
rs[0].x = rs[0].y = wi->highlight_width;
rs[0].width = int_width - 2*wi->highlight_width;
@@ -7157,8 +7159,8 @@ Repair(ZnWInfo *wi)
}
if (wi->highlight_width > 0) {
XSetForeground(wi->dpy, wi->gc,
- ZnPixel(ZnGetGradientColor(ISSET(wi->flags, ZN_GOT_FOCUS)?wi->highlight_color:
- wi->highlight_bg_color, 0.0, NULL)));
+ ZnGetGradientPixel(ISSET(wi->flags, ZN_GOT_FOCUS)?wi->highlight_color:
+ wi->highlight_bg_color, 0.0));
XSetFillStyle(wi->dpy, wi->gc, FillSolid);
rs[0].x = rs[0].y = 0;
rs[0].width = int_width;