summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--otherlibs/graph/draw.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/otherlibs/graph/draw.c b/otherlibs/graph/draw.c
index 78f1444bc..18166168b 100644
--- a/otherlibs/graph/draw.c
+++ b/otherlibs/graph/draw.c
@@ -73,12 +73,20 @@ value gr_draw_rect(value vx, value vy, value vw, value vh)
int h = Int_val(vh);
gr_check_open();
+ y = Bcvt(y) - h + 1;
+ /* Correct for XDrawRectangle irritating habit of drawing a larger
+ rectangle hanging out one pixel below and to the right of the
+ expected rectangle */
+ if (w == 0 || h == 0) return Val_unit;
+ y += 1;
+ w -= 1;
+ h -= 1;
if(grremember_mode)
XDrawRectangle(grdisplay, grbstore.win, grbstore.gc,
- x, Bcvt(y) - h + 1, w, h);
+ x, y, w, h);
if(grdisplay_mode) {
XDrawRectangle(grdisplay, grwindow.win, grwindow.gc,
- x, Wcvt(y) - h + 1, w, h);
+ x, y, w, h);
XFlush(grdisplay);
}
return Val_unit;