aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index cf874cfa52..7b78305bb1 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -8,6 +8,7 @@
#include "GrConvexPolyEffect.h"
#include "GrInvariantOutput.h"
#include "SkPathPriv.h"
+#include "effects/GrConstColorProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
@@ -254,7 +255,16 @@ GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType type, const
SkScalar edges[3 * kMaxEdges];
SkPathPriv::FirstDirection dir;
- SkAssertResult(SkPathPriv::CheapComputeFirstDirection(path, &dir));
+ // The only way this should fail is if the clip is effectively a infinitely thin line. In that
+ // case nothing is inside the clip. It'd be nice to detect this at a higher level and either
+ // skip the draw or omit the clip element.
+ if (!SkPathPriv::CheapComputeFirstDirection(path, &dir)) {
+ if (GrProcessorEdgeTypeIsInverseFill(type)) {
+ return GrConstColorProcessor::Create(0xFFFFFFFF,
+ GrConstColorProcessor::kModulateRGBA_InputMode);
+ }
+ return GrConstColorProcessor::Create(0, GrConstColorProcessor::kIgnore_InputMode);
+ }
SkVector t;
if (nullptr == offset) {