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

Side by Side Diff: src/gpu/GrSoftwarePathRenderer.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, 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.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.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 #include "GrSoftwarePathRenderer.h" 9 #include "GrSoftwarePathRenderer.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
11 #include "GrSWMaskHelper.h" 11 #include "GrSWMaskHelper.h"
12 12
13 //////////////////////////////////////////////////////////////////////////////// 13 ////////////////////////////////////////////////////////////////////////////////
14 bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*, 14 bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*,
15 const GrPipelineBuilder*, 15 const GrPipelineBuilder*,
16 const SkMatrix& viewMatrix, 16 const SkMatrix& viewMatrix,
17 const SkPath&, 17 const SkPath&,
18 const SkStrokeRec&, 18 const GrStrokeInfo& stroke,
19 bool antiAlias) const { 19 bool antiAlias) const {
20 if (NULL == fContext) { 20 if (NULL == fContext) {
21 return false; 21 return false;
22 } 22 }
23 23 if (stroke.isDashed()) {
24 return false;
25 }
24 return true; 26 return true;
25 } 27 }
26 28
27 GrPathRenderer::StencilSupport 29 GrPathRenderer::StencilSupport
28 GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*, 30 GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*,
29 const GrPipelineBuilder*, 31 const GrPipelineBuilder*,
30 const SkPath&, 32 const SkPath&,
31 const SkStrokeRec&) const { 33 const GrStrokeInfo&) const {
32 return GrPathRenderer::kNoSupport_StencilSupport; 34 return GrPathRenderer::kNoSupport_StencilSupport;
33 } 35 }
34 36
35 namespace { 37 namespace {
36 38
37 //////////////////////////////////////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////////////////
38 // gets device coord bounds of path (not considering the fill) and clip. The 40 // gets device coord bounds of path (not considering the fill) and clip. The
39 // path bounds will be a subset of the clip bounds. returns false if 41 // path bounds will be a subset of the clip bounds. returns false if
40 // path bounds would be empty. 42 // path bounds would be empty.
41 bool get_path_and_clip_bounds(const GrDrawTarget* target, 43 bool get_path_and_clip_bounds(const GrDrawTarget* target,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 114
113 } 115 }
114 116
115 //////////////////////////////////////////////////////////////////////////////// 117 ////////////////////////////////////////////////////////////////////////////////
116 // return true on success; false on failure 118 // return true on success; false on failure
117 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target, 119 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
118 GrPipelineBuilder* pipelineBuilder, 120 GrPipelineBuilder* pipelineBuilder,
119 GrColor color, 121 GrColor color,
120 const SkMatrix& viewMatrix, 122 const SkMatrix& viewMatrix,
121 const SkPath& path, 123 const SkPath& path,
122 const SkStrokeRec& stroke, 124 const GrStrokeInfo& stroke,
123 bool antiAlias) { 125 bool antiAlias) {
124
125 if (NULL == fContext) { 126 if (NULL == fContext) {
126 return false; 127 return false;
127 } 128 }
128 129
129 SkIRect devPathBounds, devClipBounds; 130 SkIRect devPathBounds, devClipBounds;
130 if (!get_path_and_clip_bounds(target, pipelineBuilder, path, viewMatrix, &de vPathBounds, 131 if (!get_path_and_clip_bounds(target, pipelineBuilder, path, viewMatrix, &de vPathBounds,
131 &devClipBounds)) { 132 &devClipBounds)) {
132 if (path.isInverseFillType()) { 133 if (path.isInverseFillType()) {
133 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, dev ClipBounds, 134 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, dev ClipBounds,
134 devPathBounds); 135 devPathBounds);
135 } 136 }
136 return true; 137 return true;
137 } 138 }
138 139
139 SkAutoTUnref<GrTexture> texture( 140 SkAutoTUnref<GrTexture> texture(
140 GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke, 141 GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke.getStro keRec(),
141 devPathBounds, 142 devPathBounds,
142 antiAlias, &viewMatrix)); 143 antiAlias, &viewMatrix));
143 if (NULL == texture) { 144 if (NULL == texture) {
144 return false; 145 return false;
145 } 146 }
146 147
147 GrPipelineBuilder copy = *pipelineBuilder; 148 GrPipelineBuilder copy = *pipelineBuilder;
148 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, color, view Matrix, 149 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, color, view Matrix,
149 devPathBounds); 150 devPathBounds);
150 151
151 if (path.isInverseFillType()) { 152 if (path.isInverseFillType()) {
152 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip Bounds, 153 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip Bounds,
153 devPathBounds); 154 devPathBounds);
154 } 155 }
155 156
156 return true; 157 return true;
157 } 158 }
OLDNEW
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698