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 "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 GrColor color() const { return fBatch.fColor; } | 166 GrColor color() const { return fBatch.fColor; } |
167 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 167 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
168 bool colorIgnored() const { return fBatch.fColorIgnored; } | 168 bool colorIgnored() const { return fBatch.fColorIgnored; } |
169 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 169 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
170 const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; } | 170 const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; } |
171 bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; } | 171 bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; } |
172 bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; } | 172 bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; } |
173 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } | 173 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } |
174 | 174 |
175 bool onCombineIfPossible(GrBatch* t) override { | 175 bool onCombineIfPossible(GrBatch* t) override { |
| 176 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 177 return false; |
| 178 } |
| 179 |
176 RectBatch* that = t->cast<RectBatch>(); | 180 RectBatch* that = t->cast<RectBatch>(); |
177 | 181 |
178 if (this->hasLocalRect() != that->hasLocalRect()) { | 182 if (this->hasLocalRect() != that->hasLocalRect()) { |
179 return false; | 183 return false; |
180 } | 184 } |
181 | 185 |
182 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 186 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
183 if (!this->hasLocalRect() && this->usesLocalCoords()) { | 187 if (!this->hasLocalRect() && this->usesLocalCoords()) { |
184 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { | 188 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { |
185 return false; | 189 return false; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if (hasLocalMatrix) { | 272 if (hasLocalMatrix) { |
269 localMatrix = GrTest::TestMatrix(random); | 273 localMatrix = GrTest::TestMatrix(random); |
270 } | 274 } |
271 | 275 |
272 return GrRectBatch::Create(color, viewMatrix, rect, | 276 return GrRectBatch::Create(color, viewMatrix, rect, |
273 hasLocalRect ? &localRect : NULL, | 277 hasLocalRect ? &localRect : NULL, |
274 hasLocalMatrix ? &localMatrix : NULL); | 278 hasLocalMatrix ? &localMatrix : NULL); |
275 } | 279 } |
276 | 280 |
277 #endif | 281 #endif |
OLD | NEW |