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

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

Issue 1420043002: Narrow the distribution of GrDrawTarget a bit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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/GrPathRendererChain.cpp ('k') | no next file » | 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"
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 return true; 22 return true;
23 } 23 }
24 24
25 namespace { 25 namespace {
26 26
27 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
28 // gets device coord bounds of path (not considering the fill) and clip. The 28 // gets device coord bounds of path (not considering the fill) and clip. The
29 // path bounds will be a subset of the clip bounds. returns false if 29 // path bounds will be a subset of the clip bounds. returns false if
30 // path bounds would be empty. 30 // path bounds would be empty.
31 bool get_path_and_clip_bounds(const GrDrawTarget* target, 31 bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder,
32 const GrPipelineBuilder* pipelineBuilder,
33 const SkPath& path, 32 const SkPath& path,
34 const SkMatrix& matrix, 33 const SkMatrix& matrix,
35 SkIRect* devPathBounds, 34 SkIRect* devPathBounds,
36 SkIRect* devClipBounds) { 35 SkIRect* devClipBounds) {
37 // compute bounds as intersection of rt size, clip, and path 36 // compute bounds as intersection of rt size, clip, and path
38 const GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); 37 const GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
39 if (nullptr == rt) { 38 if (nullptr == rt) {
40 return false; 39 return false;
41 } 40 }
42 41
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 102 }
104 103
105 //////////////////////////////////////////////////////////////////////////////// 104 ////////////////////////////////////////////////////////////////////////////////
106 // return true on success; false on failure 105 // return true on success; false on failure
107 bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) { 106 bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
108 if (nullptr == fContext) { 107 if (nullptr == fContext) {
109 return false; 108 return false;
110 } 109 }
111 110
112 SkIRect devPathBounds, devClipBounds; 111 SkIRect devPathBounds, devClipBounds;
113 if (!get_path_and_clip_bounds(args.fTarget, args.fPipelineBuilder, *args.fPa th, 112 if (!get_path_and_clip_bounds(args.fPipelineBuilder, *args.fPath,
114 *args.fViewMatrix, &devPathBounds, &devClipBou nds)) { 113 *args.fViewMatrix, &devPathBounds, &devClipBou nds)) {
115 if (args.fPath->isInverseFillType()) { 114 if (args.fPath->isInverseFillType()) {
116 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColo r, 115 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColo r,
117 *args.fViewMatrix, devClipBounds, devPathBounds ); 116 *args.fViewMatrix, devClipBounds, devPathBounds );
118 } 117 }
119 return true; 118 return true;
120 } 119 }
121 120
122 SkAutoTUnref<GrTexture> texture( 121 SkAutoTUnref<GrTexture> texture(
123 GrSWMaskHelper::DrawPathMaskToTexture(fContext, *args.fPath, *args.f Stroke, 122 GrSWMaskHelper::DrawPathMaskToTexture(fContext, *args.fPath, *args.f Stroke,
124 devPathBounds, 123 devPathBounds,
125 args.fAntiAlias, args.fViewMat rix)); 124 args.fAntiAlias, args.fViewMat rix));
126 if (nullptr == texture) { 125 if (nullptr == texture) {
127 return false; 126 return false;
128 } 127 }
129 128
130 GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipeli neBuilder, 129 GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipeli neBuilder,
131 args.fColor, *args.fViewMatrix, dev PathBounds); 130 args.fColor, *args.fViewMatrix, dev PathBounds);
132 131
133 if (args.fPath->isInverseFillType()) { 132 if (args.fPath->isInverseFillType()) {
134 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, * args.fViewMatrix, 133 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, * args.fViewMatrix,
135 devClipBounds, devPathBounds); 134 devClipBounds, devPathBounds);
136 } 135 }
137 136
138 return true; 137 return true;
139 } 138 }
OLDNEW
« no previous file with comments | « src/gpu/GrPathRendererChain.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698