OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkClipStack.h" | 9 #include "SkClipStack.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 fFiniteBoundType = kInsideOut_BoundsType; | 411 fFiniteBoundType = kInsideOut_BoundsType; |
412 } else { | 412 } else { |
413 fFiniteBoundType = kNormal_BoundsType; | 413 fFiniteBoundType = kNormal_BoundsType; |
414 } | 414 } |
415 break; | 415 break; |
416 case kEmpty_Type: | 416 case kEmpty_Type: |
417 SkDEBUGFAIL("We shouldn't get here with an empty element."); | 417 SkDEBUGFAIL("We shouldn't get here with an empty element."); |
418 break; | 418 break; |
419 } | 419 } |
420 | 420 |
| 421 if (!fDoAA) { |
| 422 // Here we mimic a non-anti-aliased scanline system. If there is |
| 423 // no anti-aliasing we can integerize the bounding box to exclude |
| 424 // fractional parts that won't be rendered. |
| 425 // Note: the left edge is handled slightly differently below. We |
| 426 // are a bit more generous in the rounding since we don't want to |
| 427 // risk missing the left pixels when fLeft is very close to .5 |
| 428 fFiniteBound.set(SkScalarFloorToScalar(fFiniteBound.fLeft+0.45f), |
| 429 SkScalarRoundToScalar(fFiniteBound.fTop), |
| 430 SkScalarRoundToScalar(fFiniteBound.fRight), |
| 431 SkScalarRoundToScalar(fFiniteBound.fBottom)); |
| 432 } |
| 433 |
421 // Now determine the previous Element's bound information taking into | 434 // Now determine the previous Element's bound information taking into |
422 // account that there may be no previous clip | 435 // account that there may be no previous clip |
423 SkRect prevFinite; | 436 SkRect prevFinite; |
424 SkClipStack::BoundsType prevType; | 437 SkClipStack::BoundsType prevType; |
425 | 438 |
426 if (NULL == prior) { | 439 if (NULL == prior) { |
427 // no prior clip means the entire plane is writable | 440 // no prior clip means the entire plane is writable |
428 prevFinite.setEmpty(); // there are no pixels that cannot be drawn to | 441 prevFinite.setEmpty(); // there are no pixels that cannot be drawn to |
429 prevType = kInsideOut_BoundsType; | 442 prevType = kInsideOut_BoundsType; |
430 } else { | 443 } else { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 | 901 |
889 void SkClipStack::dump() const { | 902 void SkClipStack::dump() const { |
890 B2TIter iter(*this); | 903 B2TIter iter(*this); |
891 const Element* e; | 904 const Element* e; |
892 while ((e = iter.next())) { | 905 while ((e = iter.next())) { |
893 e->dump(); | 906 e->dump(); |
894 SkDebugf("\n"); | 907 SkDebugf("\n"); |
895 } | 908 } |
896 } | 909 } |
897 #endif | 910 #endif |
OLD | NEW |