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 #include "GrRectBatch.h" | 8 #include "GrRectBatch.h" |
9 | 9 |
10 #include "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
(...skipping 62 matching lines...) Loading... |
73 GrColor* vertColor = reinterpret_cast<GrColor*>(offset + kColorOffset); | 73 GrColor* vertColor = reinterpret_cast<GrColor*>(offset + kColorOffset); |
74 for (int j = 0; j < 4; ++j) { | 74 for (int j = 0; j < 4; ++j) { |
75 *vertColor = geom.fColor; | 75 *vertColor = geom.fColor; |
76 vertColor = (GrColor*) ((intptr_t) vertColor + vertexStride); | 76 vertColor = (GrColor*) ((intptr_t) vertColor + vertexStride); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 helper.issueDraw(batchTarget); | 80 helper.issueDraw(batchTarget); |
81 } | 81 } |
82 | 82 |
83 bool GrRectBatch::onCombineIfPossible(GrBatch* t) { | 83 bool GrRectBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { |
84 if (!this->pipeline()->isEqual(*t->pipeline())) { | 84 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(
), t->bounds(), |
| 85 caps)) { |
85 return false; | 86 return false; |
86 } | 87 } |
87 | 88 |
88 GrRectBatch* that = t->cast<GrRectBatch>(); | 89 GrRectBatch* that = t->cast<GrRectBatch>(); |
89 | 90 |
90 if (this->hasLocalRect() != that->hasLocalRect()) { | 91 if (this->hasLocalRect() != that->hasLocalRect()) { |
91 return false; | 92 return false; |
92 } | 93 } |
93 | 94 |
94 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 95 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
(...skipping 70 matching lines...) Loading... |
165 | 166 |
166 geometry.fHasLocalMatrix = random->nextBool(); | 167 geometry.fHasLocalMatrix = random->nextBool(); |
167 if (geometry.fHasLocalMatrix) { | 168 if (geometry.fHasLocalMatrix) { |
168 geometry.fLocalMatrix = GrTest::TestMatrix(random); | 169 geometry.fLocalMatrix = GrTest::TestMatrix(random); |
169 } | 170 } |
170 | 171 |
171 return GrRectBatch::Create(geometry); | 172 return GrRectBatch::Create(geometry); |
172 } | 173 } |
173 | 174 |
174 #endif | 175 #endif |
OLD | NEW |