return gIsFillInverted[fill];
}
-/**
- * Hints provided about a path's convexity (or lack thereof).
- */
-enum GrConvexHint {
- kNone_ConvexHint, //<! No hint about convexity
- // of the path
- kConvex_ConvexHint, //<! Path is one convex piece
- kNonOverlappingConvexPieces_ConvexHint, //<! Multiple convex pieces,
- // pieces are known to be
- // disjoint
- kSameWindingConvexPieces_ConvexHint, //<! Multiple convex pieces,
- // may or may not intersect,
- // either all wind cw or all
- // wind ccw.
- kConcave_ConvexHint //<! Path is known to be
- // concave
-};
-
///////////////////////////////////////////////////////////////////////////////
// opaque type for 3D API object handles
////////////////////////////////////////////////////////////////////////////////
// Helpers for drawPath
-static GrConvexHint getConvexHint(const SkPath& path) {
- return path.isConvex() ? kConvex_ConvexHint : kConcave_ConvexHint;
-}
-
#define STENCIL_OFF 0 // Always disable stencil (even when needed)
-static inline bool single_pass_path(const GrDrawTarget& target,
- const GrPath& path,
- GrPathFill fill) {
+static inline bool single_pass_path(const GrPath& path, GrPathFill fill) {
#if STENCIL_OFF
return true;
#else
- if (kEvenOdd_PathFill == fill) {
- GrConvexHint hint = getConvexHint(path);
- return hint == kConvex_ConvexHint ||
- hint == kNonOverlappingConvexPieces_ConvexHint;
- } else if (kWinding_PathFill == fill) {
- GrConvexHint hint = getConvexHint(path);
- return hint == kConvex_ConvexHint ||
- hint == kNonOverlappingConvexPieces_ConvexHint ||
- (hint == kSameWindingConvexPieces_ConvexHint &&
- !target.drawWillReadDst() &&
- !target.getDrawState().isDitherState());
-
+ if (kEvenOdd_PathFill == fill || kWinding_PathFill == fill) {
+ return path.isConvex();
}
return false;
#endif
bool GrDefaultPathRenderer::requiresStencilPass(const GrDrawTarget* target,
const GrPath& path,
GrPathFill fill) const {
- return !single_pass_path(*target, path, fill);
+ return !single_pass_path(path, fill);
}
void GrDefaultPathRenderer::pathWillClear() {
lastPassIsBounds = false;
drawFace[0] = GrDrawState::kBoth_DrawFace;
} else {
- if (single_pass_path(*fTarget, *fPath, fFill)) {
+ if (single_pass_path(*fPath, fFill)) {
passCount = 1;
if (stencilOnly) {
passes[0] = &gDirectToStencil;