OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrDrawPathBatch_DEFINED | 8 #ifndef GrDrawPathBatch_DEFINED |
9 #define GrDrawPathBatch_DEFINED | 9 #define GrDrawPathBatch_DEFINED |
10 | 10 |
11 #include "GrBatchFlushState.h" | 11 #include "GrBatchFlushState.h" |
12 #include "GrDrawBatch.h" | 12 #include "GrDrawBatch.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrPath.h" | 14 #include "GrPath.h" |
15 #include "GrPathRendering.h" | 15 #include "GrPathRendering.h" |
16 #include "GrPathProcessor.h" | 16 #include "GrPathProcessor.h" |
17 | 17 |
18 #include "SkTLList.h" | 18 #include "SkTLList.h" |
19 | 19 |
20 class GrDrawPathBatchBase : public GrDrawBatch { | 20 class GrDrawPathBatchBase : public GrDrawBatch { |
21 public: | 21 public: |
22 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 22 void computePipelineOptimizations(GrInitInvariantOutput* color, |
23 out->setKnownFourComponents(fColor); | 23 GrInitInvariantOutput* coverage, |
24 } | 24 GrBatchToXPOverrides* overrides) const ove
rride { |
25 | 25 color->setKnownFourComponents(fColor); |
26 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 26 coverage->setKnownSingleComponent(0xff); |
27 out->setKnownSingleComponent(0xff); | 27 overrides->fUsePLSDstRead = false; |
28 } | 28 } |
29 | 29 |
30 void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings
= stencil; } | 30 void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings
= stencil; } |
31 | 31 |
32 protected: | 32 protected: |
33 GrDrawPathBatchBase(uint32_t classID, const SkMatrix& viewMatrix, GrColor in
itialColor) | 33 GrDrawPathBatchBase(uint32_t classID, const SkMatrix& viewMatrix, GrColor in
itialColor) |
34 : INHERITED(classID) | 34 : INHERITED(classID) |
35 , fViewMatrix(viewMatrix) | 35 , fViewMatrix(viewMatrix) |
36 , fColor(initialColor) {} | 36 , fColor(initialColor) {} |
37 | 37 |
38 const GrStencilSettings& stencilSettings() const { return fStencilSettings;
} | 38 const GrStencilSettings& stencilSettings() const { return fStencilSettings;
} |
39 const GrPipelineOptimizations& opts() const { return fOpts; } | 39 const GrXPOverridesForBatch& overrides() const { return fOverrides; } |
40 const SkMatrix& viewMatrix() const { return fViewMatrix; } | 40 const SkMatrix& viewMatrix() const { return fViewMatrix; } |
41 GrColor color() const { return fColor; } | 41 GrColor color() const { return fColor; } |
42 | 42 |
43 private: | 43 private: |
44 void initBatchTracker(const GrPipelineOptimizations& opts) override { | 44 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { |
45 opts.getOverrideColorIfSet(&fColor); | 45 overrides.getOverrideColorIfSet(&fColor); |
46 fOpts = opts; | 46 fOverrides = overrides; |
47 } | 47 } |
48 | 48 |
49 SkMatrix fViewMatrix; | 49 SkMatrix fViewMatrix; |
50 GrColor fColor; | 50 GrColor fColor; |
51 GrStencilSettings fStencilSettings; | 51 GrStencilSettings fStencilSettings; |
52 GrPipelineOptimizations fOpts; | 52 GrXPOverridesForBatch fOverrides; |
53 | 53 |
54 typedef GrDrawBatch INHERITED; | 54 typedef GrDrawBatch INHERITED; |
55 }; | 55 }; |
56 | 56 |
57 class GrDrawPathBatch final : public GrDrawPathBatchBase { | 57 class GrDrawPathBatch final : public GrDrawPathBatchBase { |
58 public: | 58 public: |
59 DEFINE_BATCH_CLASS_ID | 59 DEFINE_BATCH_CLASS_ID |
60 | 60 |
61 // This can't return a more abstract type because we install the stencil set
tings late :( | 61 // This can't return a more abstract type because we install the stencil set
tings late :( |
62 static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, GrColor color
, | 62 static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, GrColor color
, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 typedef SkTLList<GrPathRangeDraw*, 4> DrawList; | 174 typedef SkTLList<GrPathRangeDraw*, 4> DrawList; |
175 PendingPathRange fPathRange; | 175 PendingPathRange fPathRange; |
176 DrawList fDraws; | 176 DrawList fDraws; |
177 int fTotalPathCount; | 177 int fTotalPathCount; |
178 SkMatrix fLocalMatrix; | 178 SkMatrix fLocalMatrix; |
179 | 179 |
180 typedef GrDrawPathBatchBase INHERITED; | 180 typedef GrDrawPathBatchBase INHERITED; |
181 }; | 181 }; |
182 | 182 |
183 #endif | 183 #endif |
OLD | NEW |