aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathRenderer.h
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2016-05-10 14:23:01 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-10 14:23:01 -0700
commit12dbb3947e1aaf205b4fcf13b40e54e50650eb37 (patch)
treeb5f94e96f154882abce1ba1793e2ad45b8fef8d9 /src/gpu/GrPathRenderer.h
parent554784cd85029c05d9ed04b1aeb71520d196153a (diff)
Separate user and raw stencil settings
Adds a new GrUserStencilSettings class that describes in abstract terms how a draw will use the stencil (e.g. kAlwaysIfInClip, kSetClipBit, etc.). GrPipelineBuilder now only defines the GrUserStencilSettings. When the GrPipeline is finalized, the user stencil settings are then translated into concrete GrStencilSettings. At this point, GrClipMaskManager only needs to tell the GrAppliedClip whether or not there is a stencil clip. It does not need to modify stencil settings and GrPipelineBuilder does not need AutoRestoreStencil. This is one step of the stencil overhaul. In the future it will also allow us to clean up the special case handling for nvpr and the stateful fClipMode member of GrClipMaskManager. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1962243002 Review-Url: https://codereview.chromium.org/1962243002
Diffstat (limited to 'src/gpu/GrPathRenderer.h')
-rw-r--r--src/gpu/GrPathRenderer.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 3bc02306e6..a7609db658 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -9,7 +9,6 @@
#define GrPathRenderer_DEFINED
#include "GrDrawTarget.h"
-#include "GrStencil.h"
#include "GrStyle.h"
#include "SkDrawProcs.h"
@@ -82,7 +81,7 @@ public:
bool fAntiAlias;
// These next two are only used by GrStencilAndCoverPathRenderer
- bool fIsStencilDisabled;
+ bool fHasUserStencilSettings;
bool fIsStencilBufferMSAA;
void validate() const {
@@ -155,11 +154,11 @@ public:
canArgs.fStyle = args.fStyle;
canArgs.fAntiAlias = args.fAntiAlias;
- canArgs.fIsStencilDisabled = args.fPipelineBuilder->getStencil().isDisabled();
+ canArgs.fHasUserStencilSettings = args.fPipelineBuilder->hasUserStencilSettings();
canArgs.fIsStencilBufferMSAA =
args.fPipelineBuilder->getRenderTarget()->isStencilBufferMultisampled();
SkASSERT(this->canDrawPath(canArgs));
- if (!args.fPipelineBuilder->getStencil().isDisabled()) {
+ if (args.fPipelineBuilder->hasUserStencilSettings()) {
SkASSERT(kNoRestriction_StencilSupport == this->getStencilSupport(*args.fPath));
SkASSERT(args.fStyle->isSimpleFill());
}
@@ -260,14 +259,16 @@ private:
* kStencilOnly in onGetStencilSupport().
*/
virtual void onStencilPath(const StencilPathArgs& args) {
- static constexpr GrStencilSettings kIncrementStencil(
- kReplace_StencilOp,
- kReplace_StencilOp,
- kAlways_StencilFunc,
- 0xffff,
- 0xffff,
- 0xffff);
- args.fPipelineBuilder->setStencil(kIncrementStencil);
+ static constexpr GrUserStencilSettings kIncrementStencil(
+ GrUserStencilSettings::StaticInit<
+ 0xffff,
+ GrUserStencilTest::kAlways,
+ 0xffff,
+ GrUserStencilOp::kReplace,
+ GrUserStencilOp::kReplace,
+ 0xffff>()
+ );
+ args.fPipelineBuilder->setUserStencil(&kIncrementStencil);
args.fPipelineBuilder->setDisableColorXPFactory();
DrawPathArgs drawArgs;
drawArgs.fTarget = args.fTarget;