| 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 GrBatch_DEFINED | 8 #ifndef GrBatch_DEFINED |
| 9 #define GrBatch_DEFINED | 9 #define GrBatch_DEFINED |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 * information will be communicated to the GrBatch prior to geometry generation. | 39 * information will be communicated to the GrBatch prior to geometry generation. |
| 40 */ | 40 */ |
| 41 | 41 |
| 42 struct GrBatchOpt { | 42 struct GrBatchOpt { |
| 43 bool fCanTweakAlphaForCoverage; | 43 bool fCanTweakAlphaForCoverage; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class GrBatch : public SkRefCnt { | 46 class GrBatch : public SkRefCnt { |
| 47 public: | 47 public: |
| 48 SK_DECLARE_INST_COUNT(GrBatch) | 48 SK_DECLARE_INST_COUNT(GrBatch) |
| 49 GrBatch() : fNumberOfDraws(0) { SkDEBUGCODE(fUsed = false;) } | 49 GrBatch() { SkDEBUGCODE(fUsed = false;) } |
| 50 virtual ~GrBatch() {} | 50 virtual ~GrBatch() {} |
| 51 | 51 |
| 52 virtual const char* name() const = 0; | 52 virtual const char* name() const = 0; |
| 53 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; | 53 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; |
| 54 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; | 54 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; |
| 55 | 55 |
| 56 /* | 56 /* |
| 57 * initBatchOpt is used to communicate possible optimizations to the GrBatch
. initBatchTracker | 57 * initBatchOpt is used to communicate possible optimizations to the GrBatch
. initBatchTracker |
| 58 * is a hook for the some additional overrides from the GrXferProcessor. Th
is is a bit | 58 * is a hook for the some additional overrides from the GrXferProcessor. Th
is is a bit |
| 59 * confusing but has to be like this until GrBatch is everywhere. | 59 * confusing but has to be like this until GrBatch is everywhere. |
| 60 * | 60 * |
| 61 * TODO combine to a single init call when GrBatch is everywhere. | 61 * TODO combine to a single init call when GrBatch is everywhere. |
| 62 */ | 62 */ |
| 63 virtual void initBatchOpt(const GrBatchOpt&) = 0; | 63 virtual void initBatchOpt(const GrBatchOpt&) = 0; |
| 64 virtual void initBatchTracker(const GrPipelineInfo& init) = 0; | 64 virtual void initBatchTracker(const GrPipelineInfo& init) = 0; |
| 65 | 65 |
| 66 bool combineIfPossible(GrBatch* that) { | 66 bool combineIfPossible(GrBatch* that) { |
| 67 if (this->classID() != that->classID()) { | 67 if (this->classID() != that->classID()) { |
| 68 return false; | 68 return false; |
| 69 } | 69 } |
| 70 | 70 |
| 71 return onCombineIfPossible(that); | 71 return onCombineIfPossible(that); |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual bool onCombineIfPossible(GrBatch*) = 0; | 74 virtual bool onCombineIfPossible(GrBatch*) = 0; |
| 75 | 75 |
| 76 virtual void generateGeometry(GrBatchTarget*, const GrPipeline*) = 0; | 76 virtual void generateGeometry(GrBatchTarget*, const GrPipeline*) = 0; |
| 77 | 77 |
| 78 // TODO this goes away when batches are everywhere | |
| 79 void setNumberOfDraws(int numberOfDraws) { fNumberOfDraws = numberOfDraws; } | |
| 80 int numberOfDraws() const { return fNumberOfDraws; } | |
| 81 | |
| 82 void* operator new(size_t size); | 78 void* operator new(size_t size); |
| 83 void operator delete(void* target); | 79 void operator delete(void* target); |
| 84 | 80 |
| 85 void* operator new(size_t size, void* placement) { | 81 void* operator new(size_t size, void* placement) { |
| 86 return ::operator new(size, placement); | 82 return ::operator new(size, placement); |
| 87 } | 83 } |
| 88 void operator delete(void* target, void* placement) { | 84 void operator delete(void* target, void* placement) { |
| 89 ::operator delete(target, placement); | 85 ::operator delete(target, placement); |
| 90 } | 86 } |
| 91 | 87 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return id; | 119 return id; |
| 124 } | 120 } |
| 125 | 121 |
| 126 enum { | 122 enum { |
| 127 kIllegalBatchClassID = 0, | 123 kIllegalBatchClassID = 0, |
| 128 }; | 124 }; |
| 129 static int32_t gCurrBatchClassID; | 125 static int32_t gCurrBatchClassID; |
| 130 | 126 |
| 131 SkDEBUGCODE(bool fUsed;) | 127 SkDEBUGCODE(bool fUsed;) |
| 132 | 128 |
| 133 int fNumberOfDraws; | |
| 134 | |
| 135 typedef SkRefCnt INHERITED; | 129 typedef SkRefCnt INHERITED; |
| 136 }; | 130 }; |
| 137 | 131 |
| 138 #endif | 132 #endif |
| OLD | NEW |