OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" | 8 #include "GrAAHairLinePathRenderer.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 } | 630 } |
631 | 631 |
632 } | 632 } |
633 | 633 |
634 /////////////////////////////////////////////////////////////////////////////// | 634 /////////////////////////////////////////////////////////////////////////////// |
635 | 635 |
636 bool GrAAHairLinePathRenderer::canDrawPath(const GrDrawTarget* target, | 636 bool GrAAHairLinePathRenderer::canDrawPath(const GrDrawTarget* target, |
637 const GrPipelineBuilder* pipelineBuil
der, | 637 const GrPipelineBuilder* pipelineBuil
der, |
638 const SkMatrix& viewMatrix, | 638 const SkMatrix& viewMatrix, |
639 const SkPath& path, | 639 const SkPath& path, |
640 const SkStrokeRec& stroke, | 640 const GrStrokeInfo& stroke, |
641 bool antiAlias) const { | 641 bool antiAlias) const { |
642 if (!antiAlias) { | 642 if (!antiAlias) { |
643 return false; | 643 return false; |
644 } | 644 } |
645 | 645 |
646 if (!IsStrokeHairlineOrEquivalent(stroke, viewMatrix, NULL)) { | 646 if (!IsStrokeHairlineOrEquivalent(stroke, viewMatrix, NULL)) { |
647 return false; | 647 return false; |
648 } | 648 } |
649 | 649 |
650 if (SkPath::kLine_SegmentMask == path.getSegmentMasks() || | 650 if (SkPath::kLine_SegmentMask == path.getSegmentMasks() || |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 } | 1022 } |
1023 } | 1023 } |
1024 } | 1024 } |
1025 } | 1025 } |
1026 | 1026 |
1027 bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, | 1027 bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
1028 GrPipelineBuilder* pipelineBuilder, | 1028 GrPipelineBuilder* pipelineBuilder, |
1029 GrColor color, | 1029 GrColor color, |
1030 const SkMatrix& viewMatrix, | 1030 const SkMatrix& viewMatrix, |
1031 const SkPath& path, | 1031 const SkPath& path, |
1032 const SkStrokeRec& stroke, | 1032 const GrStrokeInfo& stroke, |
1033 bool) { | 1033 bool) { |
1034 if (!fLinesIndexBuffer || !fQuadsIndexBuffer) { | 1034 if (!fLinesIndexBuffer || !fQuadsIndexBuffer) { |
1035 SkDebugf("unable to allocate indices\n"); | 1035 SkDebugf("unable to allocate indices\n"); |
1036 return false; | 1036 return false; |
1037 } | 1037 } |
1038 | 1038 |
1039 SkScalar hairlineCoverage; | 1039 SkScalar hairlineCoverage; |
1040 uint8_t newCoverage = 0xff; | 1040 uint8_t newCoverage = 0xff; |
1041 if (IsStrokeHairlineOrEquivalent(stroke, viewMatrix, &hairlineCoverage)) { | 1041 if (IsStrokeHairlineOrEquivalent(stroke, viewMatrix, &hairlineCoverage)) { |
1042 newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff); | 1042 newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff); |
(...skipping 16 matching lines...) Expand all Loading... |
1059 geometry.fPath = path; | 1059 geometry.fPath = path; |
1060 SkDEBUGCODE(geometry.fDevBounds = devRect;) | 1060 SkDEBUGCODE(geometry.fDevBounds = devRect;) |
1061 geometry.fDevClipBounds = devClipBounds; | 1061 geometry.fDevClipBounds = devClipBounds; |
1062 | 1062 |
1063 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf
fer, | 1063 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf
fer, |
1064 fQuadsIndexBuffer)); | 1064 fQuadsIndexBuffer)); |
1065 target->drawBatch(pipelineBuilder, batch, &devRect); | 1065 target->drawBatch(pipelineBuilder, batch, &devRect); |
1066 | 1066 |
1067 return true; | 1067 return true; |
1068 } | 1068 } |
OLD | NEW |