'From Squeak3.6beta of ''4 July 2003'' [latest update: #5373] on 24 July 2003 at 5:44:37 pm'! "Change Set: TransformMorphCaching-ar+efc Date: 24 July 2003 Author: Eddie Cottongim Cache the value of localSubmorphBounds, as suggested by Andreas, myself and others. Adds the iVar localBounds to do this. Value is computed lazily by the localSubmorphBounds method and cached. It is invalidated when layoutChanged it received. Class comment is changed to reflect this addition. Should yield 20-50% speedup in scrolling speed depending on the number of submorphs of the TransformMorph."! Morph subclass: #TransformMorph instanceVariableNames: 'transform smoothing localBounds ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Basic'! !TransformMorph commentStamp: 'efc 7/24/2003 17:01' prior: 0! A TransformMorph introduces a 2-D transformation between its (global) coordinates and the (local) coordinates of its submorphs, while also clipping all display to its bounds. Specifically, with no offset, angle or scaling, a submorph with coordinates (0@0) will appear exactly at the topLeft of the windowMorph (its position). Rotation and scaling are relative to the local origin, (0@0). instance var type description transform MorphicTransform The coordinate transform between my coordinates and the local coordinates of my submorphs. smoothing Boolean Perform smoothing of my contents during drawing localBounds Rectangle or nil caches the value of #localSubmorphBounds for performance TransformMorphs operate with two different display strategies, depending on whether the transformation is a pure translation or not. If so, then they simply use a clipping canvas and display their submorphs with the appropriate offset. If the transformation includes scaling or rotation, then a caching canvas is used, whose active area covers the fullBounds of the submorphs intersected with the source quadrilateral corresponding to the window bounds.! ]style[(392 32 13 16 113 7 65 9 522)f1,f1i,f1,f1LMorphicTransform Comment;,f1,f1LBoolean Comment;,f1,f1LRectangle Comment;,f1! !TransformMorph methodsFor: 'geometry' stamp: 'efc 7/24/2003 16:43'! layoutChanged "A submorph could have moved, thus changing my localBounds. Invalidate the cache." localBounds _ nil. ^super layoutChanged! ! !TransformMorph methodsFor: 'geometry' stamp: 'efc 7/24/2003 16:41'! localSubmorphBounds "Answer, in my coordinate system, the bounds of all my submorphs (or nil if no submorphs). We will cache this value for performance. The value is invalidated upon recieving #layoutChanged." localBounds ifNil:[ self submorphsDo:[:m | localBounds ifNil: [localBounds _ m fullBounds] ifNotNil: [localBounds _ localBounds quickMerge: m fullBounds]]. ]. ^ localBounds! !