• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2015 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef GrStencilPathOp_DEFINED
9 #define GrStencilPathOp_DEFINED
10 
11 #include "GrOp.h"
12 #include "GrPath.h"
13 #include "GrPathRendering.h"
14 #include "GrStencilSettings.h"
15 
16 class GrContext;
17 class GrOpFlushState;
18 
19 class GrStencilPathOp final : public GrOp {
20 public:
21     DEFINE_OP_CLASS_ID
22 
23     static std::unique_ptr<GrOp> Make(GrContext* context,
24                                       const SkMatrix& viewMatrix,
25                                       bool useHWAA,
26                                       GrPathRendering::FillType fillType,
27                                       bool hasStencilClip,
28                                       const GrScissorState& scissor,
29                                       const GrPath* path);
30 
name()31     const char* name() const override { return "StencilPathOp"; }
32 
33 #ifdef SK_DEBUG
dumpInfo()34     SkString dumpInfo() const override {
35         SkString string;
36         string.printf("Path: 0x%p, AA: %d", fPath.get(), fUseHWAA);
37         string.append(INHERITED::dumpInfo());
38         return string;
39     }
40 #endif
41 
42 private:
43     friend class GrOpMemoryPool; // for ctor
44 
GrStencilPathOp(const SkMatrix & viewMatrix,bool useHWAA,GrPathRendering::FillType fillType,bool hasStencilClip,const GrScissorState & scissor,const GrPath * path)45     GrStencilPathOp(const SkMatrix& viewMatrix,
46                     bool useHWAA,
47                     GrPathRendering::FillType fillType,
48                     bool hasStencilClip,
49                     const GrScissorState& scissor,
50                     const GrPath* path)
51             : INHERITED(ClassID())
52             , fViewMatrix(viewMatrix)
53             , fUseHWAA(useHWAA)
54             , fFillType(fillType)
55             , fHasStencilClip(hasStencilClip)
56             , fScissor(scissor)
57             , fPath(path) {
58         this->setBounds(path->getBounds(), HasAABloat::kNo, IsZeroArea::kNo);
59     }
60 
onPrepare(GrOpFlushState *)61     void onPrepare(GrOpFlushState*) override {}
62 
63     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
64 
65     SkMatrix                                          fViewMatrix;
66     bool                                              fUseHWAA;
67     GrPathRendering::FillType                         fFillType;
68     bool                                              fHasStencilClip;
69     GrScissorState                                    fScissor;
70     GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
71 
72     typedef GrOp INHERITED;
73 };
74 
75 #endif
76