summaryrefslogtreecommitdiffstats
path: root/otherlibs/graph/draw.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2003-04-25 12:25:07 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2003-04-25 12:25:07 +0000
commitbf29669d3c60647880afa87097a34765f1f28afd (patch)
treeb910979fe85020f03306171196d0448f7888070b /otherlibs/graph/draw.c
parentb5e0c573f9caf38984a6082a52c5d993af9eca93 (diff)
Correction de draw_rectangle
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5508 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/graph/draw.c')
-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;