CLIM mail archive
[Prev][Next][Index][Thread]
Translations and a fast highlight-output-record for lines
Date: Wed, 13 Jul 1994 15:48-0700
From: Gregory M Anderson <gma@BITTERROOT.apl.washington.edu>
Date: Wed, 13 Jul 1994 10:33 PDT
From: Scott McKay <swm@harlequin.com>
Date: Wed, 13 Jul 1994 09:21-0700
From: Gregory M Anderson <gma@bitterroot.apl.washington.edu>
In light of the discussion on replaying output records and the
difficulty in getting the translations correct, will the following
function always translate correctly, or have I just been lucky?
This should work, but the performance won't be as good as it could be.
(defmethod clim:highlight-output-record
((record clim-internals::lines-output-record) stream state)
(declare (ignore state))
(when stream
(multiple-value-bind (xoff yoff)
(convert-from-relative-to-absolute-coordinates
stream (output-record-parent record))
(with-translation (stream xoff yoff)
(with-drawing-options (stream :ink +flipping-ink+
:line-style (make-line-style :thickness 2))
(with-slots (clim-internals::position-seq) record
(medium-draw-lines* stream clim-internals::position-seq)))))))
It's a whole lot faster than the default line highlighting -- but how could the
I'm sure -- the default method draws a little 6-sided shape around
each line, so you are doing six times less work.
performance be improved?
There is a minor optimization that could be made by extracting the
medium from the stream (via SHEET-MEDIUM), and then doing the
WITH-DRAWING-OPTIONS and the MEDIUM-DRAW-LINES* on the medium instead
of on the stream.
I also suspect that this code might be consing an entirely new
sequence when it applies the transform to the position-seq. If you
can figure out a way to avoid consing, for example, by using a
resourced position-seq or by stack-consing, you will win.
References:
Main Index |
Thread Index