This is not obvious at all. There could perfectly well be just onerectangle in the rectangle list even if the first rectangle is different
from the dirty rectangle. The only case where the dirty rectangle and
the first rectangle in the list is identical is when an area completely
within the window's work area is uncovered (e.g. by closing a dialog or
> 3b. redraw without using rectangle list (since there are no moreI don't think this optimisation can be measured. Yes, you save one call
> entries anyway)
to wind_get(), but at the cost of comparing two rectangles and also
complicating the code a bit.
Normally you would do something like...
wind_get(handle, WF_FIRSTXYWH, &r.x, &r.y, &r.w, &r.h);
while (r.w && r.h)
if (intersect(dirty, &r))
wind_get(handle, WF_NEXTXYWH, &r.x, &r.y, &r.w, &r.h);
It's probably a tiny bit faster, but not in real life because it only
affects single redraws like closing a dialog that's completely within
the window's work area. It has no effect in situations like dragging a
window across another window.