Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 1100073003: Extract gpu line dashing to GrDashLinePathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address review comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrAddPathRenderers_default.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrAddPathRenderers_default.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698