Invalidation/Redraw of an ImageItem object
ET++ uses the
Invalidation/Redraw Pattern to optimize and
minimize redraws. Instead of redrawing parts of a window at the moment
the part becomes invalid, ET++ collects a series of invalid areas in a
geometric union of rectangles, and redraws the entire set regularly.
This helps eliminate drawing in cases where the area will soon be
redrawn, and tends to be considerably faster than the naive approach.
To illustrate the Invalidation/Redraw mechanism of ET++, we will examine the
specific example of an ImageItem object (a VObject representing a bitmap)
which needs to redraw itself, perhaps because its underlying bitmap picture
has changed.
Phase 1: Invalidating the ImageItem rectangle
- VObject::ForceRedraw()
- VObject::InvalidateRect()
- Window::InvalidateRect()
- WindowPort::InvalidateRect()
Note that no drawing has yet occurred. The drawing occurs in the second phase:
Phase 2: Redrawing the invalid area
- XWinSystem::Notify()
- WindowSystem::Update()
- WindowPort::DevUpdate()
- WindowPort::UpdateRect()
- VObject::DrawAll()
- VObject::DrawInner()
- ImageItem::Draw()
I also have a partial inheritance hierarchy.
Suggestions to ferrar@uiuc.edu.