summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/skia/include/gpu/GrRect.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia/include/gpu/GrRect.h')
-rw-r--r--chromium/third_party/skia/include/gpu/GrRect.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/chromium/third_party/skia/include/gpu/GrRect.h b/chromium/third_party/skia/include/gpu/GrRect.h
index cacc5117b53..ddb23b5a19c 100644
--- a/chromium/third_party/skia/include/gpu/GrRect.h
+++ b/chromium/third_party/skia/include/gpu/GrRect.h
@@ -14,11 +14,19 @@
struct GrIRect16 {
int16_t fLeft, fTop, fRight, fBottom;
+ static GrIRect16 SK_WARN_UNUSED_RESULT MakeEmpty() {
+ GrIRect16 r;
+ r.setEmpty();
+ return r;
+ }
+
int width() const { return fRight - fLeft; }
int height() const { return fBottom - fTop; }
int area() const { return this->width() * this->height(); }
bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
+ void setEmpty() { memset(this, 0, sizeof(*this)); }
+
void set(const SkIRect& r) {
fLeft = SkToS16(r.fLeft);
fTop = SkToS16(r.fTop);