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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 } | 1009 } |
1010 if ((fSectorEnd & 3) == 3) { | 1010 if ((fSectorEnd & 3) == 3) { |
1011 fSectorEnd = (fSectorEnd + (curveBendsCCW ? 31 : 1)) & 0x1f; | 1011 fSectorEnd = (fSectorEnd + (curveBendsCCW ? 31 : 1)) & 0x1f; |
1012 } | 1012 } |
1013 crossesZero = this->checkCrossesZero(); | 1013 crossesZero = this->checkCrossesZero(); |
1014 start = SkTMin(fSectorStart, fSectorEnd); | 1014 start = SkTMin(fSectorStart, fSectorEnd); |
1015 int end = SkTMax(fSectorStart, fSectorEnd); | 1015 int end = SkTMax(fSectorStart, fSectorEnd); |
1016 if (!crossesZero) { | 1016 if (!crossesZero) { |
1017 fSectorMask = (unsigned) -1 >> (31 - end + start) << start; | 1017 fSectorMask = (unsigned) -1 >> (31 - end + start) << start; |
1018 } else { | 1018 } else { |
1019 fSectorMask = (unsigned) -1 >> (31 - start) | (-1 << end); | 1019 fSectorMask = (unsigned) -1 >> (31 - start) | ((unsigned) -1 << end); |
1020 } | 1020 } |
1021 } | 1021 } |
1022 | 1022 |
1023 SkOpSpan* SkOpAngle::starter() { | 1023 SkOpSpan* SkOpAngle::starter() { |
1024 return fStart->starter(fEnd); | 1024 return fStart->starter(fEnd); |
1025 } | 1025 } |
1026 | 1026 |
1027 bool SkOpAngle::tangentsDiverge(const SkOpAngle* rh, double s0xt0) const { | 1027 bool SkOpAngle::tangentsDiverge(const SkOpAngle* rh, double s0xt0) const { |
1028 if (s0xt0 == 0) { | 1028 if (s0xt0 == 0) { |
1029 return false; | 1029 return false; |
(...skipping 14 matching lines...) Expand all Loading... |
1044 return true; | 1044 return true; |
1045 } | 1045 } |
1046 SkASSERT(s0dt0 != 0); | 1046 SkASSERT(s0dt0 != 0); |
1047 double m = s0xt0 / s0dt0; | 1047 double m = s0xt0 / s0dt0; |
1048 double sDist = sweep[0].length() * m; | 1048 double sDist = sweep[0].length() * m; |
1049 double tDist = tweep[0].length() * m; | 1049 double tDist = tweep[0].length() * m; |
1050 bool useS = fabs(sDist) < fabs(tDist); | 1050 bool useS = fabs(sDist) < fabs(tDist); |
1051 double mFactor = fabs(useS ? this->distEndRatio(sDist) : rh->distEndRatio(tD
ist)); | 1051 double mFactor = fabs(useS ? this->distEndRatio(sDist) : rh->distEndRatio(tD
ist)); |
1052 return mFactor < 2400; // empirically found limit | 1052 return mFactor < 2400; // empirically found limit |
1053 } | 1053 } |
OLD | NEW |