Hi henrik
I added an issue http://code.google.com/p/pharo/issues/detail?id=629 so that we did not forget it Stef On Feb 25, 2009, at 2:36 PM, Henrik Johansen wrote: > Had a look at drawWorld:submorphs:invalidAreasOn: today, the > "Experimental top-down drawing" there does not seem to be working > optimally. > Basically, when there's many windows behind one you're resizing, > this many times leads to ALL of them getting repainted. > Attached is a fix for this, so only the system window areas which > are visible and affected are updated. > It will not speed up cases when resizing a complex morph (like the > Changes Log), but helps when resizing simple ones with many other > windows in the background. > If anyone interested in faster resizing (without fastDragWindow) > would review the code/check if it helps them it'd be nice. > A simple test is to open up a couple system browsers, put them on > top of eachother, and resize a simple window (Like the "Welcome to > Pharo" window) over their bounds. > Then load the changes, and see if you notice a difference. > In a test i did (same windows open/resized, as described above), > time spent in drawWorld:submorphs:invalidAreasOn: was reduced from > 86% to 65.7% after filing in changes. > > If anyone with a better understanding of Morphic know if anything > larger than the clippingBounds is safe to use as default in > Morph>>areasRemainingToFill: , that would probably help as well. > > Cheers, > Henry > 'From Pharo0.1 of 16 May 2008 [Latest update: #10243] on 25 February > 2009 at 2:30:25 pm'! > > !Morph methodsFor: 'drawing' stamp: 'Henrik Sperre Johansen > 2/25/2009 12:06'! > areasRemainingToFill: aRectangle > "May be overridden by any subclasses with opaque regions" > > ^ Array withAll: (aRectangle areasOutside: self clippingBounds)! ! > > > !WorldState methodsFor: 'update cycle' stamp: 'Henrik Sperre > Johansen 2/25/2009 13:52'! > drawWorld: aWorld submorphs: submorphs invalidAreasOn: aCanvas > "Redraw the damaged areas of the given canvas and clear the damage > list. Return a collection of the areas that > were redrawn." > > | rectList c i n mm morphs rects rectToFill remnants > remnantIntersects rect validList | > rectList := damageRecorder invalidRectsFullBounds: aWorld viewBox. > "sort by areas to draw largest portions first" > rectList := rectList asArray sort: [:r1 :r2 | r1 area > r2 area]. > damageRecorder reset. > n := submorphs size. > morphs := OrderedCollection new: n * 2. > rects := OrderedCollection new: n * 2. > validList := OrderedCollection new: n * 2. > rectList do: > [:dirtyRect | > dirtyRect allAreasOutsideList: validList > do: > [:r | > "Experimental top-down drawing -- > Traverses top to bottom, stopping if the entire area is filled. > If only a single rectangle remains, then continue with the > reduced rectangle." > > rectToFill := r. > remnants := OrderedCollection with: r. > i := 1. > [remnants isEmpty or: [i > n]] whileFalse: > [mm := submorphs at: i. > ((remnantIntersects := remnants select: [:each | (mm > fullBounds intersects: each)]) notEmpty and: [mm visible]) > ifTrue: > [morphs addLast: mm. > > rects addLast: (Rectangle merging: (remnantIntersects > collect: [:each | mm fullBounds intersect: each])). > remnants removeAll: remnantIntersects. > remnantIntersects do: [:eachIntersect | remnants addAll: > (mm areasRemainingToFill: eachIntersect)]. > remnants size = 1 ifTrue: [rectToFill := remnants first]. > remnants isEmpty ifTrue: [rectToFill := nil]]. > i := i + 1]. > "Now paint from bottom to top, but using the reduced rectangles." > rectToFill > ifNotNil: [aWorld drawOn: (c := aCanvas copyClipRect: > rectToFill)]. > [morphs isEmpty] whileFalse: > [(rect := rects removeLast) == rectToFill > ifFalse: [c := aCanvas copyClipRect: (rectToFill := rect)]. > c fullDrawMorph: morphs removeLast]. > morphs reset. > rects reset. > validList add: r]]. > ^validList! ! > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |