diff options
author | Rob Tsuk <robtsuk@google.com> | 2015-01-06 13:22:54 -0800 |
---|---|---|
committer | Rob Tsuk <robtsuk@google.com> | 2015-01-14 17:24:58 -0800 |
commit | 487a92caef2eb90a62e8f8d7a6fe6315f1c1d8d8 (patch) | |
tree | 6515f9b52f874f5f076a25df83a353de10a3da14 /libs/hwui/Rect.h | |
parent | 382d6a9ed2360ceb462ea46a60f0f106fdb52540 (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.h | 12 |
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); } |