| 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 "GrTessellatingPathRenderer.h" | 8 #include "GrTessellatingPathRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 const char* name() const override { return "TessellatingPathBatch"; } | 1398 const char* name() const override { return "TessellatingPathBatch"; } |
| 1399 | 1399 |
| 1400 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 1400 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 1401 out->setKnownFourComponents(fColor); | 1401 out->setKnownFourComponents(fColor); |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 1404 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 1405 out->setUnknownSingleComponent(); | 1405 out->setUnknownSingleComponent(); |
| 1406 } | 1406 } |
| 1407 | 1407 |
| 1408 private: |
| 1408 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 1409 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 1409 // Handle any color overrides | 1410 // Handle any color overrides |
| 1410 if (!opt.readsColor()) { | 1411 if (!opt.readsColor()) { |
| 1411 fColor = GrColor_ILLEGAL; | 1412 fColor = GrColor_ILLEGAL; |
| 1412 } | 1413 } |
| 1413 opt.getOverrideColorIfSet(&fColor); | 1414 opt.getOverrideColorIfSet(&fColor); |
| 1414 fPipelineInfo = opt; | 1415 fPipelineInfo = opt; |
| 1415 } | 1416 } |
| 1416 | 1417 |
| 1417 int tessellate(GrUniqueKey* key, | 1418 int tessellate(GrUniqueKey* key, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 | 1564 |
| 1564 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType | 1565 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType |
| 1565 : kTriangles_GrPrimitiveType; | 1566 : kTriangles_GrPrimitiveType; |
| 1566 GrVertices vertices; | 1567 GrVertices vertices; |
| 1567 vertices.init(primitiveType, vertexBuffer.get(), 0, actualCount); | 1568 vertices.init(primitiveType, vertexBuffer.get(), 0, actualCount); |
| 1568 target->draw(vertices); | 1569 target->draw(vertices); |
| 1569 } | 1570 } |
| 1570 | 1571 |
| 1571 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return false; } | 1572 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return false; } |
| 1572 | 1573 |
| 1573 private: | |
| 1574 TessellatingPathBatch(const GrColor& color, | 1574 TessellatingPathBatch(const GrColor& color, |
| 1575 const SkPath& path, | 1575 const SkPath& path, |
| 1576 const GrStrokeInfo& stroke, | 1576 const GrStrokeInfo& stroke, |
| 1577 const SkMatrix& viewMatrix, | 1577 const SkMatrix& viewMatrix, |
| 1578 const SkRect& clipBounds) | 1578 const SkRect& clipBounds) |
| 1579 : fColor(color) | 1579 : fColor(color) |
| 1580 , fPath(path) | 1580 , fPath(path) |
| 1581 , fStroke(stroke) | 1581 , fStroke(stroke) |
| 1582 , fViewMatrix(viewMatrix) | 1582 , fViewMatrix(viewMatrix) |
| 1583 , fClipBounds(clipBounds) { | 1583 , fClipBounds(clipBounds) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 bool result = viewMatrix.invert(&vmi); | 1641 bool result = viewMatrix.invert(&vmi); |
| 1642 if (!result) { | 1642 if (!result) { |
| 1643 SkFAIL("Cannot invert matrix\n"); | 1643 SkFAIL("Cannot invert matrix\n"); |
| 1644 } | 1644 } |
| 1645 vmi.mapRect(&clipBounds); | 1645 vmi.mapRect(&clipBounds); |
| 1646 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); | 1646 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); |
| 1647 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl
ipBounds); | 1647 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl
ipBounds); |
| 1648 } | 1648 } |
| 1649 | 1649 |
| 1650 #endif | 1650 #endif |
| OLD | NEW |