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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #define GrBATCH_INFO(...) | 46 #define GrBATCH_INFO(...) |
47 #endif | 47 #endif |
48 | 48 |
49 // A helper macro to generate a class static id | 49 // A helper macro to generate a class static id |
50 #define DEFINE_BATCH_CLASS_ID \ | 50 #define DEFINE_BATCH_CLASS_ID \ |
51 static uint32_t ClassID() { \ | 51 static uint32_t ClassID() { \ |
52 static uint32_t kClassID = GenBatchClassID(); \ | 52 static uint32_t kClassID = GenBatchClassID(); \ |
53 return kClassID; \ | 53 return kClassID; \ |
54 } | 54 } |
55 | 55 |
56 class GrBatch : public GrNonAtomicRef { | 56 class GrBatch : public GrNonAtomicRef<GrBatch> { |
57 public: | 57 public: |
58 GrBatch(uint32_t classID); | 58 GrBatch(uint32_t classID); |
59 ~GrBatch() override; | 59 virtual ~GrBatch(); |
60 | 60 |
61 virtual const char* name() const = 0; | 61 virtual const char* name() const = 0; |
62 | 62 |
63 bool combineIfPossible(GrBatch* that, const GrCaps& caps) { | 63 bool combineIfPossible(GrBatch* that, const GrCaps& caps) { |
64 if (this->classID() != that->classID()) { | 64 if (this->classID() != that->classID()) { |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 return this->onCombineIfPossible(that, caps); | 68 return this->onCombineIfPossible(that, caps); |
69 } | 69 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 }; | 152 }; |
153 | 153 |
154 SkDEBUGCODE(bool fUsed;) | 154 SkDEBUGCODE(bool fUsed;) |
155 const uint32_t fClassID; | 155 const uint32_t fClassID; |
156 #if GR_BATCH_SPEW | 156 #if GR_BATCH_SPEW |
157 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } | 157 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } |
158 const uint32_t fUniqueID; | 158 const uint32_t fUniqueID; |
159 static int32_t gCurrBatchUniqueID; | 159 static int32_t gCurrBatchUniqueID; |
160 #endif | 160 #endif |
161 static int32_t gCurrBatchClassID; | 161 static int32_t gCurrBatchClassID; |
162 typedef GrNonAtomicRef INHERITED; | |
163 }; | 162 }; |
164 | 163 |
165 #endif | 164 #endif |
OLD | NEW |