OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 #include "SkRect.h" |
9 | 10 |
10 #include "SkRect.h" | 11 bool SkIRect::contains(const SkRect& r) const { |
| 12 return !r.isEmpty() && !this->isEmpty() && // check for empties |
| 13 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && |
| 14 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; |
| 15 } |
11 | 16 |
12 void SkIRect::join(int32_t left, int32_t top, int32_t right, int32_t bottom) { | 17 void SkIRect::join(int32_t left, int32_t top, int32_t right, int32_t bottom) { |
13 // do nothing if the params are empty | 18 // do nothing if the params are empty |
14 if (left >= right || top >= bottom) { | 19 if (left >= right || top >= bottom) { |
15 return; | 20 return; |
16 } | 21 } |
17 | 22 |
18 // if we are empty, just assign | 23 // if we are empty, just assign |
19 if (fLeft >= fRight || fTop >= fBottom) { | 24 if (fLeft >= fRight || fTop >= fBottom) { |
20 this->set(left, top, right, bottom); | 25 this->set(left, top, right, bottom); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 SkString strL, strT, strR, strB; | 160 SkString strL, strT, strR, strB; |
156 SkAppendScalarDec(&strL, fLeft); | 161 SkAppendScalarDec(&strL, fLeft); |
157 SkAppendScalarDec(&strT, fTop); | 162 SkAppendScalarDec(&strT, fTop); |
158 SkAppendScalarDec(&strR, fRight); | 163 SkAppendScalarDec(&strR, fRight); |
159 SkAppendScalarDec(&strB, fBottom); | 164 SkAppendScalarDec(&strB, fBottom); |
160 line.printf("SkRect::MakeLTRB(%s, %s, %s, %s);", | 165 line.printf("SkRect::MakeLTRB(%s, %s, %s, %s);", |
161 strL.c_str(), strT.c_str(), strR.c_str(), strB.c_str()); | 166 strL.c_str(), strT.c_str(), strR.c_str(), strB.c_str()); |
162 } | 167 } |
163 SkDebugf("%s\n", line.c_str()); | 168 SkDebugf("%s\n", line.c_str()); |
164 } | 169 } |
OLD | NEW |