Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions

# WoopsiUI::RectCache Class Reference

`#include <rectcache.h>`

List of all members.

## Public Member Functions
| RectCache (const Gadget *gadget)
| ~RectCache ()
void | cache ()
void | invalidate ()
WoopsiArray< Rect > * | getBackgroundRegions ()
WoopsiArray< Rect > * | getForegroundRegions ()
void | splitRectangles (WoopsiArray< Rect > *invalidRectangles, WoopsiArray< Rect > *validRects) const
void | removeOverlappedRects (WoopsiArray< Rect > *visibleRects, WoopsiArray< Rect > *invisibleRects, const Gadget *gadget) const
void | markRectsDamaged () const
void | markRectDamaged (const Rect &rect) const

## Detailed Description

Maintains a list of foreground (ie. above children) and background (with child overlapped-rects removed) rectangles representing the visible portions of a gadget.

## Constructor & Destructor Documentation

WoopsiUI::RectCache::RectCache | ( | const Gadget * | gadget | ) |

Constructor.

Parameters:

  gadget | Gadget that contains the rect cache.

WoopsiUI::RectCache::~RectCache | ( |  | ) | `[inline]`

Destructor.

## Member Function Documentation

void WoopsiUI::RectCache::cache | ( |  | ) |

Rebuild the cache if it is invalid.

WoopsiArray<Rect>* WoopsiUI::RectCache::getBackgroundRegions | ( |  | ) | `[inline]`

Return the list of background regions. These are regions that are not overlapped by child gadgets.

Returns:
  The list of background regions.

WoopsiArray<Rect>* WoopsiUI::RectCache::getForegroundRegions | ( |  | ) | `[inline]`

Return the list of foreground regions. These are regions that represent the entire visible surface of the gadget - that is, any regions not overlapped by ancestors or sublings of the gadget - including any regions that are actually overlapped by child gadgets.

Returns:
  The list of foreground regions.

void WoopsiUI::RectCache::invalidate | ( |  | ) | `[inline]`

Invalidates the cache.

void WoopsiUI::RectCache::markRectDamaged | ( | const Rect & | rect | ) | const

Marks a specific rect as dirty. The rect's co-ordinates should be in Woopsi-space. The rect is automatically clipped and split so that only regions of it that intersect the foreground rects are redrawn.

Parameters:

  rect | Rect to mark as dirty.

void WoopsiUI::RectCache::markRectsDamaged | ( |  | ) | const

Marks all foreground rects dirty. All rects are sent to the DisplayController for redraw. Since all foreground rects are sent, not background rects, this means that all of the owning gadget's children will also be redrawn next time the display is refreshed.

void WoopsiUI::RectCache::removeOverlappedRects | ( | WoopsiArray< Rect > * | visibleRects,
|  | WoopsiArray< Rect > * | invisibleRects,
|  | const Gadget * | gadget
| ) |  | const

Move any rectangles from the visibleRects list that overlap this gadget into the invisibleRects list. Used during visible region calculations.

Parameters:

  visibleRects | A vector of regions that are not overlapped.
  invisibleRects | A vector of regions that are overlapped.
  gadget | The gadget that requested the lists.

See also:
  splitRectangles()

void WoopsiUI::RectCache::splitRectangles | ( | WoopsiArray< Rect > * | invalidRectangles,
|  | WoopsiArray< Rect > * | validRects
| ) |  | const

Works out which rectangles in the invalidRectangles list overlap this gadget, then cuts the rectangles into smaller pieces. The overlapping pieces are pushed into validRects, and the non-overlapping pieces are pushed back into the invalidRects vector.

Parameters:

  invalidRectangles | A vector of regions that need to be tested for collisions against this gadget; they represent regions that need to be redrawn.
  validRects | A vector of regions that represents areas of the display that do not need to be redrawn.

The documentation for this class was generated from the following file:

- rectcache.h