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

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

Issue 2175573004: Revert of Retract PipelineBuilder some more (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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"
16 #include "GrRenderTarget.h" 17 #include "GrRenderTarget.h"
17 #include "GrResourceProvider.h" 18 #include "GrResourceProvider.h"
18 #include "GrStencilPathBatch.h" 19 #include "GrStencilPathBatch.h"
19 #include "GrStyle.h" 20 #include "GrStyle.h"
20 #include "batches/GrRectBatchFactory.h" 21 #include "batches/GrRectBatchFactory.h"
21 22
22 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour ceProvider, 23 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour ceProvider,
23 const GrCaps& caps) { 24 const GrCaps& caps) {
24 if (caps.shaderCaps()->pathRenderingSupport()) { 25 if (caps.shaderCaps()->pathRenderingSupport()) {
25 return new GrStencilAndCoverPathRenderer(resourceProvider); 26 return new GrStencilAndCoverPathRenderer(resourceProvider);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (!viewMatrix.invert(&invert)) { 130 if (!viewMatrix.invert(&invert)) {
130 return false; 131 return false;
131 } 132 }
132 } 133 }
133 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi ewMatrix; 134 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi ewMatrix;
134 135
135 SkAutoTUnref<GrDrawBatch> coverBatch( 136 SkAutoTUnref<GrDrawBatch> coverBatch(
136 GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), vie wM, bounds, 137 GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), vie wM, bounds,
137 nullptr, &invert)); 138 nullptr, &invert));
138 139
139 SkASSERT(args.fDrawContext->mustUseHWAA(*args.fPaint) == 140 {
140 (args.fPaint->isAntiAlias() && !args.fDrawContext->hasMixedSamp les())); 141 GrPipelineBuilder pipelineBuilder(*args.fPaint,
141 args.fDrawContext->drawBatch(*args.fPaint, *args.fClip, kInvertedCoverPa ss, coverBatch); 142 args.fPaint->isAntiAlias() &&
143 !args.fDrawContext->hasMixedSample s());
144 pipelineBuilder.setUserStencil(&kInvertedCoverPass);
145
146 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, coverBatc h);
147 }
142 } else { 148 } else {
143 static constexpr GrUserStencilSettings kCoverPass( 149 static constexpr GrUserStencilSettings kCoverPass(
144 GrUserStencilSettings::StaticInit< 150 GrUserStencilSettings::StaticInit<
145 0x0000, 151 0x0000,
146 GrUserStencilTest::kNotEqual, 152 GrUserStencilTest::kNotEqual,
147 0xffff, 153 0xffff,
148 GrUserStencilOp::kZero, 154 GrUserStencilOp::kZero,
149 GrUserStencilOp::kKeep, 155 GrUserStencilOp::kKeep,
150 0xffff>() 156 0xffff>()
151 ); 157 );
152 158
153 SkAutoTUnref<GrDrawBatch> batch( 159 SkAutoTUnref<GrDrawBatch> batch(
154 GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), p-> getFillType(), p)); 160 GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), p-> getFillType(), p));
155 161
156 SkASSERT(args.fDrawContext->mustUseHWAA(*args.fPaint) == 162 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias ());
157 (args.fPaint->isAntiAlias() || args.fAntiAlias)); 163 pipelineBuilder.setUserStencil(&kCoverPass);
158 args.fDrawContext->drawBatch(*args.fPaint, *args.fClip, kCoverPass, batc h); 164 if (args.fAntiAlias) {
165 SkASSERT(args.fDrawContext->isStencilBufferMultisampled());
166 pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag);
167 }
168
169 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
159 } 170 }
160 171
161 return true; 172 return true;
162 } 173 }
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