This email relates to the bug described in: http://common-lisp.net/pipermail/mcclim-devel/2005-December/004334.html
I believe I have located the bug in Backends/CLX/medium.lisp, in the method `medium-draw-ellipse*'. Basically, the method assumes that if `end-angle' is negative, it will be necessary to add 2pi radians to the arc angle to make sure the arc will be drawn counter-clockwise (as the CLIM spec specifies), but this is not the case if start-angle is negative or 0 as well.
The attached patch fixes this issue, but it does not make McCLIM do as the bug reporter expects. The arc is vertically mirrored with respect to the expected location, but as far as I can see from the spec, this is actually where it should be placed, due to the negative scale-y argument to `with-scaling' - could this be a bug in the LispWorks implementation? In any case, erroneous positioning of the arc is probably not related to to the function I have patched, so it should be safe to commit.
Index: Backends/CLX/medium.lisp =================================================================== RCS file: /project/mcclim/cvsroot/mcclim/Backends/CLX/medium.lisp,v retrieving revision 1.72 diff -u -r1.72 medium.lisp --- Backends/CLX/medium.lisp 17 Feb 2006 14:16:39 -0000 1.72 +++ Backends/CLX/medium.lisp 12 Mar 2006 19:58:01 -0000 @@ -564,7 +564,8 @@ (with-transformed-position ((sheet-native-transformation (medium-sheet medium)) center-x center-y) (let* ((arc-angle (- end-angle start-angle)) - (arc-angle (if (< end-angle 0) + (arc-angle (if (and (< end-angle 0) + (>= start-angle 0)) (+ (* pi 2) arc-angle) arc-angle))) (with-clx-graphics (medium)
Troels Henriksen athas@sigkill.dk writes:
The attached patch fixes this issue
I should learn to test things better. The attached patch fixes this properly (and I'm reasonably sure that the bug reporters intended behavior is a bug in LispWorks).
Index: Backends/CLX/medium.lisp =================================================================== RCS file: /project/mcclim/cvsroot/mcclim/Backends/CLX/medium.lisp,v retrieving revision 1.72 diff -u -r1.72 medium.lisp --- Backends/CLX/medium.lisp 17 Feb 2006 14:16:39 -0000 1.72 +++ Backends/CLX/medium.lisp 14 Mar 2006 09:15:34 -0000 @@ -564,7 +564,7 @@ (with-transformed-position ((sheet-native-transformation (medium-sheet medium)) center-x center-y) (let* ((arc-angle (- end-angle start-angle)) - (arc-angle (if (< end-angle 0) + (arc-angle (if (< arc-angle 0) (+ (* pi 2) arc-angle) arc-angle))) (with-clx-graphics (medium) @@ -588,7 +588,7 @@ medium)) center-x center-y) (let* ((arc-angle (- end-angle start-angle)) - (arc-angle (if (< end-angle 0) + (arc-angle (if (< arc-angle 0) (+ (* pi 2) arc-angle) arc-angle)) (min-x (round-coordinate (- center-x radius)))
Troels Henriksen athas@sigkill.dk writes:
Troels Henriksen athas@sigkill.dk writes:
The attached patch fixes this issue
I should learn to test things better. The attached patch fixes this properly (and I'm reasonably sure that the bug reporters intended behavior is a bug in LispWorks).
Thank you; I've merged this patch, which seemed self-evidently right.
Cheers,
Christophe