| 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 viewMatrix.mapRect(&bounds); | 551 viewMatrix.mapRect(&bounds); |
| 552 | 552 |
| 553 // If we don't have AA then we outset for a half pixel in each direction to
account for | 553 // If we don't have AA then we outset for a half pixel in each direction to
account for |
| 554 // snapping. We also do this for the "hair" primitive types: lines and point
s since they have | 554 // snapping. We also do this for the "hair" primitive types: lines and point
s since they have |
| 555 // a 1 pixel thickness in device space. | 555 // a 1 pixel thickness in device space. |
| 556 if (!paint.isAntiAlias() || GrIsPrimTypeLines(primitiveType) || | 556 if (!paint.isAntiAlias() || GrIsPrimTypeLines(primitiveType) || |
| 557 kPoints_GrPrimitiveType == primitiveType) { | 557 kPoints_GrPrimitiveType == primitiveType) { |
| 558 bounds.outset(0.5f, 0.5f); | 558 bounds.outset(0.5f, 0.5f); |
| 559 } | 559 } |
| 560 | 560 |
| 561 GrDrawVerticesBatch::Geometry geometry; | 561 SkAutoTUnref<GrDrawBatch> batch(new GrDrawVerticesBatch(paint.getColor(), |
| 562 geometry.fColor = paint.getColor(); | 562 primitiveType, viewM
atrix, positions, |
| 563 SkAutoTUnref<GrDrawBatch> batch(GrDrawVerticesBatch::Create(geometry, primit
iveType, viewMatrix, | 563 vertexCount, indices
, indexCount, |
| 564 positions, verte
xCount, indices, | 564 colors, texCoords, b
ounds)); |
| 565 indexCount, colo
rs, texCoords, | |
| 566 bounds)); | |
| 567 | 565 |
| 568 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); | 566 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); |
| 569 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 567 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
| 570 } | 568 } |
| 571 | 569 |
| 572 /////////////////////////////////////////////////////////////////////////////// | 570 /////////////////////////////////////////////////////////////////////////////// |
| 573 | 571 |
| 574 void GrDrawContext::drawAtlas(const GrClip& clip, | 572 void GrDrawContext::drawAtlas(const GrClip& clip, |
| 575 const GrPaint& paint, | 573 const GrPaint& paint, |
| 576 const SkMatrix& viewMatrix, | 574 const SkMatrix& viewMatrix, |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1029 |
| 1032 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1030 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
| 1033 GrDrawBatch* batch) { | 1031 GrDrawBatch* batch) { |
| 1034 ASSERT_SINGLE_OWNER | 1032 ASSERT_SINGLE_OWNER |
| 1035 RETURN_IF_ABANDONED | 1033 RETURN_IF_ABANDONED |
| 1036 SkDEBUGCODE(this->validate();) | 1034 SkDEBUGCODE(this->validate();) |
| 1037 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1035 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
| 1038 | 1036 |
| 1039 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1037 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
| 1040 } | 1038 } |
| OLD | NEW |