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