aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpu.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-05 20:24:20 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-05 20:24:20 +0000
commit411dad0630913fc07f2412b4be17acfbfd914fbc (patch)
tree36d28ba722c1c33cd2ca60f341ef60ef1d5e5a03 /src/gpu/GrGpu.cpp
parent57288857cd7992eaa44753c7b9f987e318a0e8c3 (diff)
Move stencil param adjustment to GrClipMaskManager, attempt to make GrGpuGL::flushStencil readable
Review URL: http://codereview.appspot.com/6295046/ git-svn-id: http://skia.googlecode.com/svn/trunk@4173 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r--src/gpu/GrGpu.cpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 4839e4f045..a873fe7ef5 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -357,87 +357,6 @@ const GrStencilSettings* GrGpu::GetClipStencilSettings(void) {
return GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&sClipStencilSettings);
}
-// mapping of clip-respecting stencil funcs to normal stencil funcs
-// mapping depends on whether stencil-clipping is in effect.
-static const GrStencilFunc gGrClipToNormalStencilFunc[2][kClipStencilFuncCount] = {
- {// Stencil-Clipping is DISABLED, effectively always inside the clip
- // In the Clip Funcs
- kAlways_StencilFunc, // kAlwaysIfInClip_StencilFunc
- kEqual_StencilFunc, // kEqualIfInClip_StencilFunc
- kLess_StencilFunc, // kLessIfInClip_StencilFunc
- kLEqual_StencilFunc, // kLEqualIfInClip_StencilFunc
- // Special in the clip func that forces user's ref to be 0.
- kNotEqual_StencilFunc, // kNonZeroIfInClip_StencilFunc
- // make ref 0 and do normal nequal.
- },
- {// Stencil-Clipping is ENABLED
- // In the Clip Funcs
- kEqual_StencilFunc, // kAlwaysIfInClip_StencilFunc
- // eq stencil clip bit, mask
- // out user bits.
-
- kEqual_StencilFunc, // kEqualIfInClip_StencilFunc
- // add stencil bit to mask and ref
-
- kLess_StencilFunc, // kLessIfInClip_StencilFunc
- kLEqual_StencilFunc, // kLEqualIfInClip_StencilFunc
- // for both of these we can add
- // the clip bit to the mask and
- // ref and compare as normal
- // Special in the clip func that forces user's ref to be 0.
- kLess_StencilFunc, // kNonZeroIfInClip_StencilFunc
- // make ref have only the clip bit set
- // and make comparison be less
- // 10..0 < 1..user_bits..
- }
-};
-
-GrStencilFunc GrGpu::ConvertStencilFunc(bool stencilInClip, GrStencilFunc func) {
- GrAssert(func >= 0);
- if (func >= kBasicStencilFuncCount) {
- GrAssert(func < kStencilFuncCount);
- func = gGrClipToNormalStencilFunc[stencilInClip ? 1 : 0][func - kBasicStencilFuncCount];
- GrAssert(func >= 0 && func < kBasicStencilFuncCount);
- }
- return func;
-}
-
-void GrGpu::ConvertStencilFuncAndMask(GrStencilFunc func,
- bool clipInStencil,
- unsigned int clipBit,
- unsigned int userBits,
- unsigned int* ref,
- unsigned int* mask) {
- if (func < kBasicStencilFuncCount) {
- *mask &= userBits;
- *ref &= userBits;
- } else {
- if (clipInStencil) {
- switch (func) {
- case kAlwaysIfInClip_StencilFunc:
- *mask = clipBit;
- *ref = clipBit;
- break;
- case kEqualIfInClip_StencilFunc:
- case kLessIfInClip_StencilFunc:
- case kLEqualIfInClip_StencilFunc:
- *mask = (*mask & userBits) | clipBit;
- *ref = (*ref & userBits) | clipBit;
- break;
- case kNonZeroIfInClip_StencilFunc:
- *mask = (*mask & userBits) | clipBit;
- *ref = clipBit;
- break;
- default:
- GrCrash("Unknown stencil func");
- }
- } else {
- *mask &= userBits;
- *ref &= userBits;
- }
- }
-}
-
////////////////////////////////////////////////////////////////////////////////
bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) {