diff options
Diffstat (limited to 'libs/hwui/Rect.h')
| -rw-r--r-- | libs/hwui/Rect.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h index 13265a9..c82082f 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,7 +252,22 @@ public: bottom = fmaxf(bottom, y); } - void dump(const char* label = NULL) const { + void expandToCoverRect(float otherLeft, float otherTop, float otherRight, float otherBottom) { + left = fminf(left, otherLeft); + top = fminf(top, otherTop); + right = fmaxf(right, otherRight); + bottom = fmaxf(bottom, otherBottom); + } + + 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); } |
