| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 3 * | 3 * |
| 4 * 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 |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkRasterClip.h" | 8 #include "SkRasterClip.h" |
| 9 | 9 |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 return this->updateCacheAndReturnNonEmpty(); | 86 return this->updateCacheAndReturnNonEmpty(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool SkRasterClip::setPath(const SkPath& path, const SkIRect& clip, bool doAA) { | 89 bool SkRasterClip::setPath(const SkPath& path, const SkIRect& clip, bool doAA) { |
| 90 SkRegion tmp; | 90 SkRegion tmp; |
| 91 tmp.setRect(clip); | 91 tmp.setRect(clip); |
| 92 return this->setPath(path, tmp, doAA); | 92 return this->setPath(path, tmp, doAA); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool SkRasterClip::setPath(const SkPath& path, const SkRasterClip& clip, | |
| 96 bool doAA) { | |
| 97 if (clip.isBW()) { | |
| 98 return this->setPath(path, clip.bwRgn(), doAA); | |
| 99 } else { | |
| 100 SkRegion tmp; | |
| 101 tmp.setRect(clip.getBounds()); | |
| 102 if (!this->setPath(path, clip, doAA)) { | |
| 103 return false; | |
| 104 } | |
| 105 return this->op(clip, SkRegion::kIntersect_Op); | |
| 106 } | |
| 107 } | |
| 108 | |
| 109 bool SkRasterClip::op(const SkIRect& rect, SkRegion::Op op) { | 95 bool SkRasterClip::op(const SkIRect& rect, SkRegion::Op op) { |
| 110 AUTO_RASTERCLIP_VALIDATE(*this); | 96 AUTO_RASTERCLIP_VALIDATE(*this); |
| 111 | 97 |
| 112 fIsBW ? fBW.op(rect, op) : fAA.op(rect, op); | 98 fIsBW ? fBW.op(rect, op) : fAA.op(rect, op); |
| 113 return this->updateCacheAndReturnNonEmpty(); | 99 return this->updateCacheAndReturnNonEmpty(); |
| 114 } | 100 } |
| 115 | 101 |
| 116 bool SkRasterClip::op(const SkRegion& rgn, SkRegion::Op op) { | 102 bool SkRasterClip::op(const SkRegion& rgn, SkRegion::Op op) { |
| 117 AUTO_RASTERCLIP_VALIDATE(*this); | 103 AUTO_RASTERCLIP_VALIDATE(*this); |
| 118 | 104 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 fBlitter = blitter; | 270 fBlitter = blitter; |
| 285 } else { | 271 } else { |
| 286 const SkAAClip& aaclip = clip.aaRgn(); | 272 const SkAAClip& aaclip = clip.aaRgn(); |
| 287 fBWRgn.setRect(aaclip.getBounds()); | 273 fBWRgn.setRect(aaclip.getBounds()); |
| 288 fAABlitter.init(blitter, &aaclip); | 274 fAABlitter.init(blitter, &aaclip); |
| 289 // now our return values | 275 // now our return values |
| 290 fClipRgn = &fBWRgn; | 276 fClipRgn = &fBWRgn; |
| 291 fBlitter = &fAABlitter; | 277 fBlitter = &fAABlitter; |
| 292 } | 278 } |
| 293 } | 279 } |
| OLD | NEW |