CLIM mail archive
[Prev][Next][Index][Thread]
Moving output records for fast translation
-
To: clim@BBN.COM
-
Subject: Moving output records for fast translation
-
From: Peter Karp <pkarp>
-
Date: Fri, 1 May 92 10:39:01 PDT
Imagine that a program has drawn a very complex picture, and it must
then translate some elements of that picture as quickly as possible.
My theory is that it will be faster to get CLIM to redraw the output
records associated with those picture elements, with a translation
applied, than it will be to completely redraw those picture elements
at the application level (particularly if much computation is required
at the application level).
Function shift-output-record below applies a translation to an output
record. This implementation was quite difficult to figure out. I am
posting this because it might be useful to others, and also to raise
the question of whether this functionality should be more prominently
documented in CLIM. The ability to perform operations such as this at
the output-record level seems like it should be a major performance
win for CLIM, but it is not sufficiently well documented for applications
to take advantage of it.
Peter
(defun shift-output-record (stream record dx dy)
(let (x y)
(multiple-value-bind (x-offset y-offset)
(clim:convert-from-relative-to-absolute-coordinates
stream (clim:output-record-parent record))
(clim:with-output-recording-options (stream :record-p nil :draw-p t)
(clos:with-slots (clim-utils:left clim-utils:top clim::parent)
record
(setq x clim-utils:left
y clim-utils:top)
(clim:erase-output-record record stream)
(clim::output-record-set-position* record (+ x dx) (+ y dy))
(clim::tree-recompute-extent record)
(clim:replay-1 record stream nil x-offset y-offset)
(clim:add-output-record stream record)
) ) ) ) )
Follow-Ups:
Main Index |
Thread Index