Implement filling a path with nv_path_rendering cover
Implement filling a path with nv_path_rendering cover functionality.
The nv_path_rendering cover can be used if the fill is non-inverted
and the draw operation does not require use of vertex shaders.
Moves code for the inverted fill from GrStencilAndCoverPathRenderer
down to GrGpuGL.
R=bsalomon@google.com, markkilgard@gmail.com, cdalton@nvidia.com
Author: kkinnunen@nvidia.com
Review URL: https://codereview.chromium.org/22686002
git-svn-id: http://skia.googlecode.com/svn/trunk@11667 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 58b6a4b..1a10336 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -1012,3 +1012,29 @@
fGpu = gpu;
fAACache.setContext(gpu->getContext());
}
+
+void GrClipMaskManager::adjustPathStencilParams(GrStencilSettings* settings) {
+ const GrDrawState& drawState = fGpu->getDrawState();
+ GrClipMaskManager::StencilClipMode clipMode;
+ if (this->isClipInStencil() && drawState.isClipState()) {
+ clipMode = GrClipMaskManager::kRespectClip_StencilClipMode;
+ // We can't be modifying the clip and respecting it at the same time.
+ SkASSERT(!drawState.isStateFlagEnabled(
+ GrGpu::kModifyStencilClip_StateBit));
+ } else if (drawState.isStateFlagEnabled(
+ GrGpu::kModifyStencilClip_StateBit)) {
+ clipMode = GrClipMaskManager::kModifyClip_StencilClipMode;
+ } else {
+ clipMode = GrClipMaskManager::kIgnoreClip_StencilClipMode;
+ }
+
+ // TODO: dynamically attach a stencil buffer
+ int stencilBits = 0;
+ GrStencilBuffer* stencilBuffer =
+ drawState.getRenderTarget()->getStencilBuffer();
+ if (NULL != stencilBuffer) {
+ stencilBits = stencilBuffer->bits();
+ this->adjustStencilParams(settings, clipMode, stencilBits);
+ }
+}
+