Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| 11 #ifndef GrRect_DEFINED | 11 #ifndef GrRect_DEFINED |
| 12 #define GrRect_DEFINED | 12 #define GrRect_DEFINED |
| 13 | 13 |
| 14 #include "GrPoint.h" | 14 #include "GrPoint.h" |
| 15 #include "SkRect.h" | 15 #include "SkRect.h" |
| 16 #include "SkRRect.h" | |
| 16 | 17 |
| 17 typedef SkIRect GrIRect; | 18 typedef SkIRect GrIRect; |
| 18 typedef SkRect GrRect; | 19 typedef SkRect GrRect; |
|
robertphillips
2013/04/24 15:13:30
Do we really need to add a GrRRect?
jvanverth1
2013/04/24 19:02:27
Done.
| |
| 20 typedef SkRRect GrRRect; | |
| 19 | 21 |
| 20 struct GrIRect16 { | 22 struct GrIRect16 { |
| 21 int16_t fLeft, fTop, fRight, fBottom; | 23 int16_t fLeft, fTop, fRight, fBottom; |
| 22 | 24 |
| 23 int width() const { return fRight - fLeft; } | 25 int width() const { return fRight - fLeft; } |
| 24 int height() const { return fBottom - fTop; } | 26 int height() const { return fBottom - fTop; } |
| 25 int area() const { return this->width() * this->height(); } | 27 int area() const { return this->width() * this->height(); } |
| 26 bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } | 28 bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } |
| 27 | 29 |
| 28 void set(const GrIRect& r) { | 30 void set(const GrIRect& r) { |
| 29 fLeft = SkToS16(r.fLeft); | 31 fLeft = SkToS16(r.fLeft); |
| 30 fTop = SkToS16(r.fTop); | 32 fTop = SkToS16(r.fTop); |
| 31 fRight = SkToS16(r.fRight); | 33 fRight = SkToS16(r.fRight); |
| 32 fBottom = SkToS16(r.fBottom); | 34 fBottom = SkToS16(r.fBottom); |
| 33 } | 35 } |
| 34 }; | 36 }; |
| 35 | 37 |
| 36 #endif | 38 #endif |
| OLD | NEW |