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

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

Issue 1096513002: Pass dashing information to path rasterizers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 100-col issue 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
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 #include "GrStrokeInfo.h"
12 13
13 //////////////////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////////////////
14 bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*, 15 bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*,
15 const GrPipelineBuilder*, 16 const GrPipelineBuilder*,
16 const SkMatrix& viewMatrix, 17 const SkMatrix& viewMatrix,
17 const SkPath&, 18 const SkPath&,
18 const SkStrokeRec&, 19 const GrStrokeInfo&,
19 bool antiAlias) const { 20 bool antiAlias) const {
20 if (NULL == fContext) { 21 if (NULL == fContext) {
21 return false; 22 return false;
22 } 23 }
23 24
24 return true; 25 return true;
25 } 26 }
26 27
27 GrPathRenderer::StencilSupport 28 GrPathRenderer::StencilSupport
28 GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*, 29 GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*,
29 const GrPipelineBuilder*, 30 const GrPipelineBuilder*,
30 const SkPath&, 31 const SkPath&,
31 const SkStrokeRec&) const { 32 const GrStrokeInfo&) const {
32 return GrPathRenderer::kNoSupport_StencilSupport; 33 return GrPathRenderer::kNoSupport_StencilSupport;
33 } 34 }
34 35
35 namespace { 36 namespace {
36 37
37 //////////////////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////////////////
38 // gets device coord bounds of path (not considering the fill) and clip. The 39 // 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 40 // path bounds will be a subset of the clip bounds. returns false if
40 // path bounds would be empty. 41 // path bounds would be empty.
41 bool get_path_and_clip_bounds(const GrDrawTarget* target, 42 bool get_path_and_clip_bounds(const GrDrawTarget* target,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 113
113 } 114 }
114 115
115 //////////////////////////////////////////////////////////////////////////////// 116 ////////////////////////////////////////////////////////////////////////////////
116 // return true on success; false on failure 117 // return true on success; false on failure
117 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target, 118 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
118 GrPipelineBuilder* pipelineBuilder, 119 GrPipelineBuilder* pipelineBuilder,
119 GrColor color, 120 GrColor color,
120 const SkMatrix& viewMatrix, 121 const SkMatrix& viewMatrix,
121 const SkPath& path, 122 const SkPath& path,
122 const SkStrokeRec& stroke, 123 const GrStrokeInfo& stroke,
123 bool antiAlias) { 124 bool antiAlias) {
124 125
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

Powered by Google App Engine
This is Rietveld 408576698