| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 template <typename T> T* cast() { | 91 template <typename T> T* cast() { |
| 92 SkASSERT(T::ClassID() == this->classID()); | 92 SkASSERT(T::ClassID() == this->classID()); |
| 93 return static_cast<T*>(this); | 93 return static_cast<T*>(this); |
| 94 } | 94 } |
| 95 | 95 |
| 96 uint32_t classID() const { SkASSERT(kIllegalBatchID != fClassID); return fCl
assID; } | 96 uint32_t classID() const { SkASSERT(kIllegalBatchID != fClassID); return fCl
assID; } |
| 97 | 97 |
| 98 // We lazily initialize the uniqueID because currently the only user is GrAu
ditTrail | 98 // We lazily initialize the uniqueID because currently the only user is GrAu
ditTrail |
| 99 uint32_t uniqueID() const { | 99 uint32_t uniqueID() const { |
| 100 if (kIllegalBatchID == fUniqueID) { | 100 if (kIllegalBatchID == fUniqueID) { |
| 101 fUniqueID = GenBatchID(); | 101 fUniqueID = GenBatchID(); |
| 102 } | 102 } |
| 103 return fUniqueID; | 103 return fUniqueID; |
| 104 } | 104 } |
| 105 SkDEBUGCODE(bool isUsed() const { return fUsed; }) | 105 SkDEBUGCODE(bool isUsed() const { return fUsed; }) |
| 106 | 106 |
| 107 /** Called prior to drawing. The batch should perform any resource creation
necessary to | 107 /** Called prior to drawing. The batch should perform any resource creation
necessary to |
| 108 to quickly issue its draw when draw is called. */ | 108 to quickly issue its draw when draw is called. */ |
| 109 void prepare(GrBatchFlushState* state) { this->onPrepare(state); } | 109 void prepare(GrBatchFlushState* state) { this->onPrepare(state); } |
| 110 | 110 |
| 111 /** Issues the batches commands to GrGpu. */ | 111 /** Issues the batches commands to GrGpu. */ |
| 112 void draw(GrBatchFlushState* state) { this->onDraw(state); } | 112 void draw(GrBatchFlushState* state) { this->onDraw(state); } |
| 113 | 113 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 SkDEBUGCODE(bool fUsed;) | 158 SkDEBUGCODE(bool fUsed;) |
| 159 const uint32_t fClassID; | 159 const uint32_t fClassID; |
| 160 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } | 160 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } |
| 161 mutable uint32_t fUniqueID; | 161 mutable uint32_t fUniqueID; |
| 162 static int32_t gCurrBatchUniqueID; | 162 static int32_t gCurrBatchUniqueID; |
| 163 static int32_t gCurrBatchClassID; | 163 static int32_t gCurrBatchClassID; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 #endif | 166 #endif |
| OLD | NEW |