OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 #include "SkBuffer.h" | 10 #include "SkBuffer.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 } | 507 } |
508 case kQuad_Verb: | 508 case kQuad_Verb: |
509 case kConic_Verb: | 509 case kConic_Verb: |
510 case kCubic_Verb: | 510 case kCubic_Verb: |
511 return false; // quadratic, cubic not allowed | 511 return false; // quadratic, cubic not allowed |
512 case kMove_Verb: | 512 case kMove_Verb: |
513 last = *pts++; | 513 last = *pts++; |
514 closedOrMoved = true; | 514 closedOrMoved = true; |
515 break; | 515 break; |
516 default: | 516 default: |
517 SkASSERT(!"unexpected verb"); | 517 SkDEBUGFAIL("unexpected verb"); |
518 break; | 518 break; |
519 } | 519 } |
520 *currVerb += 1; | 520 *currVerb += 1; |
521 lastDirection = nextDirection; | 521 lastDirection = nextDirection; |
522 } | 522 } |
523 // Success if 4 corners and first point equals last | 523 // Success if 4 corners and first point equals last |
524 bool result = 4 == corners && (first == last || autoClose); | 524 bool result = 4 == corners && (first == last || autoClose); |
525 if (savePts) { | 525 if (savePts) { |
526 *ptsPtr = savePts; | 526 *ptsPtr = savePts; |
527 } | 527 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 case kMove_Verb: { | 851 case kMove_Verb: { |
852 SkPathRef::Editor ed(&fPathRef); | 852 SkPathRef::Editor ed(&fPathRef); |
853 ed.growForVerb(kClose_Verb); | 853 ed.growForVerb(kClose_Verb); |
854 GEN_ID_INC; | 854 GEN_ID_INC; |
855 break; | 855 break; |
856 } | 856 } |
857 case kClose_Verb: | 857 case kClose_Verb: |
858 // don't add a close if it's the first verb or a repeat | 858 // don't add a close if it's the first verb or a repeat |
859 break; | 859 break; |
860 default: | 860 default: |
861 SkASSERT(!"unexpected verb"); | 861 SkDEBUGFAIL("unexpected verb"); |
862 break; | 862 break; |
863 } | 863 } |
864 } | 864 } |
865 | 865 |
866 // signal that we need a moveTo to follow us (unless we're done) | 866 // signal that we need a moveTo to follow us (unless we're done) |
867 #if 0 | 867 #if 0 |
868 if (fLastMoveToIndex >= 0) { | 868 if (fLastMoveToIndex >= 0) { |
869 fLastMoveToIndex = ~fLastMoveToIndex; | 869 fLastMoveToIndex = ~fLastMoveToIndex; |
870 } | 870 } |
871 #else | 871 #else |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 case kConic_Verb: | 1587 case kConic_Verb: |
1588 this->conicTo(pts[1], pts[0], *--conicWeights); | 1588 this->conicTo(pts[1], pts[0], *--conicWeights); |
1589 break; | 1589 break; |
1590 case kCubic_Verb: | 1590 case kCubic_Verb: |
1591 this->cubicTo(pts[2], pts[1], pts[0]); | 1591 this->cubicTo(pts[2], pts[1], pts[0]); |
1592 break; | 1592 break; |
1593 case kClose_Verb: | 1593 case kClose_Verb: |
1594 needClose = true; | 1594 needClose = true; |
1595 break; | 1595 break; |
1596 default: | 1596 default: |
1597 SkASSERT(!"unexpected verb"); | 1597 SkDEBUGFAIL("unexpected verb"); |
1598 } | 1598 } |
1599 } | 1599 } |
1600 } | 1600 } |
1601 | 1601 |
1602 /////////////////////////////////////////////////////////////////////////////// | 1602 /////////////////////////////////////////////////////////////////////////////// |
1603 | 1603 |
1604 void SkPath::offset(SkScalar dx, SkScalar dy, SkPath* dst) const { | 1604 void SkPath::offset(SkScalar dx, SkScalar dy, SkPath* dst) const { |
1605 SkMatrix matrix; | 1605 SkMatrix matrix; |
1606 | 1606 |
1607 matrix.setTranslate(dx, dy); | 1607 matrix.setTranslate(dx, dy); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 case kMove_Verb: | 1655 case kMove_Verb: |
1656 tmp.moveTo(pts[0]); | 1656 tmp.moveTo(pts[0]); |
1657 break; | 1657 break; |
1658 case kLine_Verb: | 1658 case kLine_Verb: |
1659 tmp.lineTo(pts[1]); | 1659 tmp.lineTo(pts[1]); |
1660 break; | 1660 break; |
1661 case kQuad_Verb: | 1661 case kQuad_Verb: |
1662 subdivide_quad_to(&tmp, pts); | 1662 subdivide_quad_to(&tmp, pts); |
1663 break; | 1663 break; |
1664 case kConic_Verb: | 1664 case kConic_Verb: |
1665 SkASSERT(!"TODO: compute new weight"); | 1665 SkDEBUGFAIL("TODO: compute new weight"); |
1666 tmp.conicTo(pts[1], pts[2], iter.conicWeight()); | 1666 tmp.conicTo(pts[1], pts[2], iter.conicWeight()); |
1667 break; | 1667 break; |
1668 case kCubic_Verb: | 1668 case kCubic_Verb: |
1669 subdivide_cubic_to(&tmp, pts); | 1669 subdivide_cubic_to(&tmp, pts); |
1670 break; | 1670 break; |
1671 case kClose_Verb: | 1671 case kClose_Verb: |
1672 tmp.close(); | 1672 tmp.close(); |
1673 break; | 1673 break; |
1674 default: | 1674 default: |
1675 SkDEBUGFAIL("unknown verb"); | 1675 SkDEBUGFAIL("unknown verb"); |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2491 // fall-through | 2491 // fall-through |
2492 case SkPath::kQuad_Verb: | 2492 case SkPath::kQuad_Verb: |
2493 ptCount += 2; | 2493 ptCount += 2; |
2494 break; | 2494 break; |
2495 case SkPath::kCubic_Verb: | 2495 case SkPath::kCubic_Verb: |
2496 ptCount += 3; | 2496 ptCount += 3; |
2497 break; | 2497 break; |
2498 case SkPath::kClose_Verb: | 2498 case SkPath::kClose_Verb: |
2499 break; | 2499 break; |
2500 default: | 2500 default: |
2501 SkASSERT(!"unexpected verb"); | 2501 SkDEBUGFAIL("unexpected verb"); |
2502 break; | 2502 break; |
2503 } | 2503 } |
2504 } | 2504 } |
2505 CONTOUR_END: | 2505 CONTOUR_END: |
2506 fCurrPtCount = ptCount; | 2506 fCurrPtCount = ptCount; |
2507 fCurrVerb = verbs; | 2507 fCurrVerb = verbs; |
2508 SkDEBUGCODE(++fContourCounter;) | 2508 SkDEBUGCODE(++fContourCounter;) |
2509 } | 2509 } |
2510 | 2510 |
2511 // returns cross product of (p1 - p0) and (p2 - p0) | 2511 // returns cross product of (p1 - p0) and (p2 - p0) |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3005 switch (this->getFillType()) { | 3005 switch (this->getFillType()) { |
3006 case SkPath::kEvenOdd_FillType: | 3006 case SkPath::kEvenOdd_FillType: |
3007 case SkPath::kInverseEvenOdd_FillType: | 3007 case SkPath::kInverseEvenOdd_FillType: |
3008 w &= 1; | 3008 w &= 1; |
3009 break; | 3009 break; |
3010 default: | 3010 default: |
3011 break; | 3011 break; |
3012 } | 3012 } |
3013 return SkToBool(w); | 3013 return SkToBool(w); |
3014 } | 3014 } |
OLD | NEW |