CLIM mail archive


Moving output records for fast translation

    Date: Fri, 1 May 1992 13:39 EDT
    From: Peter Karp <>

    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.


    (defun shift-output-record (stream record dx dy)
      (let (x y)
	(multiple-value-bind (x-offset y-offset)
			      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)
	    (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)
	    ) ) ) ) )

BTW, even this convoluted code is not enough due to some very poor
designs decisions made early in the CLIM 1.0 process.  Perhaps JGA will
send you a hack he just wrote that needs something like this.


Main Index | Thread Index