summaryrefslogtreecommitdiff
path: root/libs/hwui/Rect.h
diff options
context:
space:
mode:
authorRob Tsuk <robtsuk@google.com>2015-01-06 13:22:54 -0800
committerRob Tsuk <robtsuk@google.com>2015-01-14 17:24:58 -0800
commit487a92caef2eb90a62e8f8d7a6fe6315f1c1d8d8 (patch)
tree6515f9b52f874f5f076a25df83a353de10a3da14 /libs/hwui/Rect.h
parent382d6a9ed2360ceb462ea46a60f0f106fdb52540 (diff)
Clipping performance improvements
Create a ClipArea class to handle tracking clip regions. This class can select the most efficient implementation depending on the types of clipping presented. ClipArea re-used the rectangle and region-based clipping implementations as well as adding a "list of rotated rectangles" approach that is more efficient for rotated views with children. Change-Id: I2133761a2462ebc0852b394220e265974b3086f0
Diffstat (limited to 'libs/hwui/Rect.h')
-rw-r--r--libs/hwui/Rect.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index b046b6fb8be9..1716cf0ccb91 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -111,6 +111,10 @@ public:
set(r.left, r.top, r.right, r.bottom);
}
+ inline void set(const SkIRect& r) {
+ set(r.left(), r.top(), r.right(), r.bottom());
+ }
+
inline float getWidth() const {
return right - left;
}
@@ -248,6 +252,14 @@ public:
bottom = fmaxf(bottom, y);
}
+ SkRect toSkRect() const {
+ return SkRect::MakeLTRB(left, top, right, bottom);
+ }
+
+ SkIRect toSkIRect() const {
+ return SkIRect::MakeLTRB(left, top, right, bottom);
+ }
+
void dump(const char* label = nullptr) const {
ALOGD("%s[l=%f t=%f r=%f b=%f]", label ? label : "Rect", left, top, right, bottom);
}