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

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

Issue 1128113008: Make GrStrokeInfo inherit from SkStrokeRec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address review comments Created 5 years, 7 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/GrSoftwarePathRenderer.cpp ('k') | src/gpu/GrStrokeInfo.h » ('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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrStencilAndCoverPathRenderer.h" 10 #include "GrStencilAndCoverPathRenderer.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 GrStencilAndCoverPathRenderer::~GrStencilAndCoverPathRenderer() { 52 GrStencilAndCoverPathRenderer::~GrStencilAndCoverPathRenderer() {
53 fGpu->unref(); 53 fGpu->unref();
54 } 54 }
55 55
56 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target, 56 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target,
57 const GrPipelineBuilder* pipelin eBuilder, 57 const GrPipelineBuilder* pipelin eBuilder,
58 const SkMatrix& viewMatrix, 58 const SkMatrix& viewMatrix,
59 const SkPath& path, 59 const SkPath& path,
60 const GrStrokeInfo& stroke, 60 const GrStrokeInfo& stroke,
61 bool antiAlias) const { 61 bool antiAlias) const {
62 return !stroke.getStrokeRec().isHairlineStyle() && 62 return !stroke.isHairlineStyle() &&
63 !stroke.isDashed() && 63 !stroke.isDashed() &&
64 !antiAlias && // doesn't do per-path AA, relies on the target having MSA A 64 !antiAlias && // doesn't do per-path AA, relies on the target having MSA A
65 pipelineBuilder->getStencil().isDisabled(); 65 pipelineBuilder->getStencil().isDisabled();
66 } 66 }
67 67
68 GrPathRenderer::StencilSupport 68 GrPathRenderer::StencilSupport
69 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, 69 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*,
70 const GrPipelineBuilder*, 70 const GrPipelineBuilder*,
71 const SkPath&, 71 const SkPath&,
72 const GrStrokeInfo&) const { 72 const GrStrokeInfo&) const {
(...skipping 13 matching lines...) Expand all
86 return path.detach(); 86 return path.detach();
87 } 87 }
88 88
89 void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target, 89 void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target,
90 GrPipelineBuilder* pipelineBui lder, 90 GrPipelineBuilder* pipelineBui lder,
91 const SkMatrix& viewMatrix, 91 const SkMatrix& viewMatrix,
92 const SkPath& path, 92 const SkPath& path,
93 const GrStrokeInfo& stroke) { 93 const GrStrokeInfo& stroke) {
94 SkASSERT(!path.isInverseFillType()); 94 SkASSERT(!path.isInverseFillType());
95 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, view Matrix)); 95 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, view Matrix));
96 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke.getStrokeRec())); 96 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke));
97 target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.get FillType())); 97 target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.get FillType()));
98 } 98 }
99 99
100 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target, 100 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
101 GrPipelineBuilder* pipelineBuilde r, 101 GrPipelineBuilder* pipelineBuilde r,
102 GrColor color, 102 GrColor color,
103 const SkMatrix& viewMatrix, 103 const SkMatrix& viewMatrix,
104 const SkPath& path, 104 const SkPath& path,
105 const GrStrokeInfo& stroke, 105 const GrStrokeInfo& stroke,
106 bool antiAlias) { 106 bool antiAlias) {
107 SkASSERT(!antiAlias); 107 SkASSERT(!antiAlias);
108 SkASSERT(!stroke.getStrokeRec().isHairlineStyle()); 108 SkASSERT(!stroke.isHairlineStyle());
109 SkASSERT(!stroke.isDashed()); 109 SkASSERT(!stroke.isDashed());
110 SkASSERT(pipelineBuilder->getStencil().isDisabled()); 110 SkASSERT(pipelineBuilder->getStencil().isDisabled());
111 111
112 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke.getStrokeRec())); 112 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke));
113 113
114 if (path.isInverseFillType()) { 114 if (path.isInverseFillType()) {
115 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, 115 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass,
116 kZero_StencilOp, 116 kZero_StencilOp,
117 kZero_StencilOp, 117 kZero_StencilOp,
118 // We know our rect will hit pixels outside the clip and the user bi ts will be 0 118 // We know our rect will hit pixels outside the clip and the user bi ts will be 0
119 // outside the clip. So we can't just fill where the user bits are 0 . We also need to 119 // outside the clip. So we can't just fill where the user bits are 0 . We also need to
120 // check that the clip bit is set. 120 // check that the clip bit is set.
121 kEqualIfInClip_StencilFunc, 121 kEqualIfInClip_StencilFunc,
122 0xffff, 122 0xffff,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 0xffff); 158 0xffff);
159 159
160 pipelineBuilder->setStencil(kStencilPass); 160 pipelineBuilder->setStencil(kStencilPass);
161 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix)); 161 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix));
162 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType())); 162 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType()));
163 } 163 }
164 164
165 pipelineBuilder->stencil()->setDisabled(); 165 pipelineBuilder->stencil()->setDisabled();
166 return true; 166 return true;
167 } 167 }
OLDNEW
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.cpp ('k') | src/gpu/GrStrokeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698