Index: src/gpu/gl/GrGLUtil.cpp |
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp |
index ecc587b714ae33fe5b5e5eefa4fd9393b57bf28f..46b58f1d768bf3f1aaeb3f95f51a0e27c48f8b35 100644 |
--- a/src/gpu/gl/GrGLUtil.cpp |
+++ b/src/gpu/gl/GrGLUtil.cpp |
@@ -334,26 +334,27 @@ |
return GrGLGetRendererFromString((const char*) v); |
} |
-GrGLenum GrToGLStencilFunc(GrStencilTest test) { |
- static const GrGLenum gTable[kGrStencilTestCount] = { |
- GR_GL_ALWAYS, // kAlways |
- GR_GL_NEVER, // kNever |
- GR_GL_GREATER, // kGreater |
- GR_GL_GEQUAL, // kGEqual |
- GR_GL_LESS, // kLess |
- GR_GL_LEQUAL, // kLEqual |
- GR_GL_EQUAL, // kEqual |
- GR_GL_NOTEQUAL, // kNotEqual |
+GrGLenum GrToGLStencilFunc(GrStencilFunc basicFunc) { |
+ static const GrGLenum gTable[] = { |
+ GR_GL_ALWAYS, // kAlways_StencilFunc |
+ GR_GL_NEVER, // kNever_StencilFunc |
+ GR_GL_GREATER, // kGreater_StencilFunc |
+ GR_GL_GEQUAL, // kGEqual_StencilFunc |
+ GR_GL_LESS, // kLess_StencilFunc |
+ GR_GL_LEQUAL, // kLEqual_StencilFunc, |
+ GR_GL_EQUAL, // kEqual_StencilFunc, |
+ GR_GL_NOTEQUAL, // kNotEqual_StencilFunc, |
}; |
- GR_STATIC_ASSERT(0 == (int)GrStencilTest::kAlways); |
- GR_STATIC_ASSERT(1 == (int)GrStencilTest::kNever); |
- GR_STATIC_ASSERT(2 == (int)GrStencilTest::kGreater); |
- GR_STATIC_ASSERT(3 == (int)GrStencilTest::kGEqual); |
- GR_STATIC_ASSERT(4 == (int)GrStencilTest::kLess); |
- GR_STATIC_ASSERT(5 == (int)GrStencilTest::kLEqual); |
- GR_STATIC_ASSERT(6 == (int)GrStencilTest::kEqual); |
- GR_STATIC_ASSERT(7 == (int)GrStencilTest::kNotEqual); |
- SkASSERT(test < (GrStencilTest)kGrStencilTestCount); |
- |
- return gTable[(int)test]; |
-} |
+ GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kBasicStencilFuncCnt); |
+ GR_STATIC_ASSERT(0 == kAlways_StencilFunc); |
+ GR_STATIC_ASSERT(1 == kNever_StencilFunc); |
+ GR_STATIC_ASSERT(2 == kGreater_StencilFunc); |
+ GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); |
+ GR_STATIC_ASSERT(4 == kLess_StencilFunc); |
+ GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); |
+ GR_STATIC_ASSERT(6 == kEqual_StencilFunc); |
+ GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); |
+ SkASSERT((unsigned) basicFunc < kBasicStencilFuncCnt); |
+ |
+ return gTable[basicFunc]; |
+} |