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

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

Issue 938383004: Dynamically create stencil buffer when needed. (Closed) Base URL: https://skia.googlesource.com/skia.git@bigstencil
Patch Set: Actually save file before uploading Created 5 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
« no previous file with comments | « src/gpu/GrRenderTargetPriv.h ('k') | src/gpu/GrSurfacePriv.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"
11 #include "GrContext.h" 11 #include "GrContext.h"
12 #include "GrDrawTargetCaps.h" 12 #include "GrDrawTargetCaps.h"
13 #include "GrGpu.h" 13 #include "GrGpu.h"
14 #include "GrPath.h" 14 #include "GrPath.h"
15 #include "GrRenderTarget.h"
16 #include "GrRenderTargetPriv.h"
15 #include "SkStrokeRec.h" 17 #include "SkStrokeRec.h"
16 18
17 /* 19 /*
18 * For now paths only natively support winding and even odd fill types 20 * For now paths only natively support winding and even odd fill types
19 */ 21 */
20 static GrPathRendering::FillType convert_skpath_filltype(SkPath::FillType fill) { 22 static GrPathRendering::FillType convert_skpath_filltype(SkPath::FillType fill) {
21 switch (fill) { 23 switch (fill) {
22 default: 24 default:
23 SkFAIL("Incomplete Switch\n"); 25 SkFAIL("Incomplete Switch\n");
24 case SkPath::kWinding_FillType: 26 case SkPath::kWinding_FillType:
(...skipping 26 matching lines...) Expand all
51 } 53 }
52 54
53 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target, 55 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target,
54 const GrPipelineBuilder* pipelin eBuilder, 56 const GrPipelineBuilder* pipelin eBuilder,
55 const SkMatrix& viewMatrix, 57 const SkMatrix& viewMatrix,
56 const SkPath& path, 58 const SkPath& path,
57 const SkStrokeRec& stroke, 59 const SkStrokeRec& stroke,
58 bool antiAlias) const { 60 bool antiAlias) const {
59 return !stroke.isHairlineStyle() && 61 return !stroke.isHairlineStyle() &&
60 !antiAlias && // doesn't do per-path AA, relies on the target having MSAA 62 !antiAlias && // doesn't do per-path AA, relies on the target having MSAA
61 pipelineBuilder->getRenderTarget()->getStencilBuffer() &&
62 pipelineBuilder->getStencil().isDisabled(); 63 pipelineBuilder->getStencil().isDisabled();
63 } 64 }
64 65
65 GrPathRenderer::StencilSupport 66 GrPathRenderer::StencilSupport
66 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, 67 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*,
67 const GrPipelineBuilder*, 68 const GrPipelineBuilder*,
68 const SkPath&, 69 const SkPath&,
69 const SkStrokeRec&) const { 70 const SkStrokeRec&) const {
70 return GrPathRenderer::kStencilOnly_StencilSupport; 71 return GrPathRenderer::kStencilOnly_StencilSupport;
71 } 72 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 0xffff); 155 0xffff);
155 156
156 pipelineBuilder->setStencil(kStencilPass); 157 pipelineBuilder->setStencil(kStencilPass);
157 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix)); 158 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix));
158 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType())); 159 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType()));
159 } 160 }
160 161
161 pipelineBuilder->stencil()->setDisabled(); 162 pipelineBuilder->stencil()->setDisabled();
162 return true; 163 return true;
163 } 164 }
OLDNEW
« no previous file with comments | « src/gpu/GrRenderTargetPriv.h ('k') | src/gpu/GrSurfacePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698