code cleanup for single_pass_path() and remove enum GrConvexHint
Review URL: code cleanup for single_pass_path() and remove enum GrConvexHint git-svn-id: http://skia.googlecode.com/svn/trunk@3099 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
74b4619616
commit
7d72c45a9e
@ -593,24 +593,6 @@ static inline bool GrIsFillInverted(GrPathFill fill) {
|
||||
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
|
||||
|
@ -162,30 +162,14 @@ GR_STATIC_CONST_SAME_STENCIL(gDirectToStencil,
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
@ -194,7 +178,7 @@ static inline bool single_pass_path(const GrDrawTarget& target,
|
||||
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() {
|
||||
@ -420,7 +404,7 @@ void GrDefaultPathRenderer::onDrawPath(GrDrawState::StageMask stageMask,
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user