anchor.diff:                (max-x (round-coordinate (max left right)))
                 (max-y (round-coordinate (max top bottom))))
             (let ((^cleanup nil))
  -            (unwind-protect (xlib:draw-rectangle (port-lookup-mirror (port medium)
  -                                                                     (medium-sheet medium))
  -                                                 (medium-gcontext medium (medium-background medium))
  -                                                 (max #x-8000 (min #x7fff min-x))
  -                                                 (max #x-8000 (min #x7fff min-y))
  -                                                 (max 0 (min #xffff (- max-x min-x)))
  -                                                 (max 0 (min #xffff (- max-y min-y)))
  -                                                 t)
  +            (unwind-protect
  +                 (xlib:draw-rectangle (port-lookup-mirror (port medium)
  +                                                          (medium-sheet medium))
  +                                      (medium-gcontext medium (medium-background medium))
  +                                      (clamp min-x           #x-8000 #x7fff)
  +                                      (clamp min-y           #x-8000 #x7fff)
  +                                      (clamp (- max-x min-x) 0       #xffff)
  +                                      (clamp (- max-y min-y) 0       #xffff)
  +                                      t)
                 (mapc #'funcall ^cleanup))))))))
   
   (defmethod medium-beep ((medium clx-medium))
  
positive.code:                 (bottom (round-coordinate bottom)))
              ;; To clip rectangles, we just need to clamp the coordinates
              (xlib:draw-rectangle mirror gc
                                   (max #x-8000 (min #x7FFF left))
                                   (max #x-8000 (min #x7FFF top))
                                   (max 0 (min #xFFFF (- right left)))
                                   (max 0 (min #xFFFF (- bottom top)))
                                   filled)))))))
  
  (defmethod medium-draw-rectangles* ((medium clx-medium) position-seq filled)
    (assert (evenp (length position-seq)))
    (with-transformed-positions ((sheet-native-transformation
                                  (medium-sheet medium))
                                 position-seq)
      (with-clx-graphics () medium
        (let ((points (make-array 4 :fill-pointer 0)))
          (do-sequence ((left top right bottom) position-seq)
            (let ((min-x (round-coordinate left))
                  (max-x (round-coordinate right))
                  (min-y (round-coordinate top))
                  (max-y (round-coordinate bottom)))
              (vector-push-extend min-x points)
              (vector-push-extend min-y points)
              (vector-push-extend (- max-x min-x) points)
              (vector-push-extend (- max-y min-y) points)))
          (xlib:draw-rectangles mirror gc points filled)))))
  
  (defun %draw-rotated-ellipse (medium center-x center-y
                                radius-1-dx radius-1-dy
  
negative.code:                         (<= #x-8000 x2 #x7FFF) (<= #x-8000 y2 #x7FFF))
                     (xlib:draw-line mirror gc x1 y1 x2 y2))
                    (t
                     (let ((line (region-intersection (load-time-value
                                                       (make-rectangle* #x-8000 #x-8000 #x7FFF #x7FFF))
                                                      (make-line* x1 y1 x2 y2))))
                       (when (linep line)
                         (multiple-value-bind (x1 y1) (line-start-point* line)
                           (multiple-value-bind (x2 y2) (line-end-point* line)
                             (xlib:draw-line mirror gc
                                             (clamp (round-coordinate x1) #x-8000 #x7FFF)
                                             (clamp (round-coordinate y1) #x-8000 #x7FFF)
                                             (clamp (round-coordinate x2) #x-8000 #x7FFF)
                                             (clamp (round-coordinate y2) #x-8000 #x7FFF))))))))))))))
  
  (defmethod medium-draw-polygon* ((medium clx-medium) coord-seq closed filled)
    ;; TODO:
  