| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2005 The Android Open Source Project | 3 * Copyright 2005 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 | 9 |
| 10 #ifndef SkRegion_DEFINED | 10 #ifndef SkRegion_DEFINED |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 kLastOp = kReplace_Op | 248 kLastOp = kReplace_Op |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 static const int kOpCnt = kLastOp + 1; | 251 static const int kOpCnt = kLastOp + 1; |
| 252 | 252 |
| 253 /** | 253 /** |
| 254 * Set this region to the result of applying the Op to this region and the | 254 * Set this region to the result of applying the Op to this region and the |
| 255 * specified rectangle: this = (this op rect). | 255 * specified rectangle: this = (this op rect). |
| 256 * Return true if the resulting region is non-empty. | 256 * Return true if the resulting region is non-empty. |
| 257 */ | 257 */ |
| 258 bool op(const SkIRect& rect, Op op) { return this->op(*this, rect, op); } | 258 bool op(const SkIRect& rect, Op op) { |
| 259 if (this->isRect() && kIntersect_Op == op) { |
| 260 if (!fBounds.intersect(rect)) { |
| 261 return this->setEmpty(); |
| 262 } |
| 263 return true; |
| 264 } |
| 265 return this->op(*this, rect, op); |
| 266 } |
| 259 | 267 |
| 260 /** | 268 /** |
| 261 * Set this region to the result of applying the Op to this region and the | 269 * Set this region to the result of applying the Op to this region and the |
| 262 * specified rectangle: this = (this op rect). | 270 * specified rectangle: this = (this op rect). |
| 263 * Return true if the resulting region is non-empty. | 271 * Return true if the resulting region is non-empty. |
| 264 */ | 272 */ |
| 265 bool op(int left, int top, int right, int bottom, Op op) { | 273 bool op(int left, int top, int right, int bottom, Op op) { |
| 266 SkIRect rect; | 274 SkIRect rect; |
| 267 rect.set(left, top, right, bottom); | 275 rect.set(left, top, right, bottom); |
| 268 return this->op(*this, rect, op); | 276 return this->op(*this, rect, op); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*); | 451 static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*); |
| 444 | 452 |
| 445 friend struct RunHead; | 453 friend struct RunHead; |
| 446 friend class Iterator; | 454 friend class Iterator; |
| 447 friend class Spanerator; | 455 friend class Spanerator; |
| 448 friend class SkRgnBuilder; | 456 friend class SkRgnBuilder; |
| 449 friend class SkFlatRegion; | 457 friend class SkFlatRegion; |
| 450 }; | 458 }; |
| 451 | 459 |
| 452 #endif | 460 #endif |
| OLD | NEW |