summaryrefslogtreecommitdiffstats
path: root/libs/hwui/PathTessellator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/PathTessellator.cpp')
-rw-r--r--libs/hwui/PathTessellator.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index 310da41..547c877 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -152,13 +152,11 @@ public:
*/
inline int capExtraDivisions() const {
if (cap == SkPaint::kRound_Cap) {
+ // always use 2 points for hairline
if (halfStrokeWidth == 0.0f) return 2;
- // ROUND_CAP_THRESH is the maximum error for polygonal approximation of the round cap
- const float errConst = (-ROUND_CAP_THRESH / halfStrokeWidth + 1);
- const float targetCosVal = 2 * errConst * errConst - 1;
- int neededDivisions = (int)(ceilf(PI / acos(targetCosVal)/2)) * 2;
- return neededDivisions;
+ float threshold = MathUtils::min(inverseScaleX, inverseScaleY) * ROUND_CAP_THRESH;
+ return MathUtils::divisionsNeededToApproximateArc(halfStrokeWidth, PI, threshold);
}
return 0;
}