diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkZinc.c | 449 |
1 files changed, 286 insertions, 163 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c index b8d14aa..3733051 100644 --- a/generic/tkZinc.c +++ b/generic/tkZinc.c @@ -54,9 +54,6 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " #include "Draw.h" #include "Color.h" #include "perfos.h" -#ifdef GPC -#include "gpc/gpc.h" -#endif #include <ctype.h> #include <stdlib.h> @@ -795,58 +792,63 @@ ZincObjCmd(ClientData client_data, /* Main window associated with */ if (wi->render) { #ifdef GLX + wi->gl_context = 0; + wi->tess = 0; + wi->tess_combine_list = NULL; + if (wi->has_glx) { #ifdef GLX_PRINT_CONFIG int val; #endif #if GLX_PRINT_CONFIG - printf("GLX version %d.%d\n", major_glx, minor_glx); + fprintf(stderr, "GLX version %d.%d\n", major_glx, minor_glx); #endif wi->gl_visual = glXChooseVisual(wi->dpy, XScreenNumberOfScreen(wi->screen), attribs); if (!wi->gl_visual) { - printf("No glx visual\n"); + fprintf(stderr, "No glx visual\n"); wi->render = 0; } else { wi->gl_context = glXCreateContext(wi->dpy, wi->gl_visual, NULL, wi->render==1); if (!wi->gl_context) { - printf("No glx context\n"); + fprintf(stderr, "No glx context\n"); wi->render = 0; } else { #ifdef GLX_PRINT_CONFIG - printf(" Visual : 0x%x, ", (int) wi->gl_visual->visualid); + fprintf(stderr, " Visual : 0x%x, ", (int) wi->gl_visual->visualid); glXGetConfig(wi->dpy, wi->gl_visual, GLX_RGBA, &val); - printf("RGBA : %d, ", val); + fprintf(stderr, "RGBA : %d, ", val); glXGetConfig(wi->dpy, wi->gl_visual, GLX_DOUBLEBUFFER, &val); - printf("Double Buffer : %d, ", val); + fprintf(stderr, "Double Buffer : %d, ", val); glXGetConfig(wi->dpy, wi->gl_visual, GLX_STENCIL_SIZE, &val); - printf("Stencil : %d, ", val); + fprintf(stderr, "Stencil : %d, ", val); glXGetConfig(wi->dpy, wi->gl_visual, GLX_BUFFER_SIZE, &val); - printf("depth : %d, ", val); + fprintf(stderr, "depth : %d, ", val); glXGetConfig(wi->dpy, wi->gl_visual, GLX_RED_SIZE, &val); - printf("red : %d, ", val); + fprintf(stderr, "red : %d, ", val); glXGetConfig(wi->dpy, wi->gl_visual, GLX_GREEN_SIZE, &val); - printf("green : %d, ", val); + fprintf(stderr, "green : %d, ", val); glXGetConfig(wi->dpy, wi->gl_visual, GLX_BLUE_SIZE, &val); - printf("blue : %d, ", val); + fprintf(stderr, "blue : %d, ", val); glXGetConfig(wi->dpy, wi->gl_visual, GLX_ALPHA_SIZE, &val); - printf("alpha : %d\n", val); - printf(" Direct Rendering: %d\n", glXIsDirect(wi->dpy, wi->gl_context)); + fprintf(stderr, "alpha : %d\n", val); + fprintf(stderr, " Direct Rendering: %d\n", glXIsDirect(wi->dpy, wi->gl_context)); #endif Tk_SetWindowVisual(wi->win, wi->gl_visual->visual, 24, XCreateColormap(wi->dpy, RootWindowOfScreen(wi->screen), wi->gl_visual->visual, AllocNone)); + wi->tess = gluNewTess(); } } } else { - printf("glx not available\n"); + fprintf(stderr, "glx not available\n"); wi->render = 0; } #endif @@ -2382,36 +2384,93 @@ FindItems(WidgetInfo *wi, /* *---------------------------------------------------------------------- * - * ParseCoordList -- + * ZnParseCoordList -- * *---------------------------------------------------------------------- */ -static int -ParseCoordList(WidgetInfo *wi, - Tcl_Obj *arg, - ZnPoint **pts, - int *num_pts) +int +ZnParseCoordList(WidgetInfo *wi, + Tcl_Obj *arg, + ZnPoint **pts, + char **controls, + int *num_pts) { - Tcl_Obj **elems; - int i, result, num_elems; + Tcl_Obj **elems, **selems; + int i, result, num_elems, num_selems; ZnPoint *p; - + int old_style, len; + char *str; + ZnReal r; + + if (controls) { + *controls = NULL; + } result = Tcl_ListObjGetElements(wi->interp, arg, &num_elems, &elems); - if ((result == ZN_ERROR) || ((num_elems%2) != 0)) { + if (result == ZN_ERROR) { coord_error: Tcl_AppendResult(wi->interp, " malformed coord list", NULL); return ZN_ERROR; } - - *num_pts = num_elems/2; - ZnListAssertSize(wi->work_pts, *num_pts); - *pts = p = (ZnPoint *) ZnListArray(wi->work_pts); - for (i = 0; i < num_elems; i += 2, p++) { - if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &p->x) == ZN_ERROR) { + if (num_elems == 0) { + *num_pts = 0; + *pts = NULL; + return ZN_OK; + } + + /* + * If first element is not a sublist, consider the whole list + * as a flat array of coordinates in the old style. + * If not, the list consists in sublists describing each point + * with its control flag. + */ + result = Tcl_GetDoubleFromObj(wi->interp, elems[0], &r); + old_style = (result == ZN_OK); + + if (old_style) { + if ((num_elems%2) != 0) { goto coord_error; } - if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &p->y) == ZN_ERROR) { - goto coord_error; + + *num_pts = num_elems/2; + ZnListAssertSize(wi->work_pts, *num_pts); + *pts = p = (ZnPoint *) ZnListArray(wi->work_pts); + for (i = 0; i < num_elems; i += 2, p++) { + if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &p->x) == ZN_ERROR) { + goto coord_error; + } + if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &p->y) == ZN_ERROR) { + goto coord_error; + } + } + } + else { + Tcl_ResetResult(wi->interp); + *num_pts = num_elems; + ZnListAssertSize(wi->work_pts, *num_pts); + *pts = p = (ZnPoint *) ZnListArray(wi->work_pts); + for (i = 0; i < num_elems; i++, p++) { + result = Tcl_ListObjGetElements(wi->interp, elems[i], &num_selems, &selems); + if ((result == ZN_ERROR) || (num_selems < 2) || (num_selems > 3)) { + goto coord_error; + } + if (Tcl_GetDoubleFromObj(wi->interp, selems[0], &p->x) == ZN_ERROR) { + goto coord_error; + } + if (Tcl_GetDoubleFromObj(wi->interp, selems[1], &p->y) == ZN_ERROR) { + goto coord_error; + } + if (controls) { + if (num_selems == 3) { + if (! *controls) { + *controls = ZnMalloc(*num_pts * sizeof(char)); + memset(*controls, 0, *num_pts * sizeof(char)); + } + str = Tcl_GetStringFromObj(selems[2], &len); + if (len) { + (*controls)[i] = str[0]; + } + } + } } } @@ -2426,27 +2485,25 @@ ParseCoordList(WidgetInfo *wi, * *---------------------------------------------------------------------- */ -#ifdef GPC static int Contour(WidgetInfo *wi, int argc, Tcl_Obj *CONST args[], TagSearch **search_var) { - ZnPoint *points; + ZnPoint *points, *points2; ZnPoint p[4], xp[4]; Item item, shape; - int cmd, num_points, result, i; + int cmd, num_points, cw, result, i, j; + long index; + char *controls; ZnBool simple=False; ZnPoly poly; - int index; ZnTransfo t, inv; ZnContour *contours; + /* Keep this array in sync with ZnContourCmd in Types.h */ static char *op_strings[] = { - "diff", "inter", "union", "xor", NULL - }; - int ops[] = { - GPC_DIFF, GPC_INT, GPC_UNION, GPC_XOR + "add", "addhole", "remove", NULL }; result = ZnItemWithTagOrId(wi, args[2], &item, search_var); @@ -2469,113 +2526,170 @@ Contour(WidgetInfo *wi, /* * Requesting the number of contours. */ - Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, -1, NULL))); - + Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, -1, 0, NULL))); + return ZN_OK; } if (Tcl_GetIndexFromObj(wi->interp, args[3], op_strings, - "polygon operator", 0, &index) != ZN_OK) { - Tcl_AppendResult(wi->interp, "unknown contour operator \"", Tcl_GetString(args[3]), - "\"", NULL); + "contour operation", 0, &cmd) != ZN_OK) { return ZN_ERROR; } - cmd = ops[index]; - result = ZnItemWithTagOrId(wi, args[4], &shape, search_var); - if ((result == ZN_ERROR) || (shape == ZN_NO_ITEM)) { - Tcl_ResetResult(wi->interp); - if (ParseCoordList(wi, args[4], &points, &num_points) == ZN_ERROR) { + index = ZnListTail; + if (((argc == 5) && (cmd == ZN_CONTOUR_REMOVE)) || (argc == 6)) { + /* Look for an index value. */ + if (Tcl_GetLongFromObj(wi->interp, args[4], &index) != ZN_OK) { + Tcl_AppendResult(wi->interp, " incorrect contour index \"", + Tcl_GetString(args[4]), "\"", NULL); return ZN_ERROR; } - POLY_CONTOUR1(&poly, NULL, num_points); - /* - * Allocate a fresh point array, ParseCoordList returns a shared - * array. - */ - poly.contours[0].points = (ZnPoint *) ZnMalloc(num_points*sizeof(ZnPoint)); - memcpy(poly.contours[0].points, points, num_points*sizeof(ZnPoint)); + argc--; + args++; + } + + if (cmd == ZN_CONTOUR_REMOVE) { + Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, ZN_CONTOUR_REMOVE, index, NULL))); } else { - /* - * If something has changed in the geometry we need to - * update or the shape will be erroneous. - */ - Update(wi); - if (!shape->class->GetContours && - !shape->class->GetClipVertices) { - noshape: - Tcl_AppendResult(wi->interp, "class: \"", shape->class->name, - "\" can't give a polygonal shape", NULL); - return ZN_ERROR; - } - if (!shape->class->GetContours) { - ZnTriStrip tristrip; + result = ZnItemWithTagOrId(wi, args[4], &shape, search_var); + if ((result == ZN_ERROR) || (shape == ZN_NO_ITEM)) { + Tcl_ResetResult(wi->interp); + if (ZnParseCoordList(wi, args[4], &points, &controls, &num_points) == ZN_ERROR) { + return ZN_ERROR; + } + POLY_CONTOUR1(&poly, NULL, num_points); /* - * If there is no GetContours method try to use - * the GetClipVertices. It works only for simple - * shapes (i.e tose returning a bounding box). + * Allocate a fresh point array, ZnParseCoordList returns a shared + * array. */ - tristrip.num_strips = 0; - simple = shape->class->GetClipVertices(shape, &tristrip); - if (!simple) { - goto noshape; + poly.contours[0].points = (ZnPoint *) ZnMalloc(num_points*sizeof(ZnPoint)); + poly.contours[0].cw = (cmd == ZN_CONTOUR_ADD_HOLE); + if (!TestCCW(points, num_points) ^ (cmd == ZN_CONTOUR_ADD_HOLE)) { + /* Revert the contour */ + for (i = 0; i < num_points; i++) { + poly.contours[0].points[num_points-i-1] = points[i]; + } + } + else { + memcpy(poly.contours[0].points, points, num_points*sizeof(ZnPoint)); + } + poly.contours[0].controls = NULL; + if (controls) { + poly.contours[0].controls = controls; } - POLY_CONTOUR1(&poly, tristrip.strip1.points, tristrip.strip1.num_points); - } - else { - poly.num_contours = 0; - simple = shape->class->GetContours(shape, &poly); - } - if (poly.num_contours == 0) { - return ZN_OK; - } - /* - * Compute the tranform to map the device points - * into the coordinate space of item. - */ - ITEM.GetItemTransform(item, &t); - ZnTransfoInvert(&t, &inv); - /* - * Make a new transformed poly. - */ - if (simple) { - p[0] = poly.contours[0].points[0]; - p[2] = poly.contours[0].points[1]; - p[1].x = p[2].x; - p[1].y = p[0].y; - p[3].x = p[0].x; - p[3].y = p[2].y; - ZnTransformPoints(&inv, p, xp, 4); - poly.contours[0].points = xp; - poly.contours[0].num_points = 4; } else { - if (poly.num_contours != 1) { - contours = poly.contours; - poly.contours = (ZnContour *) ZnMalloc(poly.num_contours*sizeof(ZnContour)); + /* + * If something has changed in the geometry we need to + * update or the shape will be erroneous. + */ + Update(wi); + if (!shape->class->GetContours && + !shape->class->GetClipVertices) { + noshape: + Tcl_AppendResult(wi->interp, "class: \"", shape->class->name, + "\" can't give a polygonal shape", NULL); + return ZN_ERROR; + } + if (!shape->class->GetContours) { + ZnTriStrip tristrip; + /* + * If there is no GetContours method try to use + * the GetClipVertices. It works only for simple + * shapes (i.e tose returning a bounding box). + */ + tristrip.num_strips = 0; + simple = shape->class->GetClipVertices(shape, &tristrip); + if (!simple) { + goto noshape; + } + POLY_CONTOUR1(&poly, tristrip.strip1.points, tristrip.strip1.num_points); + poly.contours[0].controls = NULL; } else { - contours = poly.contours; - poly.contours = &poly.contour1; + poly.num_contours = 0; + simple = shape->class->GetContours(shape, &poly); + } + if (poly.num_contours == 0) { + return ZN_OK; } - for (i = 0; i < poly.num_contours; i++) { - points = contours[i].points; - num_points = contours[i].num_points; - poly.contours[i].num_points = num_points; - poly.contours[i].points = (ZnPoint *) ZnMalloc(num_points*sizeof(ZnPoint)); - ZnTransformPoints(&inv, points, poly.contours[i].points, num_points); + /* + * Compute the tranform to map the device points + * into the coordinate space of item. + */ + ITEM.GetItemTransform(item, &t); + ZnTransfoInvert(&t, &inv); + /* + * Make a new transformed poly. + */ + if (simple) { + p[0] = poly.contours[0].points[0]; + p[2] = poly.contours[0].points[1]; + if (cmd == ZN_CONTOUR_ADD_HOLE) { + p[1].x = p[2].x; + p[1].y = p[0].y; + p[3].x = p[0].x; + p[3].y = p[2].y; + } + else { + p[1].x = p[0].x; + p[1].y = p[2].y; + p[3].x = p[2].x; + p[3].y = p[0].y; + } + ZnTransformPoints(&inv, p, xp, 4); + poly.contours[0].points = xp; + poly.contours[0].num_points = 4; + poly.contours[0].cw = (cmd == ZN_CONTOUR_ADD_HOLE); + poly.contours[0].controls = NULL; + } + else { + contours = poly.contours; + if (poly.num_contours == 1) { + poly.contours = &poly.contour1; + } + else { + poly.contours = (ZnContour *) ZnMalloc(poly.num_contours*sizeof(ZnContour)); + } + for (i = 0; i < poly.num_contours; i++) { + points = contours[i].points; + num_points = contours[i].num_points; + cw = contours[i].cw; + poly.contours[i].num_points = num_points; + poly.contours[i].cw = cw; + if (contours[i].controls) { + /* + * The controls array is shared DO NOT deallocate !! + */ + poly.contours[i].controls = contours[i].controls; + } + poly.contours[i].points = ZnMalloc(num_points*sizeof(ZnPoint)); + if (((poly.num_contours == 1) && ((cmd == ZN_CONTOUR_ADD_HOLE) ^ cw)) || + ((poly.num_contours > 1) && (cmd == ZN_CONTOUR_ADD_HOLE))) { + /* Revert the contour */ + poly.contours[i].cw = ! cw; + points2 = ZnMalloc(num_points*sizeof(ZnPoint)); + for (j = 0; j < num_points; j++) { + points2[num_points-j-1] = points[j]; + } + ZnTransformPoints(&inv, points2, poly.contours[i].points, num_points); + ZnFree(points2); + } + else { + ZnTransformPoints(&inv, points, poly.contours[i].points, num_points); + } + } } } - } - Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, cmd, &poly))); - - if (!simple) { - POLY_FREE(&poly); + Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, ZN_CONTOUR_ADD, index, &poly))); + + if (!simple) { + POLY_FREE(&poly); + } } - + return ZN_OK; } -#endif /* @@ -2596,7 +2710,8 @@ Coords(WidgetInfo *wi, int num_points, result, i; int cmd = COORDS_READ; long index, contour = 0; - char *str; + char *str, *controls = NULL; + char c[2] = " "; Tcl_Obj *l; result = ZnItemWithTagOrId(wi, args[2], &item, search_var); @@ -2611,7 +2726,7 @@ Coords(WidgetInfo *wi, if (argc == 3) { /* Get all coords of default contour (0). */ if (item->class->Coords(item, 0, 0, COORDS_READ_ALL, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } coords_read: @@ -2621,6 +2736,10 @@ Coords(WidgetInfo *wi, for (i = 0; i < num_points; i++, points++) { Tcl_ListObjAppendElement(wi->interp, l, NewDoubleObj(points->x)); Tcl_ListObjAppendElement(wi->interp, l, NewDoubleObj(points->y)); + if (controls) { + c[0] = controls[i]; + Tcl_ListObjAppendElement(wi->interp, l, NewStringObj(c)); + } } return ZN_OK; } @@ -2667,23 +2786,26 @@ Coords(WidgetInfo *wi, Tcl_GetString(args[i]), "\"", NULL); return ZN_ERROR; } - else if (ParseCoordList(wi, args[i], &points, &num_points) == ZN_ERROR) { + else if (ZnParseCoordList(wi, args[i], &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } if (cmd == COORDS_ADD) { /* Append coords at end of default contour (0). */ if (item->class->Coords(item, 0, 0, COORDS_ADD_LAST, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } } else { /* Set all coords of default contour (0). */ if (item->class->Coords(item, 0, 0, COORDS_REPLACE_ALL, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } } + if (controls) { + ZnFree(controls); + } return ZN_OK; } @@ -2691,7 +2813,7 @@ Coords(WidgetInfo *wi, if (argc == 4) { /* Get all coords of contour. */ if (item->class->Coords(item, contour, 0, COORDS_READ_ALL, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } goto coords_read; @@ -2699,7 +2821,7 @@ Coords(WidgetInfo *wi, else if ((argc == 5) && (cmd == COORDS_REMOVE)) { /* Remove coord at index in default contour (0). */ if (item->class->Coords(item, 0, index, COORDS_REMOVE, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } return ZN_OK; @@ -2716,29 +2838,32 @@ Coords(WidgetInfo *wi, Tcl_GetString(args[i]), "\"", NULL); return ZN_ERROR; } - else if (ParseCoordList(wi, args[i], &points, &num_points) == ZN_ERROR) { + else if (ZnParseCoordList(wi, args[i], &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } if (cmd == COORDS_ADD) { /* Append coords at end of contour. */ if (item->class->Coords(item, contour, 0, COORDS_ADD_LAST, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } } else { /* Set all coords of contour. */ if (item->class->Coords(item, contour, 0, COORDS_REPLACE_ALL, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } } + if (controls) { + ZnFree(controls); + } return ZN_OK; } if (argc == 5) { /* Get coord of contour at index. */ if (item->class->Coords(item, contour, index, COORDS_READ, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } goto coords_read; @@ -2746,14 +2871,14 @@ Coords(WidgetInfo *wi, else if ((argc == 6) && (cmd == COORDS_REMOVE)) { /* Remove coord of contour at index. */ if (item->class->Coords(item, contour, index, COORDS_REMOVE, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } return ZN_OK; } /* Set a single coord or add coords at index in contour. */ - if (ParseCoordList(wi, args[i+1], &points, &num_points) == ZN_ERROR) { + if (ZnParseCoordList(wi, args[i+1], &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } if (argc == 6) { @@ -2761,10 +2886,12 @@ Coords(WidgetInfo *wi, cmd = COORDS_REPLACE; } if (item->class->Coords(item, contour, index, cmd, - &points, &num_points) == ZN_ERROR) { + &points, &controls, &num_points) == ZN_ERROR) { return ZN_ERROR; } - + if (controls) { + ZnFree(controls); + } return ZN_OK; } @@ -3230,22 +3357,15 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ */ case ZN_W_CONTOUR: { -#ifdef GPC - if ((argc != 5) && (argc != 3)) { + if ((argc < 3) || (argc > 6)) { Tcl_WrongNumArgs(interp, 1, args, - "contour tagOrId ?operator coordListOrTagOrId?"); + "contour tagOrId ?operator? ?index? ?coordListOrTagOrId?"); goto error; } if (Contour(wi, argc, args, &search_var) == ZN_ERROR) { goto error; } break; -#else - Tcl_AppendResult(interp, "Command \"", Tcl_GetString(args[1]), - "\" not available (compile Zinc with GPC).", - NULL); - goto error; -#endif } /* * coords @@ -3464,7 +3584,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ Tcl_WrongNumArgs(interp, 1, args, "fit coordList error"); goto error; } - if (ParseCoordList(wi, args[2], &points, &num_points) == ZN_ERROR) { + if (ZnParseCoordList(wi, args[2], &points, NULL, &num_points) == ZN_ERROR) { return ZN_ERROR; } if (Tcl_GetDoubleFromObj(interp, args[3], &error) == ZN_ERROR) { @@ -4285,7 +4405,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ Tcl_WrongNumArgs(interp, 1, args, "smooth coordList"); goto error; } - if (ParseCoordList(wi, args[2], &points, &num_points) == ZN_ERROR) { + if (ZnParseCoordList(wi, args[2], &points, NULL, &num_points) == ZN_ERROR) { return ZN_ERROR; } to_points = ZnListNew(32, sizeof(ZnPoint)); @@ -4380,7 +4500,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ /*ZnPrintTransfo(&t); ZnPrintTransfo(&inv);*/ - if (ParseCoordList(wi, args[argc-1], &p, &num_points) == ZN_ERROR) { + if (ZnParseCoordList(wi, args[argc-1], &p, NULL, &num_points) == ZN_ERROR) { Tcl_AppendResult(interp, " invalid coord list \"", Tcl_GetString(args[argc-1]), "\"", NULL); goto error; @@ -4885,12 +5005,12 @@ Event(ClientData client_data, /* Information about widget. */ glGetFloatv(GL_SMOOTH_POINT_SIZE_RANGE, r); wi->max_point_width = r[1]; #ifdef GLX_PRINT_CONFIG - printf("OpenGL version %s\n", (char *) glGetString(GL_VERSION)); - printf(" Moteur de rendu : %s, ", (char *) glGetString(GL_RENDERER)); - printf(" Fabriquant : %s\n", (char *) glGetString(GL_VENDOR)); - printf(" Extensions présentes : %s\n", (char *) glGetString(GL_EXTENSIONS)); - printf("Max antialiased line width: %g\n", wi->max_line_width); - printf("Max antialiased point size: %g\n", wi->max_point_width); + fprintf(stderr, "OpenGL version %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, " Moteur de rendu : %s, ", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, " Fabriquant : %s\n", (char *) glGetString(GL_VENDOR)); + fprintf(stderr, " Extensions présentes : %s\n", (char *) glGetString(GL_EXTENSIONS)); + fprintf(stderr, "Max antialiased line width: %g\n", wi->max_line_width); + fprintf(stderr, "Max antialiased point size: %g\n", wi->max_point_width); #endif #endif } @@ -5272,7 +5392,7 @@ PickCurrentItem(WidgetInfo *wi, * the pending call will do everything that's needed. */ if (wi->events_flags & REPICK_IN_PROGRESS) { - printf("PickCurrentItem recursive\n"); + fprintf(stderr, "PickCurrentItem recursive\n"); return; } @@ -5814,6 +5934,9 @@ Destroy(char *mem_ptr) /* Info about the widget. */ if (wi->gl_visual) { XFree(wi->gl_visual); } + if (wi->tess) { + gluDeleteTess(wi->tess); + } #endif if (wi->fore_color) { @@ -6130,7 +6253,7 @@ Repair(WidgetInfo *wi) r.height = wi->damaged_area.corner.y - wi->damaged_area.orig.y; pts[0] = wi->damaged_area.orig; pts[1] = wi->damaged_area.corner; - TRI_STRIP1(&tristrip, pts, 2); + TRI_STRIP1(&tristrip, pts, 2, False); ZnPushClip(wi, &tristrip, True, True); /* Fill the background of the double buffer pixmap. */ @@ -6388,7 +6511,7 @@ int Tkzinc_Init(Tcl_Interp *interp) /* Used for error reporting. */ { if (!Tk_MainWindow(interp)) { - printf("Tk main window not created"); + fprintf(stderr, "Tk main window not created"); return ZN_ERROR; } |