Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/rectcache.h
00001 #ifndef _RECT_CACHE_H_
00002 #define _RECT_CACHE_H_
00003 
00004 #include "woopsiarray.h"
00005 #include "gadget.h"
00006 
00007 namespace WoopsiUI {
00008 
00014     class RectCache {
00015     public:
00016 
00021         RectCache(const Gadget* gadget);
00022 
00026         inline ~RectCache() {
00027             delete _foregroundRegions;
00028             delete _backgroundRegions;
00029         };
00030 
00034         void cache();
00035 
00039         inline void invalidate() {
00040             _foregroundInvalid = true;
00041             _backgroundInvalid = true;
00042         };
00043 
00049         inline WoopsiArray<Rect>* getBackgroundRegions() { return _backgroundRegions; };
00050 
00058         inline WoopsiArray<Rect>* getForegroundRegions() { return _foregroundRegions; };
00059 
00071         void splitRectangles(WoopsiArray<Rect>* invalidRectangles, WoopsiArray<Rect>* validRects) const;
00072 
00082         void removeOverlappedRects(WoopsiArray<Rect>* visibleRects, WoopsiArray<Rect>* invisibleRects, const Gadget* gadget) const;
00083 
00090         void markRectsDamaged() const;
00091         
00098         void markRectDamaged(const Rect& rect) const;
00099 
00100     private:
00101         WoopsiArray<Rect>* _foregroundRegions;              
00102         WoopsiArray<Rect>* _backgroundRegions;              
00103         const Gadget* _gadget;                              
00104         bool _foregroundInvalid;                            
00105         bool _backgroundInvalid;                            
00110         void cacheForegroundRegions();
00111 
00115         void cacheBackgroundRegions();
00116 
00117     };
00118 }
00119 
00120 #endif
 All Classes Functions Variables Enumerations Enumerator