OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkScan.h" | 8 #include "SkScan.h" |
9 #include "SkBlitter.h" | 9 #include "SkBlitter.h" |
10 #include "SkMathPriv.h" | 10 #include "SkMathPriv.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 531 } |
532 | 532 |
533 SkPath::RawIter iter(path); | 533 SkPath::RawIter iter(path); |
534 SkPoint pts[4], firstPt, lastPt; | 534 SkPoint pts[4], firstPt, lastPt; |
535 SkPath::Verb verb, prevVerb; | 535 SkPath::Verb verb, prevVerb; |
536 SkAutoConicToQuads converter; | 536 SkAutoConicToQuads converter; |
537 | 537 |
538 if (SkPaint::kButt_Cap != capStyle) { | 538 if (SkPaint::kButt_Cap != capStyle) { |
539 prevVerb = SkPath::kDone_Verb; | 539 prevVerb = SkPath::kDone_Verb; |
540 } | 540 } |
541 bool firstPtSet = false; | |
542 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { | 541 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { |
543 switch (verb) { | 542 switch (verb) { |
544 case SkPath::kMove_Verb: | 543 case SkPath::kMove_Verb: |
545 firstPt = lastPt = pts[0]; | 544 firstPt = lastPt = pts[0]; |
546 firstPtSet = false; | |
547 break; | 545 break; |
548 case SkPath::kLine_Verb: | 546 case SkPath::kLine_Verb: |
549 if (SkPaint::kButt_Cap != capStyle) { | 547 if (SkPaint::kButt_Cap != capStyle) { |
550 extend_pts<capStyle>(prevVerb, iter.peek(), pts, 2); | 548 extend_pts<capStyle>(prevVerb, iter.peek(), pts, 2); |
551 } | 549 } |
552 lineproc(pts, 2, clip, blitter); | 550 lineproc(pts, 2, clip, blitter); |
553 lastPt = pts[1]; | 551 lastPt = pts[1]; |
554 break; | 552 break; |
555 case SkPath::kQuad_Verb: | 553 case SkPath::kQuad_Verb: |
556 if (SkPaint::kButt_Cap != capStyle) { | 554 if (SkPaint::kButt_Cap != capStyle) { |
(...skipping 30 matching lines...) Expand all Loading... |
587 pts[1] = firstPt; | 585 pts[1] = firstPt; |
588 if (SkPaint::kButt_Cap != capStyle && prevVerb == SkPath::kMove_
Verb) { | 586 if (SkPaint::kButt_Cap != capStyle && prevVerb == SkPath::kMove_
Verb) { |
589 // cap moveTo/close to match svg expectations for degenerate
segments | 587 // cap moveTo/close to match svg expectations for degenerate
segments |
590 extend_pts<capStyle>(prevVerb, iter.peek(), pts, 2); | 588 extend_pts<capStyle>(prevVerb, iter.peek(), pts, 2); |
591 } | 589 } |
592 lineproc(pts, 2, clip, blitter); | 590 lineproc(pts, 2, clip, blitter); |
593 break; | 591 break; |
594 case SkPath::kDone_Verb: | 592 case SkPath::kDone_Verb: |
595 break; | 593 break; |
596 } | 594 } |
597 if (!firstPtSet && SkPath::kLine_Verb <= verb && verb <= SkPath::kCubic_
Verb) { | |
598 firstPt = lastPt = pts[0]; | |
599 firstPtSet = true; | |
600 } | |
601 if (SkPaint::kButt_Cap != capStyle) { | 595 if (SkPaint::kButt_Cap != capStyle) { |
602 prevVerb = verb; | 596 prevVerb = verb; |
603 } | 597 } |
604 } | 598 } |
605 } | 599 } |
606 | 600 |
607 void SkScan::HairPath(const SkPath& path, const SkRasterClip& clip, SkBlitter* b
litter) { | 601 void SkScan::HairPath(const SkPath& path, const SkRasterClip& clip, SkBlitter* b
litter) { |
608 hair_path<SkPaint::kButt_Cap>(path, clip, blitter, SkScan::HairLineRgn); | 602 hair_path<SkPaint::kButt_Cap>(path, clip, blitter, SkScan::HairLineRgn); |
609 } | 603 } |
610 | 604 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 | 692 |
699 SkAAClipBlitterWrapper wrap; | 693 SkAAClipBlitterWrapper wrap; |
700 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { | 694 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { |
701 wrap.init(clip, blitter); | 695 wrap.init(clip, blitter); |
702 blitter = wrap.getBlitter(); | 696 blitter = wrap.getBlitter(); |
703 clipRgn = &wrap.getRgn(); | 697 clipRgn = &wrap.getRgn(); |
704 } | 698 } |
705 AntiHairLineRgn(pts, count, clipRgn, blitter); | 699 AntiHairLineRgn(pts, count, clipRgn, blitter); |
706 } | 700 } |
707 } | 701 } |
OLD | NEW |