summaryrefslogtreecommitdiffstats
path: root/include/ui
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-08-31 14:31:40 -0700
committerMathias Agopian <mathias@google.com>2012-08-31 18:38:22 -0700
commit3ab68558fa5a4b8f792a54965a010f03385bd271 (patch)
treeb2cc0e26815aff54e0d78480a7bff93288890427 /include/ui
parent4c0a170585d5c8a1f3508ac55f799ebaf86e91db (diff)
downloadframeworks_native-3ab68558fa5a4b8f792a54965a010f03385bd271.zip
frameworks_native-3ab68558fa5a4b8f792a54965a010f03385bd271.tar.gz
frameworks_native-3ab68558fa5a4b8f792a54965a010f03385bd271.tar.bz2
change how we store Region data internally
We used to keep the bounds of the region as a separate rectangle. Instead we now store it as the last element of the Vector<> of Rects. This has the benefit of being slightly more efficient when copying regions and reduces the overhead of small regions, but more importantly will allow us to export the underlaying SharedBuffer (eventually). Change-Id: I80790e4fb1a09a747a5616000cfef852ac4ce9e9
Diffstat (limited to 'include/ui')
-rw-r--r--include/ui/Region.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/ui/Region.h b/include/ui/Region.h
index f0819af..46a36ed 100644
--- a/include/ui/Region.h
+++ b/include/ui/Region.h
@@ -41,10 +41,10 @@ public:
Region& operator = (const Region& rhs);
- inline bool isEmpty() const { return mBounds.isEmpty(); }
- inline bool isRect() const { return mStorage.isEmpty(); }
+ inline bool isEmpty() const { return getBounds().isEmpty(); }
+ inline bool isRect() const { return mStorage.size() == 1; }
- inline Rect getBounds() const { return mBounds; }
+ inline Rect getBounds() const { return mStorage[mStorage.size() - 1]; }
inline Rect bounds() const { return getBounds(); }
// the region becomes its bounds
@@ -114,7 +114,6 @@ public:
/* no user serviceable parts here... */
- size_t getRects(Vector<Rect>& rectList) const;
Rect const* getArray(size_t* count) const;
@@ -156,8 +155,11 @@ private:
static bool validate(const Region& reg, const char* name);
- Rect mBounds;
- Vector<Rect> mStorage;
+ // mStorage is a (manually) sorted array of Rects describing the region
+ // with an extra Rect as the last element which is set to the
+ // bounds of the region. However, if the region is
+ // a simple Rect then mStorage contains only that rect.
+ Vector<Rect> mStorage;
};