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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 } | 22 } |
23 | 23 |
24 const char* name() const override { return "DrawPath"; } | 24 const char* name() const override { return "DrawPath"; } |
25 | 25 |
26 SkString dumpInfo() const override { | 26 SkString dumpInfo() const override { |
27 SkString string; | 27 SkString string; |
28 string.printf("PATH: 0x%p", fPath.get()); | 28 string.printf("PATH: 0x%p", fPath.get()); |
29 return string; | 29 return string; |
30 } | 30 } |
31 | 31 |
32 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const { | 32 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
33 fPrimitiveProcessor->getInvariantOutputColor(out); | 33 fPrimitiveProcessor->getInvariantOutputColor(out); |
34 } | 34 } |
35 | 35 |
36 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const { | 36 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
37 fPrimitiveProcessor->getInvariantOutputCoverage(out); | 37 fPrimitiveProcessor->getInvariantOutputCoverage(out); |
38 } | 38 } |
39 | 39 |
40 void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings
= stencil; } | 40 void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings
= stencil; } |
41 | 41 |
42 private: | 42 private: |
43 GrBatchTracker* tracker() { return reinterpret_cast<GrBatchTracker*>(&fWhatc
hamacallit); } | 43 GrBatchTracker* tracker() { return reinterpret_cast<GrBatchTracker*>(&fWhatc
hamacallit); } |
44 GrDrawPathBatch(const GrPathProcessor* primProc, const GrPath* path) | 44 GrDrawPathBatch(const GrPathProcessor* primProc, const GrPath* path) |
45 : fPrimitiveProcessor(primProc) | 45 : fPrimitiveProcessor(primProc) |
46 , fPath(path) { | 46 , fPath(path) { |
47 fBounds = path->getBounds(); | 47 fBounds = path->getBounds(); |
48 primProc->viewMatrix().mapRect(&fBounds); | 48 primProc->viewMatrix().mapRect(&fBounds); |
49 this->initClassID<GrDrawPathBatch>(); | 49 this->initClassID<GrDrawPathBatch>(); |
50 } | 50 } |
51 | 51 |
52 virtual void initBatchTracker(const GrPipelineOptimizations& opts) { | 52 void initBatchTracker(const GrPipelineOptimizations& opts) override { |
53 fPrimitiveProcessor->initBatchTracker(this->tracker(), opts); | 53 fPrimitiveProcessor->initBatchTracker(this->tracker(), opts); |
54 } | 54 } |
55 | 55 |
56 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } | 56 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
57 | 57 |
58 void onPrepare(GrBatchFlushState*) override {} | 58 void onPrepare(GrBatchFlushState*) override {} |
59 | 59 |
60 void onDraw(GrBatchFlushState* state) override { | 60 void onDraw(GrBatchFlushState* state) override { |
61 GrProgramDesc desc; | 61 GrProgramDesc desc; |
62 state->gpu()->buildProgramDesc(&desc, *fPrimitiveProcessor.get(), | 62 state->gpu()->buildProgramDesc(&desc, *fPrimitiveProcessor.get(), |
63 *this->pipeline(), *this->tracker()); | 63 *this->pipeline(), *this->tracker()); |
64 GrPathRendering::DrawPathArgs args(fPrimitiveProcessor.get(), this->pipe
line(), | 64 GrPathRendering::DrawPathArgs args(fPrimitiveProcessor.get(), this->pipe
line(), |
65 &desc, this->tracker(), &fStencilSett
ings); | 65 &desc, this->tracker(), &fStencilSett
ings); |
66 state->gpu()->pathRendering()->drawPath(args, fPath.get()); | 66 state->gpu()->pathRendering()->drawPath(args, fPath.get()); |
67 } | 67 } |
68 | 68 |
69 GrPendingProgramElement<const GrPathProcessor> fPrimitiveProcessor; | 69 GrPendingProgramElement<const GrPathProcessor> fPrimitiveProcessor; |
70 PathBatchTracker fWhatchamacallit; // TOD
O: delete this | 70 PathBatchTracker fWhatchamacallit; // TOD
O: delete this |
71 GrStencilSettings fStencilSettings; | 71 GrStencilSettings fStencilSettings; |
72 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; | 72 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; |
73 }; | 73 }; |
74 | 74 |
75 #endif | 75 #endif |
OLD | NEW |