OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "SkOpAngle.h" | 7 #include "SkOpAngle.h" |
8 #include "SkOpSegment.h" | 8 #include "SkOpSegment.h" |
9 #include "SkPathOpsCurve.h" | 9 #include "SkPathOpsCurve.h" |
10 #include "SkTSort.h" | 10 #include "SkTSort.h" |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 | 834 |
835 void SkOpAngle::setSpans() { | 835 void SkOpAngle::setSpans() { |
836 fUnorderable = false; | 836 fUnorderable = false; |
837 fLastMarked = nullptr; | 837 fLastMarked = nullptr; |
838 if (!fStart) { | 838 if (!fStart) { |
839 fUnorderable = true; | 839 fUnorderable = true; |
840 return; | 840 return; |
841 } | 841 } |
842 const SkOpSegment* segment = fStart->segment(); | 842 const SkOpSegment* segment = fStart->segment(); |
843 const SkPoint* pts = segment->pts(); | 843 const SkPoint* pts = segment->pts(); |
844 SkDEBUGCODE(fPart.fCurve.fVerb = SkPath::kCubic_Verb); | 844 SkDEBUGCODE(fPart.fCurve.fVerb = SkPath::kCubic_Verb); // required for SkDC
urve debug check |
845 SkDEBUGCODE(fPart.fCurve[2].fX = fPart.fCurve[2].fY = fPart.fCurve[3].fX = f
Part.fCurve[3].fY | 845 SkDEBUGCODE(fPart.fCurve[2].fX = fPart.fCurve[2].fY = fPart.fCurve[3].fX = f
Part.fCurve[3].fY |
846 = SK_ScalarNaN); | 846 = SK_ScalarNaN); // make the non-line part uninitialized |
847 SkDEBUGCODE(fPart.fCurve.fVerb = segment->verb()); | 847 SkDEBUGCODE(fPart.fCurve.fVerb = segment->verb()); // set the curve type f
or real |
848 segment->subDivide(fStart, fEnd, &fPart.fCurve); | 848 segment->subDivide(fStart, fEnd, &fPart.fCurve); // set at least the line
part if not more |
849 fOriginalCurvePart = fPart.fCurve; | 849 fOriginalCurvePart = fPart.fCurve; |
850 const SkPath::Verb verb = segment->verb(); | 850 const SkPath::Verb verb = segment->verb(); |
851 fPart.setCurveHullSweep(verb); | 851 fPart.setCurveHullSweep(verb); |
852 if (SkPath::kLine_Verb != verb && !fPart.isCurve()) { | 852 if (SkPath::kLine_Verb != verb && !fPart.isCurve()) { |
853 SkDLine lineHalf; | 853 SkDLine lineHalf; |
854 fPart.fCurve[1] = fPart.fCurve[SkPathOpsVerbToPoints(verb)]; | 854 fPart.fCurve[1] = fPart.fCurve[SkPathOpsVerbToPoints(verb)]; |
855 fOriginalCurvePart[1] = fPart.fCurve[1]; | 855 fOriginalCurvePart[1] = fPart.fCurve[1]; |
856 lineHalf[0].set(fPart.fCurve[0].asSkPoint()); | 856 lineHalf[0].set(fPart.fCurve[0].asSkPoint()); |
857 lineHalf[1].set(fPart.fCurve[1].asSkPoint()); | 857 lineHalf[1].set(fPart.fCurve[1].asSkPoint()); |
858 fTangentHalf.lineEndPoints(lineHalf); | 858 fTangentHalf.lineEndPoints(lineHalf); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 return true; | 997 return true; |
998 } | 998 } |
999 SkASSERT(s0dt0 != 0); | 999 SkASSERT(s0dt0 != 0); |
1000 double m = s0xt0 / s0dt0; | 1000 double m = s0xt0 / s0dt0; |
1001 double sDist = sweep[0].length() * m; | 1001 double sDist = sweep[0].length() * m; |
1002 double tDist = tweep[0].length() * m; | 1002 double tDist = tweep[0].length() * m; |
1003 bool useS = fabs(sDist) < fabs(tDist); | 1003 bool useS = fabs(sDist) < fabs(tDist); |
1004 double mFactor = fabs(useS ? this->distEndRatio(sDist) : rh->distEndRatio(tD
ist)); | 1004 double mFactor = fabs(useS ? this->distEndRatio(sDist) : rh->distEndRatio(tD
ist)); |
1005 return mFactor < 50; // empirically found limit | 1005 return mFactor < 50; // empirically found limit |
1006 } | 1006 } |
OLD | NEW |