GrTessellator: when sanitizing contours, remove non-finite points.
NaNs can't be correctly sorted. Don't run the unit test on VK backend, since it requires large (>64K bytes) vertex buffer uploads. Bug: 757650 Change-Id: I667693f135a090a5d9076bb7a2ec6879fc06d645 Reviewed-on: https://skia-review.googlesource.com/37484 Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
cd71f115a8
commit
73e7f80aa1
@ -1168,6 +1168,9 @@ void sanitize_contours(VertexList* contours, int contourCnt, bool approximate) {
|
||||
if (coincident(prev->fPoint, v->fPoint)) {
|
||||
LOG("vertex %g,%g coincident; removing\n", v->fPoint.fX, v->fPoint.fY);
|
||||
contour->remove(v);
|
||||
} else if (!v->fPoint.isFinite()) {
|
||||
LOG("vertex %g,%g non-finite; removing\n", v->fPoint.fX, v->fPoint.fY);
|
||||
contour->remove(v);
|
||||
}
|
||||
prev = v;
|
||||
v = next;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrClip.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrContextPriv.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkShaderBase.h"
|
||||
#include "effects/GrPorterDuffXferProcessor.h"
|
||||
@ -362,6 +363,17 @@ static SkPath create_path_23() {
|
||||
return path;
|
||||
}
|
||||
|
||||
// A path which results in infs and nans when conics are converted to quads.
|
||||
static SkPath create_path_24() {
|
||||
SkPath path;
|
||||
path.moveTo(-2.20883e+37f, -1.02892e+37f);
|
||||
path.conicTo(-2.00958e+38f, -9.36107e+37f, -1.7887e+38f, -8.33215e+37f, 0.707107f);
|
||||
path.conicTo(-1.56782e+38f, -7.30323e+37f, 2.20883e+37f, 1.02892e+37f, 0.707107f);
|
||||
path.conicTo(2.00958e+38f, 9.36107e+37f, 1.7887e+38f, 8.33215e+37f, 0.707107f);
|
||||
path.conicTo(1.56782e+38f, 7.30323e+37f, -2.20883e+37f, -1.02892e+37f, 0.707107f);
|
||||
return path;
|
||||
}
|
||||
|
||||
static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) {
|
||||
SkPoint pts[2] = { {0, 0}, {1, 1} };
|
||||
SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE };
|
||||
@ -403,7 +415,6 @@ static void test_path(GrContext* ctx,
|
||||
|
||||
DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
|
||||
GrContext* ctx = ctxInfo.grContext();
|
||||
|
||||
sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext(
|
||||
SkBackingFit::kApprox,
|
||||
800, 800,
|
||||
@ -443,5 +454,9 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
|
||||
test_path(ctx, rtc.get(), create_path_21(), SkMatrix(), GrAAType::kCoverage);
|
||||
test_path(ctx, rtc.get(), create_path_22());
|
||||
test_path(ctx, rtc.get(), create_path_23());
|
||||
// TODO: implement large buffer uploads in VK and remove this check.
|
||||
if (ctx->contextPriv().getBackend() != kVulkan_GrBackend) {
|
||||
test_path(ctx, rtc.get(), create_path_24());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user