From: Matt Birkholz Date: Sun, 20 Jan 2019 19:38:04 +0000 (-0800) Subject: x11: Fix x-graphics-vdc-extent and x-graphics-set-clip-rectangle. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=5e6070c2db0f03657f427ed430c6ac2e1012ad15;p=mit-scheme.git x11: Fix x-graphics-vdc-extent and x-graphics-set-clip-rectangle. x-graphics-vdc-extent should have had one argument and returned a vector, and x-graphics-set-clip-rectangle needed to accept floats. (cherry picked from commit cc175b7ef75231a0220d7f384e4fc1c1dd80df67) --- diff --git a/src/x11/x11-graphics.scm b/src/x11/x11-graphics.scm index c0bd90d78..06feffba1 100644 --- a/src/x11/x11-graphics.scm +++ b/src/x11/x11-graphics.scm @@ -34,26 +34,29 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ;; Set the virtual device coordinates to the given values. (C-call "x_graphics_set_vdc_extent" window x-left y-bottom x-right y-top)) -(define (x-graphics-vdc-extent window vector) - (let* ((floats (malloc (* 4 (C-sizeof "float")) 'float)) +(define (x-graphics-vdc-extent window) + (let* ((limits (make-vector 4)) + (floats (malloc (* 4 (C-sizeof "float")) 'float)) (scan (copy-alien floats))) - (C-call "x_graphics_vdc_extent" window floats) - (vector-set! vector 0 (C-> floats "float")) + (C-call "x_graphics_vdc_extent" window scan) + (vector-set! limits 0 (C-> scan "float")) (alien-byte-increment! scan (C-sizeof "float")) - (vector-set! vector 1 (C-> floats "float")) + (vector-set! limits 1 (C-> scan "float")) (alien-byte-increment! scan (C-sizeof "float")) - (vector-set! vector 2 (C-> floats "float")) + (vector-set! limits 2 (C-> scan "float")) (alien-byte-increment! scan (C-sizeof "float")) - (vector-set! vector 3 (C-> floats "float")) - (free floats))) + (vector-set! limits 3 (C-> scan "float")) + (free floats) + limits)) (define (x-graphics-reset-clip-rectangle window) (C-call "x_graphics_reset_clip_rectangle" window)) (define (x-graphics-set-clip-rectangle window x-left y-bottom x-right y-top) ;; Set the clip rectangle to the given coordinates. - (C-call "x_graphics_set_clip_rectangle" - window x-left y-bottom x-right y-top)) + (C-call "x_graphics_set_clip_rectangle" window + (->flonum x-left) (->flonum y-bottom) + (->flonum x-right) (->flonum y-top))) (define (x-graphics-reconfigure window width height) (C-call "x_graphics_reconfigure" window width height)) diff --git a/src/x11/x11.cdecl b/src/x11/x11.cdecl index f8d9928df..3da023ebd 100644 --- a/src/x11/x11.cdecl +++ b/src/x11/x11.cdecl @@ -712,7 +712,7 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (extern void x_graphics_set_clip_rectangle (xw (* (struct xwindow))) - (x_left int) (y_bottom int) (x_right int) (y_top int)) + (x_left float) (y_bottom float) (x_right float) (y_top float)) (extern void x_graphics_reconfigure diff --git a/src/x11/x11graph.c b/src/x11/x11graph.c index f70bfd3b0..33ce6f7ba 100644 --- a/src/x11/x11graph.c +++ b/src/x11/x11graph.c @@ -215,7 +215,8 @@ x_graphics_reset_clip_rectangle (struct xwindow * xw) void x_graphics_set_clip_rectangle (struct xwindow * xw, - int x_left, int y_bottom, int x_right, int y_top) + float x_left, float y_bottom, + float x_right, float y_top) { set_clip_rectangle (xw, (X_COORDINATE (x_left, xw, -1)),