From bf29669d3c60647880afa87097a34765f1f28afd Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 25 Apr 2003 12:25:07 +0000 Subject: Correction de draw_rectangle git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5508 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- otherlibs/graph/draw.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'otherlibs/graph/draw.c') 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; -- cgit v1.2.3-70-g09d2