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
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index b046b6f..1716cf0 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -111,6 +111,10 @@
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 @@
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);
}