| 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 "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 const char* name() const override { return "TessellatingPathBatch"; } | 1406 const char* name() const override { return "TessellatingPathBatch"; } |
| 1407 | 1407 |
| 1408 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 1408 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 1409 out->setKnownFourComponents(fColor); | 1409 out->setKnownFourComponents(fColor); |
| 1410 } | 1410 } |
| 1411 | 1411 |
| 1412 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 1412 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 1413 out->setUnknownSingleComponent(); | 1413 out->setUnknownSingleComponent(); |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 void initBatchTracker(const GrPipelineInfo& init) override { | 1416 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 1417 // Handle any color overrides | 1417 // Handle any color overrides |
| 1418 if (!init.readsColor()) { | 1418 if (!opt.readsColor()) { |
| 1419 fColor = GrColor_ILLEGAL; | 1419 fColor = GrColor_ILLEGAL; |
| 1420 } | 1420 } |
| 1421 init.getOverrideColorIfSet(&fColor); | 1421 opt.getOverrideColorIfSet(&fColor); |
| 1422 fPipelineInfo = init; | 1422 fPipelineInfo = opt; |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 int tessellate(GrUniqueKey* key, | 1425 int tessellate(GrUniqueKey* key, |
| 1426 GrResourceProvider* resourceProvider, | 1426 GrResourceProvider* resourceProvider, |
| 1427 SkAutoTUnref<GrVertexBuffer>& vertexBuffer) { | 1427 SkAutoTUnref<GrVertexBuffer>& vertexBuffer) { |
| 1428 SkPath path; | 1428 SkPath path; |
| 1429 GrStrokeInfo stroke(fStroke); | 1429 GrStrokeInfo stroke(fStroke); |
| 1430 if (stroke.isDashed()) { | 1430 if (stroke.isDashed()) { |
| 1431 if (!stroke.applyDashToPath(&path, &stroke, fPath)) { | 1431 if (!stroke.applyDashToPath(&path, &stroke, fPath)) { |
| 1432 return 0; | 1432 return 0; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 SkScalar scale = stroke.getMiter(); | 1600 SkScalar scale = stroke.getMiter(); |
| 1601 if (scale > SK_Scalar1) { | 1601 if (scale > SK_Scalar1) { |
| 1602 radius = SkScalarMul(radius, scale); | 1602 radius = SkScalarMul(radius, scale); |
| 1603 } | 1603 } |
| 1604 } | 1604 } |
| 1605 fBounds.outset(radius, radius); | 1605 fBounds.outset(radius, radius); |
| 1606 } | 1606 } |
| 1607 viewMatrix.mapRect(&fBounds); | 1607 viewMatrix.mapRect(&fBounds); |
| 1608 } | 1608 } |
| 1609 | 1609 |
| 1610 GrColor fColor; | 1610 GrColor fColor; |
| 1611 SkPath fPath; | 1611 SkPath fPath; |
| 1612 GrStrokeInfo fStroke; | 1612 GrStrokeInfo fStroke; |
| 1613 SkMatrix fViewMatrix; | 1613 SkMatrix fViewMatrix; |
| 1614 SkRect fClipBounds; // in source space | 1614 SkRect fClipBounds; // in source space |
| 1615 GrPipelineInfo fPipelineInfo; | 1615 GrPipelineOptimizations fPipelineInfo; |
| 1616 }; | 1616 }; |
| 1617 | 1617 |
| 1618 bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) { | 1618 bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) { |
| 1619 SkASSERT(!args.fAntiAlias); | 1619 SkASSERT(!args.fAntiAlias); |
| 1620 const GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget(); | 1620 const GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget(); |
| 1621 if (NULL == rt) { | 1621 if (NULL == rt) { |
| 1622 return false; | 1622 return false; |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 SkIRect clipBoundsI; | 1625 SkIRect clipBoundsI; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1651 bool result = viewMatrix.invert(&vmi); | 1651 bool result = viewMatrix.invert(&vmi); |
| 1652 if (!result) { | 1652 if (!result) { |
| 1653 SkFAIL("Cannot invert matrix\n"); | 1653 SkFAIL("Cannot invert matrix\n"); |
| 1654 } | 1654 } |
| 1655 vmi.mapRect(&clipBounds); | 1655 vmi.mapRect(&clipBounds); |
| 1656 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); | 1656 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); |
| 1657 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl
ipBounds); | 1657 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl
ipBounds); |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 #endif | 1660 #endif |
| OLD | NEW |