| * Copyright 2010 Google Inc. |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| int16_t fLeft, fTop, fRight, fBottom; |
| static GrIRect16 SK_WARN_UNUSED_RESULT MakeEmpty() { |
| static GrIRect16 SK_WARN_UNUSED_RESULT MakeWH(int16_t w, int16_t h) { |
| static GrIRect16 SK_WARN_UNUSED_RESULT MakeXYWH(int16_t x, int16_t y, int16_t w, int16_t h) { |
| r.set(x, y, x + w, y + h); |
| 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(int16_t left, int16_t top, int16_t right, int16_t bottom) { |
| void set(const SkIRect& r) { |
| fLeft = SkToS16(r.fLeft); |
| fRight = SkToS16(r.fRight); |
| fBottom = SkToS16(r.fBottom); |