ccpr: Preserve fill rules for cached paths
Fixes a bug where even-odd fill rule was not being preserved on paths
that were reused from a stashed fp16 coverage count atlas.
Bug: skia:8782
Change-Id: I6698498a6f4c8df8eff10b19beb80e49663a577c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218047
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index 19f854f..612251b 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -358,8 +358,8 @@
#endif
op->recordInstance(fCacheEntry->cachedAtlas()->getOnFlushProxy(),
resources->nextPathInstanceIdx());
- resources->appendDrawPathInstance().set(*fCacheEntry, fCachedMaskShift,
- SkPMColor4f_toFP16(fColor));
+ resources->appendDrawPathInstance().set(
+ *fCacheEntry, fCachedMaskShift, SkPMColor4f_toFP16(fColor), doEvenOddFill);
return;
}
}
diff --git a/src/gpu/ccpr/GrCCPathProcessor.cpp b/src/gpu/ccpr/GrCCPathProcessor.cpp
index 96d88a7..3cd07ed 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPathProcessor.cpp
@@ -166,8 +166,8 @@
// find an octagon that circumscribes the (bloated) path.
GrGLSLVertexBuilder* v = args.fVertBuilder;
- // Are we clockwise (positive wind, nonzero fill), or counter-clockwise (negative wind,
- // even/odd fill)?
+ // Are we clockwise? (Positive wind => nonzero fill rule.)
+ // Or counter-clockwise? (negative wind => even/odd fill rule.)
v->codeAppendf("float wind = sign(devbounds.z - devbounds.x);");
// Find our reference corner from the device-space bounding box.
diff --git a/src/gpu/ccpr/GrCCPathProcessor.h b/src/gpu/ccpr/GrCCPathProcessor.h
index 416cdb1..1243340 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.h
+++ b/src/gpu/ccpr/GrCCPathProcessor.h
@@ -44,10 +44,8 @@
SkIVector fDevToAtlasOffset; // Translation from device space to location in atlas.
uint64_t fColor; // Color always stored as 4 x fp16
- void set(const GrOctoBounds&, const SkIVector& devToAtlasOffset, uint64_t,
- DoEvenOddFill = DoEvenOddFill::kNo);
- void set(const GrCCPathCacheEntry&, const SkIVector& shift, uint64_t,
- DoEvenOddFill = DoEvenOddFill::kNo);
+ void set(const GrOctoBounds&, const SkIVector& devToAtlasOffset, uint64_t, DoEvenOddFill);
+ void set(const GrCCPathCacheEntry&, const SkIVector& shift, uint64_t, DoEvenOddFill);
};
GR_STATIC_ASSERT(4 * 12 == sizeof(Instance));