• 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 GrOpFlushState;
17 
18 class GrStencilPathOp final : public GrOp {
19 public:
20     DEFINE_OP_CLASS_ID
21 
Make(const SkMatrix & viewMatrix,bool useHWAA,GrPathRendering::FillType fillType,bool hasStencilClip,const GrScissorState & scissor,const GrPath * path)22     static std::unique_ptr<GrOp> Make(const SkMatrix& viewMatrix,
23                                       bool useHWAA,
24                                       GrPathRendering::FillType fillType,
25                                       bool hasStencilClip,
26                                       const GrScissorState& scissor,
27                                       const GrPath* path) {
28 
29         return std::unique_ptr<GrOp>(new GrStencilPathOp(viewMatrix, useHWAA, fillType,
30                                                          hasStencilClip, scissor, path));
31     }
32 
name()33     const char* name() const override { return "StencilPathOp"; }
34 
dumpInfo()35     SkString dumpInfo() const override {
36         SkString string;
37         string.printf("Path: 0x%p, AA: %d", fPath.get(), fUseHWAA);
38         string.append(INHERITED::dumpInfo());
39         return string;
40     }
41 
42 private:
GrStencilPathOp(const SkMatrix & viewMatrix,bool useHWAA,GrPathRendering::FillType fillType,bool hasStencilClip,const GrScissorState & scissor,const GrPath * path)43     GrStencilPathOp(const SkMatrix& viewMatrix,
44                     bool useHWAA,
45                     GrPathRendering::FillType fillType,
46                     bool hasStencilClip,
47                     const GrScissorState& scissor,
48                     const GrPath* path)
49             : INHERITED(ClassID())
50             , fViewMatrix(viewMatrix)
51             , fUseHWAA(useHWAA)
52             , fFillType(fillType)
53             , fHasStencilClip(hasStencilClip)
54             , fScissor(scissor)
55             , fPath(path) {
56         this->setBounds(path->getBounds(), HasAABloat::kNo, IsZeroArea::kNo);
57     }
58 
onCombineIfPossible(GrOp * t,const GrCaps & caps)59     bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override { return false; }
60 
onPrepare(GrOpFlushState *)61     void onPrepare(GrOpFlushState*) override {}
62 
63     void onExecute(GrOpFlushState* state) 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