Index: src/gpu/gl/GrGLGpu.cpp |
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
index 40d0e488d5cb1528217a30646ae50889fc35eae5..8c5951dbdcdd6fcd6626b7966047fd40fc093cae 100644 |
--- a/src/gpu/gl/GrGLGpu.cpp |
+++ b/src/gpu/gl/GrGLGpu.cpp |
@@ -2869,40 +2869,38 @@ namespace { |
GrGLenum gr_to_gl_stencil_op(GrStencilOp op) { |
- static const GrGLenum gTable[] = { |
- GR_GL_KEEP, // kKeep_StencilOp |
- GR_GL_REPLACE, // kReplace_StencilOp |
- GR_GL_INCR_WRAP, // kIncWrap_StencilOp |
- GR_GL_INCR, // kIncClamp_StencilOp |
- GR_GL_DECR_WRAP, // kDecWrap_StencilOp |
- GR_GL_DECR, // kDecClamp_StencilOp |
- GR_GL_ZERO, // kZero_StencilOp |
- GR_GL_INVERT, // kInvert_StencilOp |
+ static const GrGLenum gTable[kGrStencilOpCount] = { |
+ GR_GL_KEEP, // kKeep |
+ GR_GL_ZERO, // kZero |
+ GR_GL_REPLACE, // kReplace |
+ GR_GL_INVERT, // kInvert |
+ GR_GL_INCR_WRAP, // kIncWrap |
+ GR_GL_DECR_WRAP, // kDecWrap |
+ GR_GL_INCR, // kIncClamp |
+ GR_GL_DECR, // kDecClamp |
}; |
- GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kStencilOpCnt); |
- GR_STATIC_ASSERT(0 == kKeep_StencilOp); |
- GR_STATIC_ASSERT(1 == kReplace_StencilOp); |
- GR_STATIC_ASSERT(2 == kIncWrap_StencilOp); |
- GR_STATIC_ASSERT(3 == kIncClamp_StencilOp); |
- GR_STATIC_ASSERT(4 == kDecWrap_StencilOp); |
- GR_STATIC_ASSERT(5 == kDecClamp_StencilOp); |
- GR_STATIC_ASSERT(6 == kZero_StencilOp); |
- GR_STATIC_ASSERT(7 == kInvert_StencilOp); |
- SkASSERT((unsigned) op < kStencilOpCnt); |
- return gTable[op]; |
+ GR_STATIC_ASSERT(0 == (int)GrStencilOp::kKeep); |
+ GR_STATIC_ASSERT(1 == (int)GrStencilOp::kZero); |
+ GR_STATIC_ASSERT(2 == (int)GrStencilOp::kReplace); |
+ GR_STATIC_ASSERT(3 == (int)GrStencilOp::kInvert); |
+ GR_STATIC_ASSERT(4 == (int)GrStencilOp::kIncWrap); |
+ GR_STATIC_ASSERT(5 == (int)GrStencilOp::kDecWrap); |
+ GR_STATIC_ASSERT(6 == (int)GrStencilOp::kIncClamp); |
+ GR_STATIC_ASSERT(7 == (int)GrStencilOp::kDecClamp); |
+ SkASSERT(op < (GrStencilOp)kGrStencilOpCount); |
+ return gTable[(int)op]; |
} |
void set_gl_stencil(const GrGLInterface* gl, |
- const GrStencilSettings& settings, |
- GrGLenum glFace, |
- GrStencilSettings::Face grFace) { |
- GrGLenum glFunc = GrToGLStencilFunc(settings.func(grFace)); |
- GrGLenum glFailOp = gr_to_gl_stencil_op(settings.failOp(grFace)); |
- GrGLenum glPassOp = gr_to_gl_stencil_op(settings.passOp(grFace)); |
+ const GrStencilSettings::Face& face, |
+ GrGLenum glFace) { |
+ GrGLenum glFunc = GrToGLStencilFunc(face.fTest); |
+ GrGLenum glFailOp = gr_to_gl_stencil_op(face.fFailOp); |
+ GrGLenum glPassOp = gr_to_gl_stencil_op(face.fPassOp); |
- GrGLint ref = settings.funcRef(grFace); |
- GrGLint mask = settings.funcMask(grFace); |
- GrGLint writeMask = settings.writeMask(grFace); |
+ GrGLint ref = face.fRef; |
+ GrGLint mask = face.fTestMask; |
+ GrGLint writeMask = face.fWriteMask; |
if (GR_GL_FRONT_AND_BACK == glFace) { |
// we call the combined func just in case separate stencil is not |
@@ -2932,20 +2930,18 @@ void GrGLGpu::flushStencil(const GrStencilSettings& stencilSettings) { |
} |
} |
if (!stencilSettings.isDisabled()) { |
- if (this->caps()->twoSidedStencilSupport()) { |
+ if (stencilSettings.isTwoSided()) { |
+ SkASSERT(this->caps()->twoSidedStencilSupport()); |
set_gl_stencil(this->glInterface(), |
- stencilSettings, |
- GR_GL_FRONT, |
- GrStencilSettings::kFront_Face); |
+ stencilSettings.front(), |
+ GR_GL_FRONT); |
set_gl_stencil(this->glInterface(), |
- stencilSettings, |
- GR_GL_BACK, |
- GrStencilSettings::kBack_Face); |
+ stencilSettings.back(), |
+ GR_GL_BACK); |
} else { |
set_gl_stencil(this->glInterface(), |
- stencilSettings, |
- GR_GL_FRONT_AND_BACK, |
- GrStencilSettings::kFront_Face); |
+ stencilSettings.front(), |
+ GR_GL_FRONT_AND_BACK); |
} |
} |
fHWStencilSettings = stencilSettings; |