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

Side by Side Diff: gm/convexpolyeffect.cpp

Issue 2086293006: Move GrPipelineBuilder out of gms & reduce use of GrPipelineBuilder.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 6 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 | « gm/constcolorprocessor.cpp ('k') | gm/dcshader.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 2014 Google Inc. 2 * Copyright 2014 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 // This test only works with the GPU backend. 8 // This test only works with the GPU backend.
9 9
10 #include "gm.h" 10 #include "gm.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 const SkMatrix m = SkMatrix::MakeTrans(x, y); 171 const SkMatrix m = SkMatrix::MakeTrans(x, y);
172 SkPath p; 172 SkPath p;
173 path->transform(m, &p); 173 path->transform(m, &p);
174 174
175 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; 175 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et;
176 sk_sp<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, p)); 176 sk_sp<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, p));
177 if (!fp) { 177 if (!fp) {
178 continue; 178 continue;
179 } 179 }
180 180
181 GrPipelineBuilder pipelineBuilder; 181 GrPaint grPaint;
182 pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXferm ode::kSrc_Mode)); 182 grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSr c_Mode));
183 pipelineBuilder.addCoverageFragmentProcessor(std::move(fp)); 183 grPaint.addCoverageFragmentProcessor(std::move(fp));
184 184
185 SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(p.getBounds( ), 0xff000000)); 185 SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(p.getBounds( ), 0xff000000));
186 186
187 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBui lder, batch); 187 drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, ba tch);
188 188
189 x += SkScalarCeilToScalar(path->getBounds().width() + kDX); 189 x += SkScalarCeilToScalar(path->getBounds().width() + kDX);
190 } 190 }
191 191
192 // Draw AA and non AA paths using normal API for reference. 192 // Draw AA and non AA paths using normal API for reference.
193 canvas->save(); 193 canvas->save();
194 canvas->translate(x, y); 194 canvas->translate(x, y);
195 SkPaint paint; 195 SkPaint paint;
196 canvas->drawPath(*path, paint); 196 canvas->drawPath(*path, paint);
197 canvas->translate(path->getBounds().width() + 10.f, 0); 197 canvas->translate(path->getBounds().width() + 10.f, 0);
(...skipping 12 matching lines...) Expand all
210 210
211 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { 211 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) {
212 SkRect rect = *iter.get(); 212 SkRect rect = *iter.get();
213 rect.offset(x, y); 213 rect.offset(x, y);
214 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; 214 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et;
215 sk_sp<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, rect)); 215 sk_sp<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, rect));
216 if (!fp) { 216 if (!fp) {
217 continue; 217 continue;
218 } 218 }
219 219
220 GrPipelineBuilder pipelineBuilder; 220 GrPaint grPaint;
221 pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXferm ode::kSrc_Mode)); 221 grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSr c_Mode));
222 pipelineBuilder.addCoverageFragmentProcessor(std::move(fp)); 222 grPaint.addCoverageFragmentProcessor(std::move(fp));
223 223
224 SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(rect, 0xff00 0000)); 224 SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(rect, 0xff00 0000));
225 225
226 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBui lder, batch); 226 drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, ba tch);
227 227
228 x += SkScalarCeilToScalar(rect.width() + kDX); 228 x += SkScalarCeilToScalar(rect.width() + kDX);
229 } 229 }
230 230
231 // Draw rect without and with AA using normal API for reference 231 // Draw rect without and with AA using normal API for reference
232 canvas->save(); 232 canvas->save();
233 canvas->translate(x, y); 233 canvas->translate(x, y);
234 SkPaint paint; 234 SkPaint paint;
235 canvas->drawRect(*iter.get(), paint); 235 canvas->drawRect(*iter.get(), paint);
236 x += SkScalarCeilToScalar(iter.get()->width() + kDX); 236 x += SkScalarCeilToScalar(iter.get()->width() + kDX);
(...skipping 11 matching lines...) Expand all
248 PathList fPaths; 248 PathList fPaths;
249 RectList fRects; 249 RectList fRects;
250 250
251 typedef GM INHERITED; 251 typedef GM INHERITED;
252 }; 252 };
253 253
254 DEF_GM(return new ConvexPolyEffect;) 254 DEF_GM(return new ConvexPolyEffect;)
255 } 255 }
256 256
257 #endif 257 #endif
OLDNEW
« no previous file with comments | « gm/constcolorprocessor.cpp ('k') | gm/dcshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698