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 #include "SkPath.h" | 9 #include "SkPath.h" |
10 | 10 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // SkRgnBuilder::blitH(). We need to investigate what's going on. | 204 // SkRgnBuilder::blitH(). We need to investigate what's going on. |
205 return this->setPath(path, this->bwRgn(), doAA); | 205 return this->setPath(path, this->bwRgn(), doAA); |
206 } else { | 206 } else { |
207 base.setRect(this->getBounds()); | 207 base.setRect(this->getBounds()); |
208 SkRasterClip clip(fForceConservativeRects); | 208 SkRasterClip clip(fForceConservativeRects); |
209 clip.setPath(path, base, doAA); | 209 clip.setPath(path, base, doAA); |
210 return this->op(clip, op); | 210 return this->op(clip, op); |
211 } | 211 } |
212 } else { | 212 } else { |
213 base.setRect(bounds); | 213 base.setRect(bounds); |
214 | 214 |
215 if (SkRegion::kReplace_Op == op) { | 215 if (SkRegion::kReplace_Op == op) { |
216 return this->setPath(path, base, doAA); | 216 return this->setPath(path, base, doAA); |
217 } else { | 217 } else { |
218 SkRasterClip clip(fForceConservativeRects); | 218 SkRasterClip clip(fForceConservativeRects); |
219 clip.setPath(path, base, doAA); | 219 clip.setPath(path, base, doAA); |
220 return this->op(clip, op); | 220 return this->op(clip, op); |
221 } | 221 } |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 return !this->isEmpty(); | 295 return !this->isEmpty(); |
296 case kReplaceClippedAgainstGlobalBounds_MutateResult: | 296 case kReplaceClippedAgainstGlobalBounds_MutateResult: |
297 ir = bounds; | 297 ir = bounds; |
298 break; | 298 break; |
299 case kContinue_MutateResult: | 299 case kContinue_MutateResult: |
300 ir = r.roundOut(); | 300 ir = r.roundOut(); |
301 break; | 301 break; |
302 } | 302 } |
303 return this->op(ir, op); | 303 return this->op(ir, op); |
304 } | 304 } |
305 | 305 |
306 if (fIsBW && doAA) { | 306 if (fIsBW && doAA) { |
307 // check that the rect really needs aa, or is it close enought to | 307 // check that the rect really needs aa, or is it close enought to |
308 // integer boundaries that we can just treat it as a BW rect? | 308 // integer boundaries that we can just treat it as a BW rect? |
309 if (nearly_integral(r.fLeft) && nearly_integral(r.fTop) && | 309 if (nearly_integral(r.fLeft) && nearly_integral(r.fTop) && |
310 nearly_integral(r.fRight) && nearly_integral(r.fBottom)) { | 310 nearly_integral(r.fRight) && nearly_integral(r.fBottom)) { |
311 doAA = false; | 311 doAA = false; |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 if (fIsBW && !doAA) { | 315 if (fIsBW && !doAA) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 AUTO_RASTERCLIP_VALIDATE(*this); | 362 AUTO_RASTERCLIP_VALIDATE(*this); |
363 | 363 |
364 if (!fIsBW) { | 364 if (!fIsBW) { |
365 fBW.setRect(fAA.getBounds()); | 365 fBW.setRect(fAA.getBounds()); |
366 } | 366 } |
367 return fBW; | 367 return fBW; |
368 } | 368 } |
369 | 369 |
370 void SkRasterClip::convertToAA() { | 370 void SkRasterClip::convertToAA() { |
371 AUTO_RASTERCLIP_VALIDATE(*this); | 371 AUTO_RASTERCLIP_VALIDATE(*this); |
372 | 372 |
373 SkASSERT(!fForceConservativeRects); | 373 SkASSERT(!fForceConservativeRects); |
374 | 374 |
375 SkASSERT(fIsBW); | 375 SkASSERT(fIsBW); |
376 fAA.setRegion(fBW); | 376 fAA.setRegion(fBW); |
377 fIsBW = false; | 377 fIsBW = false; |
378 | 378 |
379 // since we are being explicitly asked to convert-to-aa, we pass false so we
don't "optimize" | 379 // since we are being explicitly asked to convert-to-aa, we pass false so we
don't "optimize" |
380 // ourselves back to BW. | 380 // ourselves back to BW. |
381 (void)this->updateCacheAndReturnNonEmpty(false); | 381 (void)this->updateCacheAndReturnNonEmpty(false); |
382 } | 382 } |
383 | 383 |
384 #ifdef SK_DEBUG | 384 #ifdef SK_DEBUG |
385 void SkRasterClip::validate() const { | 385 void SkRasterClip::validate() const { |
386 // can't ever assert that fBW is empty, since we may have called forceGetBW | 386 // can't ever assert that fBW is empty, since we may have called forceGetBW |
387 if (fIsBW) { | 387 if (fIsBW) { |
388 SkASSERT(fAA.isEmpty()); | 388 SkASSERT(fAA.isEmpty()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 fBlitter = blitter; | 426 fBlitter = blitter; |
427 } else { | 427 } else { |
428 const SkAAClip& aaclip = clip.aaRgn(); | 428 const SkAAClip& aaclip = clip.aaRgn(); |
429 fBWRgn.setRect(aaclip.getBounds()); | 429 fBWRgn.setRect(aaclip.getBounds()); |
430 fAABlitter.init(blitter, &aaclip); | 430 fAABlitter.init(blitter, &aaclip); |
431 // now our return values | 431 // now our return values |
432 fClipRgn = &fBWRgn; | 432 fClipRgn = &fBWRgn; |
433 fBlitter = &fAABlitter; | 433 fBlitter = &fAABlitter; |
434 } | 434 } |
435 } | 435 } |
OLD | NEW |