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 | |
434 // Now determine the previous Element's bound information taking into | 421 // Now determine the previous Element's bound information taking into |
435 // account that there may be no previous clip | 422 // account that there may be no previous clip |
436 SkRect prevFinite; | 423 SkRect prevFinite; |
437 SkClipStack::BoundsType prevType; | 424 SkClipStack::BoundsType prevType; |
438 | 425 |
439 if (NULL == prior) { | 426 if (NULL == prior) { |
440 // no prior clip means the entire plane is writable | 427 // no prior clip means the entire plane is writable |
441 prevFinite.setEmpty(); // there are no pixels that cannot be drawn to | 428 prevFinite.setEmpty(); // there are no pixels that cannot be drawn to |
442 prevType = kInsideOut_BoundsType; | 429 prevType = kInsideOut_BoundsType; |
443 } else { | 430 } else { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 | 888 |
902 void SkClipStack::dump() const { | 889 void SkClipStack::dump() const { |
903 B2TIter iter(*this); | 890 B2TIter iter(*this); |
904 const Element* e; | 891 const Element* e; |
905 while ((e = iter.next())) { | 892 while ((e = iter.next())) { |
906 e->dump(); | 893 e->dump(); |
907 SkDebugf("\n"); | 894 SkDebugf("\n"); |
908 } | 895 } |
909 } | 896 } |
910 #endif | 897 #endif |
OLD | NEW |