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

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

Issue 142543007: Revert of r13384 (Stateful PathRenderer implementation) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« 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 SkStrokeRec&, 14 bool GrSoftwarePathRenderer::canDrawPath(const SkPath&,
15 const SkStrokeRec&,
15 const GrDrawTarget*, 16 const GrDrawTarget*,
16 bool antiAlias) const { 17 bool antiAlias) const {
17 if (!antiAlias || NULL == fContext) { 18 if (!antiAlias || NULL == fContext) {
18 // TODO: We could allow the SW path to also handle non-AA paths but 19 // TODO: We could allow the SW path to also handle non-AA paths but
19 // this would mean that GrDefaultPathRenderer would never be called 20 // this would mean that GrDefaultPathRenderer would never be called
20 // (since it appears after the SW renderer in the path renderer 21 // (since it appears after the SW renderer in the path renderer
21 // chain). Some testing would need to be done r.e. performance 22 // chain). Some testing would need to be done r.e. performance
22 // and consistency of the resulting images before removing 23 // and consistency of the resulting images before removing
23 // the "!antiAlias" clause from the above test 24 // the "!antiAlias" clause from the above test
24 return false; 25 return false;
25 } 26 }
26 27
27 return true; 28 return true;
28 } 29 }
29 30
30 GrPathRenderer::StencilSupport GrSoftwarePathRenderer::onGetStencilSupport( 31 GrPathRenderer::StencilSupport GrSoftwarePathRenderer::onGetStencilSupport(
32 const SkPath&,
31 const SkStrokeRec&, 33 const SkStrokeRec&,
32 const GrDrawTarget*) const { 34 const GrDrawTarget*) const {
33 return GrPathRenderer::kNoSupport_StencilSupport; 35 return GrPathRenderer::kNoSupport_StencilSupport;
34 } 36 }
35 37
36 namespace { 38 namespace {
37 39
38 //////////////////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////////////////
39 // gets device coord bounds of path (not considering the fill) and clip. The 41 // gets device coord bounds of path (not considering the fill) and clip. The
40 // path bounds will be a subset of the clip bounds. returns false if 42 // path bounds will be a subset of the clip bounds. returns false if
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, 106 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
105 devClipBounds.fRight, devClipBounds.fBottom); 107 devClipBounds.fRight, devClipBounds.fBottom);
106 target->drawSimpleRect(rect, NULL); 108 target->drawSimpleRect(rect, NULL);
107 } 109 }
108 } 110 }
109 111
110 } 112 }
111 113
112 //////////////////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////////////////
113 // return true on success; false on failure 115 // return true on success; false on failure
114 bool GrSoftwarePathRenderer::onDrawPath(const SkStrokeRec& stroke, 116 bool GrSoftwarePathRenderer::onDrawPath(const SkPath& path,
117 const SkStrokeRec& stroke,
115 GrDrawTarget* target, 118 GrDrawTarget* target,
116 bool antiAlias) { 119 bool antiAlias) {
117 120
118 if (NULL == fContext) { 121 if (NULL == fContext) {
119 return false; 122 return false;
120 } 123 }
121 124
122 GrDrawState* drawState = target->drawState(); 125 GrDrawState* drawState = target->drawState();
123 126
124 SkMatrix vm = drawState->getViewMatrix(); 127 SkMatrix vm = drawState->getViewMatrix();
125 128
126 SkIRect devPathBounds, devClipBounds; 129 SkIRect devPathBounds, devClipBounds;
127 if (!get_path_and_clip_bounds(target, this->path(), vm, 130 if (!get_path_and_clip_bounds(target, path, vm,
128 &devPathBounds, &devClipBounds)) { 131 &devPathBounds, &devClipBounds)) {
129 if (this->path().isInverseFillType()) { 132 if (path.isInverseFillType()) {
130 draw_around_inv_path(target, devClipBounds, devPathBounds); 133 draw_around_inv_path(target, devClipBounds, devPathBounds);
131 } 134 }
132 return true; 135 return true;
133 } 136 }
134 137
135 SkAutoTUnref<GrTexture> texture( 138 SkAutoTUnref<GrTexture> texture(
136 GrSWMaskHelper::DrawPathMaskToTexture(fContext, this->path(), stroke , 139 GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke,
137 devPathBounds, 140 devPathBounds,
138 antiAlias, &vm)); 141 antiAlias, &vm));
139 if (NULL == texture) { 142 if (NULL == texture) {
140 return false; 143 return false;
141 } 144 }
142 145
143 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, devPathBounds); 146 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, devPathBounds);
144 147
145 if (this->path().isInverseFillType()) { 148 if (path.isInverseFillType()) {
146 draw_around_inv_path(target, devClipBounds, devPathBounds); 149 draw_around_inv_path(target, devClipBounds, devPathBounds);
147 } 150 }
148 151
149 return true; 152 return true;
150 } 153 }
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