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

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

Issue 2147443004: Retract PipelineBuilder from GrClip::apply (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Appease some compilers 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/GrDrawTarget.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 * 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"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return path.release(); 67 return path.release();
68 } 68 }
69 69
70 void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) { 70 void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
71 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), 71 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
72 "GrStencilAndCoverPathRenderer::onStencilPath"); 72 "GrStencilAndCoverPathRenderer::onStencilPath");
73 SkASSERT(!args.fIsAA || args.fDrawContext->isStencilBufferMultisampled()); 73 SkASSERT(!args.fIsAA || args.fDrawContext->isStencilBufferMultisampled());
74 SkPath path; 74 SkPath path;
75 args.fShape->asPath(&path); 75 args.fShape->asPath(&path);
76 76
77 GrPaint paint;
78 paint.setXPFactory(GrDisableColorXPFactory::Make());
79 paint.setAntiAlias(args.fIsAA);
80
81 const GrPipelineBuilder pipelineBuilder(paint, args.fIsAA);
82
83 SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, GrStyle::SimpleF ill())); 77 SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, GrStyle::SimpleF ill()));
84 args.fDrawContext->drawContextPriv().stencilPath(pipelineBuilder, *args.fCli p, 78 args.fDrawContext->drawContextPriv().stencilPath(*args.fClip, nullptr, args. fIsAA,
85 *args.fViewMatrix, p, p->ge tFillType()); 79 *args.fViewMatrix, p);
86 } 80 }
87 81
88 bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { 82 bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
89 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), 83 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
90 "GrStencilAndCoverPathRenderer::onDrawPath"); 84 "GrStencilAndCoverPathRenderer::onDrawPath");
91 SkASSERT(!args.fPaint->isAntiAlias() || args.fDrawContext->isStencilBufferMu ltisampled()); 85 SkASSERT(!args.fPaint->isAntiAlias() || args.fDrawContext->isStencilBufferMu ltisampled());
92 SkASSERT(!args.fShape->style().strokeRec().isHairlineStyle()); 86 SkASSERT(!args.fShape->style().strokeRec().isHairlineStyle());
93 87
94 const SkMatrix& viewMatrix = *args.fViewMatrix; 88 const SkMatrix& viewMatrix = *args.fViewMatrix;
95 89
(...skipping 10 matching lines...) Expand all
106 // outside the clip. So we can't just fill where the user bits a re 0. We also need 100 // outside the clip. So we can't just fill where the user bits a re 0. We also need
107 // to check that the clip bit is set. 101 // to check that the clip bit is set.
108 GrUserStencilTest::kEqualIfInClip, 102 GrUserStencilTest::kEqualIfInClip,
109 0xffff, 103 0xffff,
110 GrUserStencilOp::kKeep, 104 GrUserStencilOp::kKeep,
111 GrUserStencilOp::kZero, 105 GrUserStencilOp::kZero,
112 0xffff>() 106 0xffff>()
113 ); 107 );
114 108
115 // fake inverse with a stencil and cover 109 // fake inverse with a stencil and cover
116 { 110 args.fDrawContext->drawContextPriv().stencilPath(*args.fClip,
117 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiA lias()); 111 &kInvertedCoverPass,
118 pipelineBuilder.setUserStencil(&kInvertedCoverPass); 112 args.fPaint->isAntiAlia s(),
119 113 viewMatrix, p);
120 args.fDrawContext->drawContextPriv().stencilPath(pipelineBuilder, *a rgs.fClip,
121 viewMatrix, p, p->g etFillType());
122 }
123 114
124 SkMatrix invert = SkMatrix::I(); 115 SkMatrix invert = SkMatrix::I();
125 SkRect bounds = 116 SkRect bounds =
126 SkRect::MakeLTRB(0, 0, 117 SkRect::MakeLTRB(0, 0,
127 SkIntToScalar(args.fDrawContext->width()), 118 SkIntToScalar(args.fDrawContext->width()),
128 SkIntToScalar(args.fDrawContext->height())); 119 SkIntToScalar(args.fDrawContext->height()));
129 SkMatrix vmi; 120 SkMatrix vmi;
130 // mapRect through persp matrix may not be correct 121 // mapRect through persp matrix may not be correct
131 if (!viewMatrix.hasPerspective() && viewMatrix.invert(&vmi)) { 122 if (!viewMatrix.hasPerspective() && viewMatrix.invert(&vmi)) {
132 vmi.mapRect(&bounds); 123 vmi.mapRect(&bounds);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (args.fAntiAlias) { 163 if (args.fAntiAlias) {
173 SkASSERT(args.fDrawContext->isStencilBufferMultisampled()); 164 SkASSERT(args.fDrawContext->isStencilBufferMultisampled());
174 pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag); 165 pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag);
175 } 166 }
176 167
177 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); 168 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
178 } 169 }
179 170
180 return true; 171 return true;
181 } 172 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698