GrTessellator: avoid split with zero primary and out-of-range secondary.
Sometimes the intersector will return an intersection which is on the same primary sort criterion (eg., Y coordinate), but out-of-range on the secondary. We shouldn't do splits in this case. The only case we really care about is if it's less than one epsilon and greater than zero, and thus numerically unsplittable. Bug: 851914 Change-Id: Ia772763b6a66a14ca159cf409a832835244e83bc Reviewed-on: https://skia-review.googlesource.com/136803 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
b9177cfaa8
commit
13f3d8d4bc
@ -1199,7 +1199,7 @@ Vertex* create_sorted_vertex(const SkPoint& p, uint8_t alpha, VertexList* mesh,
|
||||
bool nearly_flat(Comparator& c, Edge* edge) {
|
||||
SkPoint diff = edge->fBottom->fPoint - edge->fTop->fPoint;
|
||||
float primaryDiff = c.fDirection == Comparator::Direction::kHorizontal ? diff.fX : diff.fY;
|
||||
return fabs(primaryDiff) < std::numeric_limits<float>::epsilon();
|
||||
return fabs(primaryDiff) < std::numeric_limits<float>::epsilon() && primaryDiff != 0.0f;
|
||||
}
|
||||
|
||||
SkPoint clamp(SkPoint p, SkPoint min, SkPoint max, Comparator& c) {
|
||||
|
@ -546,6 +546,20 @@ static SkPath create_path_37() {
|
||||
return path;
|
||||
}
|
||||
|
||||
// Reduction from crbug.com/851914.
|
||||
static SkPath create_path_38() {
|
||||
SkPath path;
|
||||
path.moveTo(14.400531768798828125, 17.711114883422851562);
|
||||
path.lineTo(14.621990203857421875, 171563104293879808);
|
||||
path.lineTo(14.027951240539550781, 872585759381520384);
|
||||
path.lineTo( 14.0216827392578125, 872665817571917824);
|
||||
path.lineTo(7.699314117431640625, -3417320793833472);
|
||||
path.moveTo(11.606547355651855469, 17.40966796875);
|
||||
path.lineTo( 7642114886926860288, 21.08358001708984375);
|
||||
path.lineTo(11.606547355651855469, 21.08358001708984375);
|
||||
return path;
|
||||
}
|
||||
|
||||
static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) {
|
||||
|
||||
SkPoint pts[2] = { {0, 0}, {1, 1} };
|
||||
@ -643,4 +657,5 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
|
||||
test_path(ctx, rtc.get(), create_path_35());
|
||||
test_path(ctx, rtc.get(), create_path_36());
|
||||
test_path(ctx, rtc.get(), create_path_37());
|
||||
test_path(ctx, rtc.get(), create_path_38(), SkMatrix(), GrAAType::kCoverage);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user