[squeak-dev] duplicated rectangles in DamageRecorder

Juan Vuletich juan at jvuletich.org
Fri Oct 2 11:53:26 UTC 2009


Hi Yoshiki,

Yoshiki Ohshima wrote:
>   Hello,
>
>   I noticed that I often get duplicated (i.e. equal) rectangles in
> invalidRects of DamageRecorder.
>
>   In #recordInvalidRect: you make the part to read:
>
> 	invalidRects do:
> 		[:rect |
> 		       (newRect origin = rect origin and: [newRect corner = rect corner])
> 		       	 ifTrue: [Display reverse: newRect].
>                        ...
>
> and you'll see when it happens.
>
>   If I understand it correctly the duplicate there doesn't result in
> multiple drawing (via the 'validList' logic), but I do see a bit of
> improvement in browser opening benchmarks etc. (2% or such, could be
> just jitter, though), if I change "Display reverse: newRect" to "^
> self".
>
>   I'd like to hear if this makes any sense, or more consistent
> benchmark results, etc.
>
> -- Yoshiki
>   

Playing a bit with it (in Cuis), it seems to happen because of unneeded 
calls to #changed. I could avoid some of them by making property setter 
methods do nothing if the property is set. For example, 
BorderedMorph>>#borderWidth: TextMorph>>#backgroundColor: and 
TransformMorph>>#offset can use a check with the argument and just exit, 
like for example Morph>>#extent:. Besides, 
MenuMorph>>#popUpAt:forHand:in:allowKeyboard: does not need the last 
line (self changed).

In any case, unneeded calls to self changed are usual, as it says in the 
last comment of TextMorph>>#fit. So, I think that the check and early 
exit you propose in #recordInvalidRect: is a good idea and will include 
it in Cuis.

Cheers,
Juan Vuletich



More information about the Squeak-dev mailing list