aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathUtils.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-06-09 14:43:49 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-09 14:43:58 +0000
commit7f95dfc3855f104a14a8c08255e1787de9a0afbc (patch)
tree5ade603c86da8dfe9fe8a177c01ccfb4bdfca971 /src/gpu/GrPathUtils.cpp
parent9466bf56946973475831005c96f18c170411b70b (diff)
Revert "Handle too many (or too large) paths in GrDefaultPathRenderer"
This reverts commit eb86b7094755a5fc1e49d22b4c5323f372344d61. Reason for revert: May be responsible for Command Buffer failure? Original change's description: > Handle too many (or too large) paths in GrDefaultPathRenderer > > PathGeoBuilder constructs the geometry with the same basic > technique as before, but allows interrupting the process > to emit multiple draws. > > Original test case was 2000 non-AA stroked circles, which > created ~66000 vertices. That now renders, as do various > tests with a single large path (as well as filled paths). > > TODO: I think that this could be extracted and re-used for > MSAA path renderer without too much work? I need to read > that code more carefully to make sure it lines up. > > Re-land of: https://skia-review.googlesource.com/18360 > > Bug: skia:6695 > Change-Id: Ibdedeb0ea2570a8847ba42328588bd7203411573 > Reviewed-on: https://skia-review.googlesource.com/18983 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Brian Osman <brianosman@google.com> TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:6695 Change-Id: I2cb010db502c315b3e2f7212818aea5503ecb28c Reviewed-on: https://skia-review.googlesource.com/19270 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrPathUtils.cpp')
-rw-r--r--src/gpu/GrPathUtils.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 918493982a..91a48f7b6b 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -11,6 +11,7 @@
#include "SkGeometry.h"
#include "SkMathPriv.h"
+static const int MAX_POINTS_PER_CURVE = 1 << 10;
static const SkScalar gMinCurveTol = 0.0001f;
SkScalar GrPathUtils::scaleToleranceToSrc(SkScalar devTol,
@@ -44,7 +45,7 @@ uint32_t GrPathUtils::quadraticPointCount(const SkPoint points[], SkScalar tol)
SkScalar d = points[1].distanceToLineSegmentBetween(points[0], points[2]);
if (!SkScalarIsFinite(d)) {
- return kMaxPointsPerCurve;
+ return MAX_POINTS_PER_CURVE;
} else if (d <= tol) {
return 1;
} else {
@@ -54,7 +55,7 @@ uint32_t GrPathUtils::quadraticPointCount(const SkPoint points[], SkScalar tol)
// 2^(log4(x)) = sqrt(x);
SkScalar divSqrt = SkScalarSqrt(d / tol);
if (((SkScalar)SK_MaxS32) <= divSqrt) {
- return kMaxPointsPerCurve;
+ return MAX_POINTS_PER_CURVE;
} else {
int temp = SkScalarCeilToInt(divSqrt);
int pow2 = GrNextPow2(temp);
@@ -64,7 +65,7 @@ uint32_t GrPathUtils::quadraticPointCount(const SkPoint points[], SkScalar tol)
if (pow2 < 1) {
pow2 = 1;
}
- return SkTMin(pow2, kMaxPointsPerCurve);
+ return SkTMin(pow2, MAX_POINTS_PER_CURVE);
}
}
}
@@ -104,13 +105,13 @@ uint32_t GrPathUtils::cubicPointCount(const SkPoint points[],
points[2].distanceToLineSegmentBetweenSqd(points[0], points[3]));
d = SkScalarSqrt(d);
if (!SkScalarIsFinite(d)) {
- return kMaxPointsPerCurve;
+ return MAX_POINTS_PER_CURVE;
} else if (d <= tol) {
return 1;
} else {
SkScalar divSqrt = SkScalarSqrt(d / tol);
if (((SkScalar)SK_MaxS32) <= divSqrt) {
- return kMaxPointsPerCurve;
+ return MAX_POINTS_PER_CURVE;
} else {
int temp = SkScalarCeilToInt(SkScalarSqrt(d / tol));
int pow2 = GrNextPow2(temp);
@@ -120,7 +121,7 @@ uint32_t GrPathUtils::cubicPointCount(const SkPoint points[],
if (pow2 < 1) {
pow2 = 1;
}
- return SkTMin(pow2, kMaxPointsPerCurve);
+ return SkTMin(pow2, MAX_POINTS_PER_CURVE);
}
}
}