OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAARectRenderer.h" | 9 #include "GrAARectRenderer.h" |
10 #include "GrAtlasTextContext.h" | 10 #include "GrAtlasTextContext.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 390 |
391 | 391 |
392 GrColor color() const { return fBatch.fColor; } | 392 GrColor color() const { return fBatch.fColor; } |
393 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 393 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
394 bool colorIgnored() const { return fBatch.fColorIgnored; } | 394 bool colorIgnored() const { return fBatch.fColorIgnored; } |
395 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 395 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
396 bool hairline() const { return fBatch.fHairline; } | 396 bool hairline() const { return fBatch.fHairline; } |
397 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } | 397 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } |
398 | 398 |
399 bool onCombineIfPossible(GrBatch* t) override { | 399 bool onCombineIfPossible(GrBatch* t) override { |
| 400 //if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 401 // return false; |
| 402 //} |
400 // StrokeRectBatch* that = t->cast<StrokeRectBatch>(); | 403 // StrokeRectBatch* that = t->cast<StrokeRectBatch>(); |
401 | 404 |
402 // NonAA stroke rects cannot batch right now | 405 // NonAA stroke rects cannot batch right now |
403 // TODO make these batchable | 406 // TODO make these batchable |
404 return false; | 407 return false; |
405 } | 408 } |
406 | 409 |
407 struct BatchTracker { | 410 struct BatchTracker { |
408 GrColor fColor; | 411 GrColor fColor; |
409 bool fUsesLocalCoords; | 412 bool fUsesLocalCoords; |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 bool colorIgnored() const { return fBatch.fColorIgnored; } | 758 bool colorIgnored() const { return fBatch.fColorIgnored; } |
756 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } | 759 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } |
757 bool hasColors() const { return fBatch.fHasColors; } | 760 bool hasColors() const { return fBatch.fHasColors; } |
758 bool hasIndices() const { return fBatch.fHasIndices; } | 761 bool hasIndices() const { return fBatch.fHasIndices; } |
759 bool hasLocalCoords() const { return fBatch.fHasLocalCoords; } | 762 bool hasLocalCoords() const { return fBatch.fHasLocalCoords; } |
760 int vertexCount() const { return fBatch.fVertexCount; } | 763 int vertexCount() const { return fBatch.fVertexCount; } |
761 int indexCount() const { return fBatch.fIndexCount; } | 764 int indexCount() const { return fBatch.fIndexCount; } |
762 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } | 765 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } |
763 | 766 |
764 bool onCombineIfPossible(GrBatch* t) override { | 767 bool onCombineIfPossible(GrBatch* t) override { |
| 768 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 769 return false; |
| 770 } |
| 771 |
765 DrawVerticesBatch* that = t->cast<DrawVerticesBatch>(); | 772 DrawVerticesBatch* that = t->cast<DrawVerticesBatch>(); |
766 | 773 |
767 if (!this->batchablePrimitiveType() || this->primitiveType() != that->pr
imitiveType()) { | 774 if (!this->batchablePrimitiveType() || this->primitiveType() != that->pr
imitiveType()) { |
768 return false; | 775 return false; |
769 } | 776 } |
770 | 777 |
771 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 778 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
772 | 779 |
773 // We currently use a uniform viewmatrix for this batch | 780 // We currently use a uniform viewmatrix for this batch |
774 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { | 781 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 return DrawVerticesBatch::Create(geometry, type, viewMatrix, | 1318 return DrawVerticesBatch::Create(geometry, type, viewMatrix, |
1312 positions.begin(), vertexCount, | 1319 positions.begin(), vertexCount, |
1313 indices.begin(), hasIndices ? vertexCount :
0, | 1320 indices.begin(), hasIndices ? vertexCount :
0, |
1314 colors.begin(), | 1321 colors.begin(), |
1315 texCoords.begin(), | 1322 texCoords.begin(), |
1316 bounds); | 1323 bounds); |
1317 } | 1324 } |
1318 | 1325 |
1319 #endif | 1326 #endif |
1320 | 1327 |
OLD | NEW |