Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Unified Diff: src/gpu/effects/GrConvexPolyEffect.cpp

Issue 1839743002: Fix GrConvexPolyEffect to deal with line paths. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: revert irrelevant whitespace change Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« gm/convexpolyeffect.cpp ('K') | « gm/convexpolyeffect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrConvexPolyEffect.cpp
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index cf874cfa52604e1666ddecad3fec720d1063279a..082ea230f961a838b4b0fd9dd717d884a338252b 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include <effects/GrConstColorProcessor.h>
egdaniel 2016/03/28 21:42:13 using <...> here?
bsalomon 2016/03/28 21:52:54 Ugh, my IDE inserted this without me realizing it.
#include "GrConvexPolyEffect.h"
#include "GrInvariantOutput.h"
#include "SkPathPriv.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) {
« gm/convexpolyeffect.cpp ('K') | « gm/convexpolyeffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698