[mcclim-devel] CLX clear-area breakage

Nyef nyef at sc.am
Fri Feb 11 16:43:48 UTC 2005


Hello all.

medium-clear-area in Backends/CLX/medium.lisp isn't doing a transform 
from medium to device coordinates, nor is it clipping the coordinates to 
the limits allowed by CLX. This causes window-clear on streams with 
more than about 2800 lines (maybe less!) to break. Attached is a patch 
which should fix this.

-- 
--Alastair Bridgewater
-------------- next part --------------
Index: medium.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/Backends/CLX/medium.lisp,v
retrieving revision 1.65
diff -u -r1.65 medium.lisp
--- medium.lisp	18 Jan 2005 13:35:26 -0000	1.65
+++ medium.lisp	11 Feb 2005 16:35:29 -0000
@@ -965,13 +965,19 @@
   (xlib:display-force-output (clx-port-display (port medium))))
 
 (defmethod medium-clear-area ((medium clx-medium) left top right bottom)
-  (let ((min-x (round-coordinate (min left right)))
-	(min-y (round-coordinate (min top bottom)))
-	(max-x (round-coordinate (max left right)))
-	(max-y (round-coordinate (max top bottom))))
-    (xlib:clear-area (port-lookup-mirror (port medium) (medium-sheet medium))
-		     :x min-x :y min-y
-		     :width (- max-x min-x) :height (- max-y min-y))))
+  (let ((tr (sheet-native-transformation (medium-sheet medium))))
+    (with-transformed-position (tr left top)
+      (with-transformed-position (tr right bottom)
+	(let ((min-x (round-coordinate (min left right)))
+	      (min-y (round-coordinate (min top bottom)))
+	      (max-x (round-coordinate (max left right)))
+	      (max-y (round-coordinate (max top bottom))))
+	  (xlib:clear-area (port-lookup-mirror (port medium)
+					       (medium-sheet medium))
+			   :x (max #x-8000 (min #x7fff min-x))
+			   :y (max #x-8000 (min #x7fff min-y))
+			   :width (max 0 (min #xffff (- max-x min-x)))
+			   :height (max 0 (min #xffff (- max-y min-y)))))))))
 
 (defmethod medium-beep ((medium clx-medium))
   (xlib:bell (clx-port-display (port medium))))


More information about the mcclim-devel mailing list