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

Side by Side Diff: gm/convexpolyeffect.cpp

Issue 1229143007: Start to propagate constness of GrPipelineBuilder up the stack (Closed) Base URL: https://skia.googlesource.com/skia.git@const-fix
Patch Set: rebase Created 5 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 | « gm/constcolorprocessor.cpp ('k') | gm/rrects.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 GrPipelineBuilder pipelineBuilder; 188 GrPipelineBuilder pipelineBuilder;
189 pipelineBuilder.addCoverageProcessor(fp); 189 pipelineBuilder.addCoverageProcessor(fp);
190 pipelineBuilder.setRenderTarget(rt); 190 pipelineBuilder.setRenderTarget(rt);
191 191
192 ConvexPolyTestBatch::Geometry geometry; 192 ConvexPolyTestBatch::Geometry geometry;
193 geometry.fColor = color; 193 geometry.fColor = color;
194 geometry.fBounds = p.getBounds(); 194 geometry.fBounds = p.getBounds();
195 195
196 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geom etry)); 196 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geom etry));
197 197
198 tt.target()->drawBatch(&pipelineBuilder, batch); 198 tt.target()->drawBatch(pipelineBuilder, batch);
199 199
200 x += SkScalarCeilToScalar(path->getBounds().width() + 10.f); 200 x += SkScalarCeilToScalar(path->getBounds().width() + 10.f);
201 } 201 }
202 202
203 // Draw AA and non AA paths using normal API for reference. 203 // Draw AA and non AA paths using normal API for reference.
204 canvas->save(); 204 canvas->save();
205 canvas->translate(x, y); 205 canvas->translate(x, y);
206 SkPaint paint; 206 SkPaint paint;
207 canvas->drawPath(*path, paint); 207 canvas->drawPath(*path, paint);
208 canvas->translate(path->getBounds().width() + 10.f, 0); 208 canvas->translate(path->getBounds().width() + 10.f, 0);
(...skipping 28 matching lines...) Expand all
237 GrPipelineBuilder pipelineBuilder; 237 GrPipelineBuilder pipelineBuilder;
238 pipelineBuilder.addCoverageProcessor(fp); 238 pipelineBuilder.addCoverageProcessor(fp);
239 pipelineBuilder.setRenderTarget(rt); 239 pipelineBuilder.setRenderTarget(rt);
240 240
241 ConvexPolyTestBatch::Geometry geometry; 241 ConvexPolyTestBatch::Geometry geometry;
242 geometry.fColor = color; 242 geometry.fColor = color;
243 geometry.fBounds = rect; 243 geometry.fBounds = rect;
244 244
245 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geom etry)); 245 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geom etry));
246 246
247 tt.target()->drawBatch(&pipelineBuilder, batch); 247 tt.target()->drawBatch(pipelineBuilder, batch);
248 248
249 x += SkScalarCeilToScalar(rect.width() + 10.f); 249 x += SkScalarCeilToScalar(rect.width() + 10.f);
250 } 250 }
251 251
252 // Draw rect without and with AA using normal API for reference 252 // Draw rect without and with AA using normal API for reference
253 canvas->save(); 253 canvas->save();
254 canvas->translate(x, y); 254 canvas->translate(x, y);
255 SkPaint paint; 255 SkPaint paint;
256 canvas->drawRect(*iter.get(), paint); 256 canvas->drawRect(*iter.get(), paint);
257 x += SkScalarCeilToScalar(iter.get()->width() + 10.f); 257 x += SkScalarCeilToScalar(iter.get()->width() + 10.f);
258 paint.setAntiAlias(true); 258 paint.setAntiAlias(true);
259 canvas->drawRect(*iter.get(), paint); 259 canvas->drawRect(*iter.get(), paint);
260 canvas->restore(); 260 canvas->restore();
261 261
262 y += SkScalarCeilToScalar(iter.get()->height() + 20.f); 262 y += SkScalarCeilToScalar(iter.get()->height() + 20.f);
263 } 263 }
264 } 264 }
265 265
266 private: 266 private:
267 SkTLList<SkPath> fPaths; 267 SkTLList<SkPath> fPaths;
268 SkTLList<SkRect> fRects; 268 SkTLList<SkRect> fRects;
269 269
270 typedef GM INHERITED; 270 typedef GM INHERITED;
271 }; 271 };
272 272
273 DEF_GM( return SkNEW(ConvexPolyEffect); ) 273 DEF_GM( return SkNEW(ConvexPolyEffect); )
274 } 274 }
275 275
276 #endif 276 #endif
OLDNEW
« no previous file with comments | « gm/constcolorprocessor.cpp ('k') | gm/rrects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698