[m-rev.] Bugfix for easyx
Ralph Becket
rafe at cs.mu.OZ.AU
Tue Feb 1 13:26:07 AEDT 2005
Estimated hours taken: 0.5
Branches: main, version-0_12-branch
extras/graphics/easyx/easyx.m:
extras/graphics/easyx/xlib.m:
The interface to draw/fill_rectangle was incorrect. The corresponding
X procedures take arguments X, Y, W, H and not X1, Y1, X2, Y2 as we
had before.
Index: easyx.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/easyx/easyx.m,v
retrieving revision 1.2
diff -u -r1.2 easyx.m
--- easyx.m 29 Sep 2004 23:42:03 -0000 1.2
+++ easyx.m 1 Feb 2005 02:13:52 -0000
@@ -240,9 +240,9 @@
:- pred fill_ellipse(window::in, float::in, float::in, float::in, float::in,
io::di, io::uo) is det.
- % draw_rectangle(Window, X1, Y1, X2, Y2, !IO)
- % fill_rectangle(Window, X1, Y1, X2, Y2, !IO)
- % Draw/fill a rectangle with opposite corners at {X1, Y1} and {X2, Y2}.
+ % draw_rectangle(Window, X, Y, W, H, !IO)
+ % fill_rectangle(Window, X, Y, W, H, !IO)
+ % Draw/fill a rectangle with opposite corners at {X, Y} and {X + W, Y + H}.
%
:- pred draw_rectangle(window::in, float::in, float::in, float::in, float::in,
io::di, io::uo) is det.
@@ -823,26 +823,26 @@
:- pragma promise_pure(draw_rectangle/7).
-draw_rectangle(Window, X1, Y1, X2, Y2, !IO) :-
+draw_rectangle(Window, X, Y, W, H, !IO) :-
store.get_mutvar(Window^display, Display, !IO),
% store.get_mutvar(Window^raw_window, Win, !IO),
store.get_mutvar(Window^gc, GC, !IO),
store.get_mutvar(Window^pixmap, Pix, !IO),
- to_pixels(Window, X1, PX1, Y1, PY1, X2, PX2, Y2, PY2, !IO),
- % impure xlib.draw_rectangle(Display, Win, GC, PX1, PY1, PX2, PY2),
- impure xlib.draw_rectangle(Display, Pix, GC, PX1, PY1, PX2, PY2).
+ to_pixels(Window, X, PX, Y, PY, W, PW, H, PH, !IO),
+ % impure xlib.draw_rectangle(Display, Win, GC, PX, PY, PW, PH),
+ impure xlib.draw_rectangle(Display, Pix, GC, PX, PY, PW, PH).
:- pragma promise_pure(fill_rectangle/7).
-fill_rectangle(Window, X1, Y1, X2, Y2, !IO) :-
+fill_rectangle(Window, X, Y, W, H, !IO) :-
store.get_mutvar(Window^display, Display, !IO),
% store.get_mutvar(Window^raw_window, Win, !IO),
store.get_mutvar(Window^gc, GC, !IO),
store.get_mutvar(Window^pixmap, Pix, !IO),
- to_pixels(Window, X1, PX1, Y1, PY1, X2, PX2, Y2, PY2, !IO),
- % impure xlib.fill_rectangle(Display, Win, GC, PX1, PY1, PX2, PY2),
- impure xlib.fill_rectangle(Display, Pix, GC, PX1, PY1, PX2, PY2).
+ to_pixels(Window, X, PX, Y, PY, W, PW, H, PH, !IO),
+ % impure xlib.fill_rectangle(Display, Win, GC, PX, PY, PW, PH),
+ impure xlib.fill_rectangle(Display, Pix, GC, PX, PY, PW, PH).
%-----------------------------------------------------------------------------%
Index: xlib.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/easyx/xlib.m,v
retrieving revision 1.2
diff -u -r1.2 xlib.m
--- xlib.m 29 Sep 2004 23:42:03 -0000 1.2
+++ xlib.m 1 Feb 2005 02:01:42 -0000
@@ -685,19 +685,19 @@
:- pragma foreign_proc("C",
draw_rectangle(DisplayPtr::in, Win::in, Gc::in,
- X1::in, Y1::in, X2::in, Y2::in),
+ X::in, Y::in, W::in, H::in),
[will_not_call_mercury, thread_safe],
"
- XDrawRectangle(DisplayPtr, Win, Gc, X1, Y1, X2, Y2);
+ XDrawRectangle(DisplayPtr, Win, Gc, X, Y, W, H);
").
%-----------------------------------------------------------------------------%
:- pragma foreign_proc("C", fill_rectangle(DisplayPtr::in, Win::in, Gc::in,
- X1::in, Y1::in, X2::in, Y2::in),
+ X::in, Y::in, W::in, H::in),
[will_not_call_mercury, thread_safe],
"
- XFillRectangle(DisplayPtr, Win, Gc, X1, Y1, X2, Y2);
+ XFillRectangle(DisplayPtr, Win, Gc, X, Y, W, H);
").
%-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list