Tk Source Code

Artifact [cfaafb86]
Login

Artifact cfaafb865fe8ebe021a9b58a3d4570ff804fa1940eec8ab4a474410ca298afb2:

Attachment "tkWinGDI.diff" to ticket [9b23b6ca] added by emiliano 2025-04-27 21:16:15.
Index: win/tkWinGDI.c
==================================================================
--- win/tkWinGDI.c
+++ win/tkWinGDI.c
@@ -561,11 +561,11 @@
 
 static int Bezierize(
     POINT* polypoints,
     int npoly,
     int nStep,
-    POINT* bpointptr)
+    POINT** bpointptr)
 {
     /* First, translate my points into a list of doubles. */
     double *inPointList, *outPointList;
     int n;
     int nbpoints = 0;
@@ -604,11 +604,11 @@
     for (n=0; n<nbpoints; n++) {
 	bpoints[n].x = (long)outPointList[2*n];
 	bpoints[n].y = (long)outPointList[2*n + 1];
     }
     ckfree(outPointList);
-    *bpointptr = *bpoints;
+    *bpointptr = bpoints;
     return nbpoints;
 }
 
 /*
  *----------------------------------------------------------------------
@@ -809,19 +809,19 @@
 	GdiMakeBrush(linecolor, 0, &lbrush, hDC, &hBrush);
     }
 
     if (dosmooth) { /* Use PolyBezier. */
 	int nbpoints;
-	POINT *bpoints = 0;
+	POINT *bpoints = NULL;
 
-	nbpoints = Bezierize(polypoints,npoly,nStep,bpoints);
+	nbpoints = Bezierize(polypoints, npoly, nStep, &bpoints);
 	if (nbpoints > 0) {
 	    Polyline(hDC, bpoints, nbpoints);
 	} else {
 	    Polyline(hDC, polypoints, npoly); /* Out of memory? Just draw a regular line. */
 	}
-	if (bpoints != 0) {
+	if (bpoints != NULL) {
 	    ckfree(bpoints);
 	}
     } else {
 	Polyline(hDC, polypoints, npoly);
     }
@@ -1187,18 +1187,19 @@
 		linecolor, hDC, (HGDIOBJ *)&hPen);
     }
 
     if (dosmooth) {
 	int nbpoints;
-	POINT *bpoints = 0;
-	nbpoints = Bezierize(polypoints,npoly,nStep,bpoints);
+	POINT *bpoints = NULL;
+
+	nbpoints = Bezierize(polypoints, npoly, nStep, &bpoints);
 	if (nbpoints > 0) {
 	    Polygon(hDC, bpoints, nbpoints);
 	} else {
 	    Polygon(hDC, polypoints, npoly);
 	}
-	if (bpoints != 0) {
+	if (bpoints != NULL) {
 	    ckfree(bpoints);
 	}
     } else {
 	Polygon(hDC, polypoints, npoly);
     }