aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/core/SkPath.h24
-rw-r--r--include/gpu/GrContext.h11
-rw-r--r--include/gpu/GrTypes.h47
3 files changed, 28 insertions, 54 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 942342dd56..b85e827331 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -88,7 +88,7 @@ public:
}
/** Returns true if the filltype is one of the Inverse variants */
- bool isInverseFillType() const { return (fFillType & 2) != 0; }
+ bool isInverseFillType() const { return IsInverseFill((FillType)fFillType); }
/**
* Toggle between inverse and normal filltypes. This reverse the return
@@ -522,6 +522,28 @@ public:
}
/**
+ * Returns whether or not a fill type is inverted
+ */
+ static bool IsInverseFill(FillType fill) {
+ SK_COMPILE_ASSERT(0 == kWinding_FillType, fill_type_mismatch);
+ SK_COMPILE_ASSERT(1 == kEvenOdd_FillType, fill_type_mismatch);
+ SK_COMPILE_ASSERT(2 == kInverseWinding_FillType, fill_type_mismatch);
+ SK_COMPILE_ASSERT(3 == kInverseEvenOdd_FillType, fill_type_mismatch);
+ return (fill & 2) != 0;
+ }
+
+ /**
+ * Returns the equivalent non-inverted fill type to the given fill type
+ */
+ static FillType NonInverseFill(FillType fill) {
+ SK_COMPILE_ASSERT(0 == kWinding_FillType, fill_type_mismatch);
+ SK_COMPILE_ASSERT(1 == kEvenOdd_FillType, fill_type_mismatch);
+ SK_COMPILE_ASSERT(2 == kInverseWinding_FillType, fill_type_mismatch);
+ SK_COMPILE_ASSERT(3 == kInverseEvenOdd_FillType, fill_type_mismatch);
+ return (FillType)(fill & 1);
+ }
+
+ /**
* Tries to quickly compute the direction of the first non-degenerate
* contour. If it can be computed, return true and set dir to that
* direction. If it cannot be (quickly) determined, return false and ignore
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 08de94f02d..7b14fdfafe 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -40,6 +40,7 @@ class GrTextureParams;
class GrVertexBuffer;
class GrVertexBufferAllocPool;
class GrSoftwarePathRenderer;
+class SkStroke;
class GR_API GrContext : public GrRefCnt {
public:
@@ -417,11 +418,9 @@ public:
*
* @param paint describes how to color pixels.
* @param path the path to draw
- * @param fill the path filling rule to use.
- * @param translate optional additional translation applied to the
- * path.
+ * @param doHairLine whether the stroke can be optimized as a hairline
*/
- void drawPath(const GrPaint& paint, const SkPath& path, GrPathFill fill);
+ void drawPath(const GrPaint& paint, const SkPath& path, bool doHairLine);
/**
* Draws vertices with a paint.
@@ -849,7 +848,7 @@ public:
GrStencilBuffer* findStencilBuffer(int width, int height, int sampleCnt);
GrPathRenderer* getPathRenderer(const SkPath& path,
- GrPathFill fill,
+ const SkStroke& stroke,
const GrDrawTarget* target,
bool antiAlias,
bool allowSW);
@@ -912,7 +911,7 @@ private:
/// draw state is left unmodified.
GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw);
- void internalDrawPath(const GrPaint& paint, const SkPath& path, GrPathFill fill);
+ void internalDrawPath(const GrPaint& paint, const SkPath& path, const SkStroke& stroke);
GrTexture* createResizedTexture(const GrTextureDesc& desc,
const GrCacheData& cacheData,
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 3c730df41e..21ae6deca5 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -540,53 +540,6 @@ static int inline NumPathCmdPoints(GrPathCmd cmd) {
return gNumPoints[cmd];
}
-/**
- * Path filling rules
- */
-enum GrPathFill {
- kWinding_GrPathFill,
- kEvenOdd_GrPathFill,
- kInverseWinding_GrPathFill,
- kInverseEvenOdd_GrPathFill,
- kHairLine_GrPathFill,
-
- kGrPathFillCount
-};
-
-static inline GrPathFill GrNonInvertedFill(GrPathFill fill) {
- static const GrPathFill gNonInvertedFills[] = {
- kWinding_GrPathFill, // kWinding_GrPathFill
- kEvenOdd_GrPathFill, // kEvenOdd_GrPathFill
- kWinding_GrPathFill, // kInverseWinding_GrPathFill
- kEvenOdd_GrPathFill, // kInverseEvenOdd_GrPathFill
- kHairLine_GrPathFill,// kHairLine_GrPathFill
- };
- GR_STATIC_ASSERT(0 == kWinding_GrPathFill);
- GR_STATIC_ASSERT(1 == kEvenOdd_GrPathFill);
- GR_STATIC_ASSERT(2 == kInverseWinding_GrPathFill);
- GR_STATIC_ASSERT(3 == kInverseEvenOdd_GrPathFill);
- GR_STATIC_ASSERT(4 == kHairLine_GrPathFill);
- GR_STATIC_ASSERT(5 == kGrPathFillCount);
- return gNonInvertedFills[fill];
-}
-
-static inline bool GrIsFillInverted(GrPathFill fill) {
- static const bool gIsFillInverted[] = {
- false, // kWinding_GrPathFill
- false, // kEvenOdd_GrPathFill
- true, // kInverseWinding_GrPathFill
- true, // kInverseEvenOdd_GrPathFill
- false, // kHairLine_GrPathFill
- };
- GR_STATIC_ASSERT(0 == kWinding_GrPathFill);
- GR_STATIC_ASSERT(1 == kEvenOdd_GrPathFill);
- GR_STATIC_ASSERT(2 == kInverseWinding_GrPathFill);
- GR_STATIC_ASSERT(3 == kInverseEvenOdd_GrPathFill);
- GR_STATIC_ASSERT(4 == kHairLine_GrPathFill);
- GR_STATIC_ASSERT(5 == kGrPathFillCount);
- return gIsFillInverted[fill];
-}
-
///////////////////////////////////////////////////////////////////////////////
// opaque type for 3D API object handles