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

Unified Diff: include/gpu/GrTypesPriv.h

Issue 183893023: Unify edge type enums across GrEffect subclasses that clip rendering to a geometry. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tot again Created 6 years, 10 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
« no previous file with comments | « gm/rrects.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTypesPriv.h
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 8888066d4faa125ccaa9c48c6c6a5eb0ce1f2d5b..1fc6c8d40a0e7263213d24bb5ca48f32f2cec86c 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -60,6 +60,8 @@ static inline GrSLType GrSLFloatVectorType(int count) {
GR_STATIC_ASSERT(kVec4f_GrSLType == 4);
}
+//////////////////////////////////////////////////////////////////////////////
+
/**
* Types used to describe format of vertices in arrays.
*/
@@ -166,4 +168,53 @@ struct GrVertexAttrib {
template <int N> class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib, true> {};
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+* We have coverage effects that clip rendering to the edge of some geometric primitive.
+* This enum specifies how that clipping is performed. Not all factories that take a
+* GrEffectEdgeType will succeed with all values and it is up to the caller to check for
+* a NULL return.
+*/
+enum GrEffectEdgeType {
+ kFillBW_GrEffectEdgeType,
+ kFillAA_GrEffectEdgeType,
+ kInverseFillBW_GrEffectEdgeType,
+ kInverseFillAA_GrEffectEdgeType,
+ kHairlineAA_GrEffectEdgeType,
+
+ kLast_GrEffectEdgeType = kHairlineAA_GrEffectEdgeType
+};
+
+static const int kGrEffectEdgeTypeCnt = kLast_GrEffectEdgeType + 1;
+
+static inline bool GrEffectEdgeTypeIsFill(const GrEffectEdgeType edgeType) {
+ return (kFillAA_GrEffectEdgeType == edgeType || kFillBW_GrEffectEdgeType == edgeType);
+}
+
+static inline bool GrEffectEdgeTypeIsInverseFill(const GrEffectEdgeType edgeType) {
+ return (kInverseFillAA_GrEffectEdgeType == edgeType ||
+ kInverseFillBW_GrEffectEdgeType == edgeType);
+}
+
+static inline bool GrEffectEdgeTypeIsAA(const GrEffectEdgeType edgeType) {
+ return (kFillBW_GrEffectEdgeType != edgeType && kInverseFillBW_GrEffectEdgeType != edgeType);
+}
+
+static inline GrEffectEdgeType GrInvertEffectEdgeType(const GrEffectEdgeType edgeType) {
+ switch (edgeType) {
+ case kFillBW_GrEffectEdgeType:
+ return kInverseFillBW_GrEffectEdgeType;
+ case kFillAA_GrEffectEdgeType:
+ return kInverseFillAA_GrEffectEdgeType;
+ case kInverseFillBW_GrEffectEdgeType:
+ return kFillBW_GrEffectEdgeType;
+ case kInverseFillAA_GrEffectEdgeType:
+ return kFillAA_GrEffectEdgeType;
+ case kHairlineAA_GrEffectEdgeType:
+ GrCrash("Hairline fill isn't invertible.");
+ }
+ return kFillAA_GrEffectEdgeType; // suppress warning.
+}
+
#endif
« no previous file with comments | « gm/rrects.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698