[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re-draw of sub-views

>For some time now, I have noticed excessive redraw for sub-views.
>My understanding, from my limited Inside Mac library, was that a window has
>update region into which #_InvalRect and #_InvalRgn accumulate.
>As near as I can figure, MCL has broken with this practice and is doing
>something else entirely.
>Whatever this method is, it seems to be extremely expensive for the drawing
>sub-views.  Specifically, sub-views seem to be re-drawn when it is totally
>un-necessary.  This is bad for dialogs with many and/or complex sub-views.
>Today, I thought I would look into this and see if I could patch it.
>Unfortunately I was...a little too successful.  Now I have sub-views that
>won't redraw at all when a window is uncovered.
>But I am hoping somebody out there understands the window-redrawing system
>of MCL and/or the Mac and can tell me where to put calls to #_InvalRect to
>finish this patch.  I know I'm being overly simplistic here, but I'm
>The half-patch is commented out so that the problem can be seen first...

This excessive redrawing happens only for SIMPLE-VIEW's. If you put your
SEQUENCE-DIALOG-ITEM inside of a VIEW, it will not be redrawn unless
necessary. A SIMPLE-VIEW is drawn with its container's clip region, so
we can't do any optimization unless we assume that the VIEW-DRAW-CONTENTS
method won't draw outside of the VIEW-CORNERS of the view. I can work up
a patch that will make that assumption if you'd like, but I'm not entirely
convinced that it is the right way to go for everybody. If you have a large
number of subviews of your window, your redrawing will benefit from adding
a little hierarchy so that there are never more than a few views at any level.
Then view-draw-contents can quickly figure out that a VIEW and all of its
subviews do not need to be redrawn.

Sometimes I wish that I had never added SIMPLE-VIEW's to MCL. I think they
speed up redrawing, but the cognitive overload may not be worth it.