aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-25 18:03:46 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-25 18:03:46 +0000
commit70fc152576d3e7e1405e8234a097054c609eeb77 (patch)
treed23427042446368b545cda54eaf3270d12d12ceb /src
parentce7357df6aa2d73c6e74313af767db7b608fe0a5 (diff)
Fix the stencil rules to perfom an rdiff with an inverse path
Review URL: http://codereview.appspot.com/6336056/ git-svn-id: http://skia.googlecode.com/svn/trunk@4328 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrStencil.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gpu/GrStencil.cpp b/src/gpu/GrStencil.cpp
index 8d7534aa4c..ac2d6d801c 100644
--- a/src/gpu/GrStencil.cpp
+++ b/src/gpu/GrStencil.cpp
@@ -167,7 +167,9 @@ GR_STATIC_CONST_SAME_STENCIL(gUserToClipRDiffPass1,
0x0000, // set clip bit
0xffff);
-GR_STATIC_CONST_SAME_STENCIL(gInvUserToClipRDiff,
+// We are looking for stencil values that are all zero. The first pass sets the
+// clip bit if the stencil is all zeros. The second pass clears the user bits.
+GR_STATIC_CONST_SAME_STENCIL(gInvUserToClipRDiffPass0,
kInvert_StencilOp,
kZero_StencilOp,
kEqual_StencilFunc,
@@ -175,6 +177,16 @@ GR_STATIC_CONST_SAME_STENCIL(gInvUserToClipRDiff,
0x0000,
0x0000 // set clip bit
);
+
+GR_STATIC_CONST_SAME_STENCIL(gInvUserToClipRDiffPass1,
+ kZero_StencilOp,
+ kZero_StencilOp,
+ kAlways_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff // unset clip bit
+);
+
///////
// Direct to Stencil
@@ -348,11 +360,15 @@ bool GrStencilSettings::GetClipPasses(
break;
case SkRegion::kReverseDifference_Op:
if (invertedFill) {
- *numPasses = 1;
- settings[0] = gInvUserToClipRDiff;
+ *numPasses = 2;
+ settings[0] = gInvUserToClipRDiffPass0;
settings[0].fWriteMasks[kFront_Face] |= stencilClipMask;
settings[0].fWriteMasks[kBack_Face] =
settings[0].fWriteMasks[kFront_Face];
+ settings[1] = gInvUserToClipRDiffPass1;
+ settings[1].fWriteMasks[kFront_Face] &= ~stencilClipMask;
+ settings[1].fWriteMasks[kBack_Face] =
+ settings[1].fWriteMasks[kFront_Face];
} else {
*numPasses = 2;
settings[0] = gUserToClipRDiffPass0;