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

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

Issue 2092893003: Retract PipelineBuilder some more (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 5 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/batches/GrPLSPathRenderer.cpp ('k') | src/gpu/batches/GrTessellatingPathRenderer.cpp » ('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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrStencilAndCoverPathRenderer.h" 9 #include "GrStencilAndCoverPathRenderer.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
11 #include "GrContext.h" 11 #include "GrContext.h"
12 #include "GrDrawContextPriv.h" 12 #include "GrDrawContextPriv.h"
13 #include "GrDrawPathBatch.h" 13 #include "GrDrawPathBatch.h"
14 #include "GrGpu.h" 14 #include "GrGpu.h"
15 #include "GrPath.h" 15 #include "GrPath.h"
16 #include "GrPipelineBuilder.h"
17 #include "GrRenderTarget.h" 16 #include "GrRenderTarget.h"
18 #include "GrResourceProvider.h" 17 #include "GrResourceProvider.h"
19 #include "GrStencilPathBatch.h" 18 #include "GrStencilPathBatch.h"
20 #include "GrStyle.h" 19 #include "GrStyle.h"
21 #include "batches/GrRectBatchFactory.h" 20 #include "batches/GrRectBatchFactory.h"
22 21
23 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour ceProvider, 22 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour ceProvider,
24 const GrCaps& caps) { 23 const GrCaps& caps) {
25 if (caps.shaderCaps()->pathRenderingSupport()) { 24 if (caps.shaderCaps()->pathRenderingSupport()) {
26 return new GrStencilAndCoverPathRenderer(resourceProvider); 25 return new GrStencilAndCoverPathRenderer(resourceProvider);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (!viewMatrix.invert(&invert)) { 129 if (!viewMatrix.invert(&invert)) {
131 return false; 130 return false;
132 } 131 }
133 } 132 }
134 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi ewMatrix; 133 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi ewMatrix;
135 134
136 SkAutoTUnref<GrDrawBatch> coverBatch( 135 SkAutoTUnref<GrDrawBatch> coverBatch(
137 GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), vie wM, bounds, 136 GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), vie wM, bounds,
138 nullptr, &invert)); 137 nullptr, &invert));
139 138
140 { 139 SkASSERT(args.fDrawContext->mustUseHWAA(*args.fPaint) ==
141 GrPipelineBuilder pipelineBuilder(*args.fPaint, 140 (args.fPaint->isAntiAlias() && !args.fDrawContext->hasMixedSamp les()));
142 args.fPaint->isAntiAlias() && 141 args.fDrawContext->drawBatch(*args.fPaint, *args.fClip, kInvertedCoverPa ss, coverBatch);
143 !args.fDrawContext->hasMixedSample s());
144 pipelineBuilder.setUserStencil(&kInvertedCoverPass);
145
146 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, coverBatc h);
147 }
148 } else { 142 } else {
149 static constexpr GrUserStencilSettings kCoverPass( 143 static constexpr GrUserStencilSettings kCoverPass(
150 GrUserStencilSettings::StaticInit< 144 GrUserStencilSettings::StaticInit<
151 0x0000, 145 0x0000,
152 GrUserStencilTest::kNotEqual, 146 GrUserStencilTest::kNotEqual,
153 0xffff, 147 0xffff,
154 GrUserStencilOp::kZero, 148 GrUserStencilOp::kZero,
155 GrUserStencilOp::kKeep, 149 GrUserStencilOp::kKeep,
156 0xffff>() 150 0xffff>()
157 ); 151 );
158 152
159 SkAutoTUnref<GrDrawBatch> batch( 153 SkAutoTUnref<GrDrawBatch> batch(
160 GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), p-> getFillType(), p)); 154 GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), p-> getFillType(), p));
161 155
162 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias ()); 156 SkASSERT(args.fDrawContext->mustUseHWAA(*args.fPaint) ==
163 pipelineBuilder.setUserStencil(&kCoverPass); 157 (args.fPaint->isAntiAlias() || args.fAntiAlias));
164 if (args.fAntiAlias) { 158 args.fDrawContext->drawBatch(*args.fPaint, *args.fClip, kCoverPass, batc h);
165 SkASSERT(args.fDrawContext->isStencilBufferMultisampled());
166 pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag);
167 }
168
169 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
170 } 159 }
171 160
172 return true; 161 return true;
173 } 162 }
OLDNEW
« no previous file with comments | « src/gpu/batches/GrPLSPathRenderer.cpp ('k') | src/gpu/batches/GrTessellatingPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698