| 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 "GrBatchTest.h" | 8 #include "GrBatchTest.h" |
| 9 #include "GrColor.h" | 9 #include "GrColor.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 757 |
| 758 // TODO clients should give us bounds | 758 // TODO clients should give us bounds |
| 759 SkRect bounds; | 759 SkRect bounds; |
| 760 if (!bounds.setBoundsCheck(positions, vertexCount)) { | 760 if (!bounds.setBoundsCheck(positions, vertexCount)) { |
| 761 SkDebugf("drawVertices call empty bounds\n"); | 761 SkDebugf("drawVertices call empty bounds\n"); |
| 762 return; | 762 return; |
| 763 } | 763 } |
| 764 | 764 |
| 765 viewMatrix.mapRect(&bounds); | 765 viewMatrix.mapRect(&bounds); |
| 766 | 766 |
| 767 // If we don't have AA then we outset for a half pixel in each direction to
account for | |
| 768 // snapping. We also do this for the "hair" primitive types: lines and point
s since they have | |
| 769 // a 1 pixel thickness in device space. | |
| 770 if (!paint.isAntiAlias() || GrIsPrimTypeLines(primitiveType) || | |
| 771 kPoints_GrPrimitiveType == primitiveType) { | |
| 772 bounds.outset(0.5f, 0.5f); | |
| 773 } | |
| 774 | |
| 775 SkAutoTUnref<GrDrawBatch> batch(new GrDrawVerticesBatch(paint.getColor(), | 767 SkAutoTUnref<GrDrawBatch> batch(new GrDrawVerticesBatch(paint.getColor(), |
| 776 primitiveType, viewM
atrix, positions, | 768 primitiveType, viewM
atrix, positions, |
| 777 vertexCount, indices
, indexCount, | 769 vertexCount, indices
, indexCount, |
| 778 colors, texCoords, b
ounds)); | 770 colors, texCoords, b
ounds)); |
| 779 | 771 |
| 780 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); | 772 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); |
| 781 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 773 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
| 782 } | 774 } |
| 783 | 775 |
| 784 /////////////////////////////////////////////////////////////////////////////// | 776 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 | 1420 |
| 1429 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1421 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
| 1430 GrDrawBatch* batch) { | 1422 GrDrawBatch* batch) { |
| 1431 ASSERT_SINGLE_OWNER | 1423 ASSERT_SINGLE_OWNER |
| 1432 RETURN_IF_ABANDONED | 1424 RETURN_IF_ABANDONED |
| 1433 SkDEBUGCODE(this->validate();) | 1425 SkDEBUGCODE(this->validate();) |
| 1434 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1426 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
| 1435 | 1427 |
| 1436 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1428 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
| 1437 } | 1429 } |
| OLD | NEW |