summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-08 12:27:25 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-08 12:27:25 (GMT)
commit2140e227e9409b50834e84b180e1d3cb4a9d0ecc (patch)
tree88b5af1ccad5aec8962026c04d8f2301de3a3411 /xlib
parentf9626b8791b204e2abc39cfc211befbaa74d7202 (diff)
parentf2d49e3c2bd2d6ee9466d8cd814a5eef2a93408f (diff)
downloadtk-2140e227e9409b50834e84b180e1d3cb4a9d0ecc.zip
tk-2140e227e9409b50834e84b180e1d3cb4a9d0ecc.tar.gz
tk-2140e227e9409b50834e84b180e1d3cb4a9d0ecc.tar.bz2
(micro-) optimize a few Win32 drawing functions, and make them work when npoints=0
Diffstat (limited to 'xlib')
-rw-r--r--xlib/xgc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 1e720fb..78c7501 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -540,14 +540,15 @@ XDrawPoints(
int npoints,
int mode)
{
- int i;
- int result = Success;
+ int res = Success;
- for (i=0; (i<npoints) && (result == Success); i++) {
- result = XDrawLine(display, d, gc,
- points[i].x, points[i].y, points[i].x, points[i].y);
+ while (npoints-- > 0) {
+ res = XDrawLine(display, d, gc,
+ points[0].x, points[0].y, points[0].x, points[0].y);
+ if (res != Success) break;
+ ++points;
}
- return result;
+ return res;
}
#if !defined(MAC_OSX_TK)