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

Side by Side Diff: gm/convexpolyeffect.cpp

Issue 1483103003: Make onPrepareDraws const (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: merge Created 5 years 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/beziereffects.cpp ('k') | src/gpu/GrOvalRenderer.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 27 matching lines...) Expand all
38 const char* name() const override { return "ConvexPolyTestBatch"; } 38 const char* name() const override { return "ConvexPolyTestBatch"; }
39 39
40 static GrDrawBatch* Create(const GrGeometryProcessor* gp, const Geometry& ge o) { 40 static GrDrawBatch* Create(const GrGeometryProcessor* gp, const Geometry& ge o) {
41 return new ConvexPolyTestBatch(gp, geo); 41 return new ConvexPolyTestBatch(gp, geo);
42 } 42 }
43 43
44 private: 44 private:
45 ConvexPolyTestBatch(const GrGeometryProcessor* gp, const Geometry& geo) 45 ConvexPolyTestBatch(const GrGeometryProcessor* gp, const Geometry& geo)
46 : INHERITED(ClassID(), gp, geo.fBounds) 46 : INHERITED(ClassID(), gp, geo.fBounds)
47 , fGeometry(geo) { 47 , fGeometry(geo) {
48 // Make sure any artifacts around the exterior of path are visible by us ing overly
49 // conservative bounding geometry.
50 fGeometry.fBounds.outset(5.f, 5.f);
48 } 51 }
49 52
50 Geometry* geoData(int index) override { 53 Geometry* geoData(int index) override {
51 SkASSERT(0 == index); 54 SkASSERT(0 == index);
52 return &fGeometry; 55 return &fGeometry;
53 } 56 }
54 57
55 const Geometry* geoData(int index) const override { 58 const Geometry* geoData(int index) const override {
56 SkASSERT(0 == index); 59 SkASSERT(0 == index);
57 return &fGeometry; 60 return &fGeometry;
58 } 61 }
59 62
60 void generateGeometry(Target* target) override { 63 void generateGeometry(Target* target) const override {
61 size_t vertexStride = this->geometryProcessor()->getVertexStride(); 64 size_t vertexStride = this->geometryProcessor()->getVertexStride();
62 SkASSERT(vertexStride == sizeof(SkPoint)); 65 SkASSERT(vertexStride == sizeof(SkPoint));
63 QuadHelper helper; 66 QuadHelper helper;
64 SkPoint* verts = reinterpret_cast<SkPoint*>(helper.init(target, vertexSt ride, 1)); 67 SkPoint* verts = reinterpret_cast<SkPoint*>(helper.init(target, vertexSt ride, 1));
65 if (!verts) { 68 if (!verts) {
66 return; 69 return;
67 } 70 }
68 71
69 // Make sure any artifacts around the exterior of path are visible by us ing overly
70 // conservative bounding geometry.
71 fGeometry.fBounds.outset(5.f, 5.f);
72 fGeometry.fBounds.toQuad(verts); 72 fGeometry.fBounds.toQuad(verts);
73 73
74 helper.recordDraw(target); 74 helper.recordDraw(target);
75 } 75 }
76 76
77 Geometry fGeometry; 77 Geometry fGeometry;
78 78
79 typedef GrTestBatch INHERITED; 79 typedef GrTestBatch INHERITED;
80 }; 80 };
81 81
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 PathList fPaths; 277 PathList fPaths;
278 RectList fRects; 278 RectList fRects;
279 279
280 typedef GM INHERITED; 280 typedef GM INHERITED;
281 }; 281 };
282 282
283 DEF_GM(return new ConvexPolyEffect;) 283 DEF_GM(return new ConvexPolyEffect;)
284 } 284 }
285 285
286 #endif 286 #endif
OLDNEW
« no previous file with comments | « gm/beziereffects.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698