summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
authorjan.nijtmans <jan.nijtmans@noemail.net>2016-11-08 12:27:25 (GMT)
committerjan.nijtmans <jan.nijtmans@noemail.net>2016-11-08 12:27:25 (GMT)
commit88e413ba86eb25275fcd47b1886022b2d74b5e37 (patch)
tree88b5af1ccad5aec8962026c04d8f2301de3a3411 /xlib
parentf3976ba0f67cd4320e02039b9bc3fcdab0bbcc83 (diff)
parentb686d946455e3f361706231cf443cef13572eef1 (diff)
downloadtk-88e413ba86eb25275fcd47b1886022b2d74b5e37.zip
tk-88e413ba86eb25275fcd47b1886022b2d74b5e37.tar.gz
tk-88e413ba86eb25275fcd47b1886022b2d74b5e37.tar.bz2
(micro-) optimize a few Win32 drawing functions, and make them work when npoints=0
FossilOrigin-Name: 159164e2086ea908dd91bb86cbf81f1bd9dc0902
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)