DIRECTORY Imager USING [Context, Rectangle, SampleMap, Transformation], Real USING [LargestNumber]; BufferedRefresh: CEDAR DEFINITIONS = BEGIN Rectangle: TYPE = Imager.Rectangle; SampleMap: TYPE = Imager.SampleMap; RefreshProc: TYPE = PROC [dc: Imager.Context, boundRect: Rectangle, clientData: REF ANY] RETURNS [drawnOn: BOOL _ TRUE]; Layer: TYPE = RECORD [name: ATOM, backingMap: BOOL, refreshProc: RefreshProc]; Sandwich: TYPE = REF SandwichObj; SandwichObj: TYPE = RECORD [ layers: LIST OF LayerData, clientToViewer: Imager.Transformation, -- the transforms most recently seen by DrawSandwich viewerToClient: Imager.Transformation, cw, ch: INTEGER _ 0, -- current "screen" size class: ATOM _ NIL -- current "screen" context class ]; LayerData: TYPE = REF LayerDataObj; LayerDataObj: TYPE = RECORD [ name: ATOM, refreshProc: RefreshProc, wantsMap, hasMap: BOOL, backingMap: SampleMap _ NIL, savedMap: SampleMap _ NIL, -- saved by BufferedRefresh.SaveLayer backingContext: Imager.Context _ NIL, -- derived from backingMap mapOK: BOOL _ FALSE, drawnOn: BOOL _ TRUE ]; CreateSandwich: PROC [layers: LIST OF Layer] RETURNS [sandwich: Sandwich]; FitSandwichToScreen: PROC [sandwich: Sandwich, cw, ch: INTEGER, screen: Imager.Context]; DrawSandwich: PROC [sandwich: Sandwich, screen: Imager.Context, clientToViewer, viewerToClient: Imager.Transformation, clientData: REF ANY, ignoreBackingMap: BOOL _ FALSE, noBuffer: BOOL _ FALSE, changeRect: Imager.Rectangle _ [-Real.LargestNumber, -Real.LargestNumber, Real.LargestNumber, Real.LargestNumber]]; SetLayerOK: PROC [sandwich: Sandwich, layerName: ATOM, ok: BOOL]; GetLayerOK: PROC [sandwich: Sandwich, layerName: ATOM] RETURNS [ok: BOOL]; RepairLayer: PROC [sandwich: Sandwich, layerName: ATOM, proc: RefreshProc, clientData: REF ANY _ NIL, clear: BOOL _ FALSE]; SaveLayer: PROC [sandwich: Sandwich, layerName: ATOM]; RestoreLayer: PROC [sandwich: Sandwich, layerName: ATOM]; END. &BufferedRefresh.mesa Copyright 1986, 1987, 1988 by Xerox Corporation. All rights reserved. Contents: Builds up an abstraction of transparent layers onto which shapes can be drawn. Each layer may have a backing pixel map, in which case it need not be redrawn when other layers change. This scheme is used by Gargoyle and Solidviews. Last edited by Bier on February 3, 1987 Doug Wyatt, June 28, 1988 12:01:34 pm PDT Bier, March 10, 1990 2:42:06 pm PST If drawnOn is FALSE, this layer can be ignored. [Artwork node; type 'ArtworkInterpress on' to command tool] Layers should be specified in back to front order. Draw the picture, derivable from the sandwich, on the screen. For backed layers that are OK, this will just dump the backing map on the screen. For backed layers that are not OK, this will remake the backing map by calling the refreshProc and dump the backing map on the screen. For unbacked layers, this will call the RefreshProc for that layer. Layers will be drawn in back-to-front order. All layers are initially NOT OK. If ignoreBackingMap is TRUE, all layers will be drawn by calling their refresh proc. Since we currently use 1 bit per pixel backing maps, this must be done to show colors. If noBuffer is TRUE, drawing will be done directly on the screen; otherwise Imager.DoWithBuffer will be called to update the screen atomically. viewerToClient is your way to tell BufferedRefresh what your BiScrollers are doing (if you use them). Gargoyle uses the incantation: [clientToViewer, viewerToClient] _ BiScrollers.GetStyle[].GetTransforms[BiScrollers.QuaBiScroller[gargoyleData.actionArea]]; Only that part of the screen that intersects changeRect will be drawn on. Using a small changeRect will noticeably improve performance on color displays. If the named layer has a backing map, and it is OK or clear is TRUE, then proc is called with a context for that map (after the map is cleared if clear is TRUE), and the backing map becomes OK. Otherwise, nothing happens. If the named layer is backed with a bitmap, that bitmap will be copied for later use (see RestoreLayer). If the named layer is backed with a bitmap, then that bitmap will be replaced by the bitmap that most recently was saved (see SaveLayer). This will only happen if the saved bitmap and the current bitmap are of the same size. codeKHHKK''K)K#Kk K1=KKKn $KIunit #K # 8 xIdefaultko/L NL  ! K K'c4[K&&K-K!3KL #K KKKK%@K!@KK KI artworkFigureG91.18092 mm topLeading 91.18092 mm topIndent 1.411111 mm bottomLeading Bounds90.0 mm xmin 0.0 mm ymin 171.8028 mm xmax 88.3587 mm ymax Artwork Interpress InterpressInterpress/Xerox/3.0 fjkj=8:rjn+XeroxResearch RGBLinear!+e2q5:'\!+!+e2q5:'\!+!W+e2q5'\!W+!W+e2q5'\!W+! +e2q5*'\! +! +e2q5*'\! + "+e2q5'\ "+ "+e2q5'\ "+!_Dk@:Via~m!_DkViaRu@LnG_AQ=SdIRu@ViaViaRu@LnG_AQ=SdIRu@ViaViaRu@SdIRu@ViaViaRu@SdIRu@ViaVia~mSdIViaVia~mSdIViaA7nk@:'dA7A7nk@:'dA7Via~mnkQ=Dk'dSdI~mA76/K16/iC@U*CzO:R6/K1S66/K1& S6rjeHxerox tiogafonts Helvetica14Screenkrj?emsxerox tiogafonts Helvetica14Client Coordinateskʬ 4#ʬEEC^I&ntuʬ 4#7x/ʬ 4#TErjbBxerox tiogafonts Helvetica14Viewportk#5-O9gf<E:{T*=a}.$O9gfı/ȗO9gf{Wݠݗa}.$?Ǘa}.$P)jUBVia`MSdIViaESdIQ=Ǚ_ASdIRu@ViaESdISdI~mQ=Dk7 'rj%_xerox tiogafonts Helvetica14viewerToClientkrjxerox tiogafonts Helvetica14clientToViewerke-e\ƙe\+rj5axerox tiogafonts Helvetica14Client SandwichkMMiMM  MM rj)xerox tiogafonts Helvetica14Sandwich BitmapskSdI`MQ=U;SdIQ=ǗSdIEQ=I 5kkg==  JK2LX r uKKKK||KL !AL !J !" |K !6Kh !9KKK"s