OLD | NEW |
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 |
11 #include "gm.h" | 11 #include "gm.h" |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 | 14 |
15 #include "GrBatchTarget.h" | 15 #include "GrBatchFlushState.h" |
16 #include "GrContext.h" | 16 #include "GrContext.h" |
17 #include "GrDefaultGeoProcFactory.h" | 17 #include "GrDefaultGeoProcFactory.h" |
18 #include "GrPathUtils.h" | 18 #include "GrPathUtils.h" |
19 #include "GrTest.h" | 19 #include "GrTest.h" |
20 #include "SkColorPriv.h" | 20 #include "SkColorPriv.h" |
21 #include "SkDevice.h" | 21 #include "SkDevice.h" |
22 #include "SkGeometry.h" | 22 #include "SkGeometry.h" |
23 #include "SkTLList.h" | 23 #include "SkTLList.h" |
24 | 24 |
25 #include "batches/GrTestBatch.h" | 25 #include "batches/GrTestBatch.h" |
(...skipping 25 matching lines...) Expand all Loading... |
51 Geometry* geoData(int index) override { | 51 Geometry* geoData(int index) override { |
52 SkASSERT(0 == index); | 52 SkASSERT(0 == index); |
53 return &fGeometry; | 53 return &fGeometry; |
54 } | 54 } |
55 | 55 |
56 const Geometry* geoData(int index) const override { | 56 const Geometry* geoData(int index) const override { |
57 SkASSERT(0 == index); | 57 SkASSERT(0 == index); |
58 return &fGeometry; | 58 return &fGeometry; |
59 } | 59 } |
60 | 60 |
61 void onGenerateGeometry(GrBatchTarget* batchTarget) override { | 61 void generateGeometry(Target* target) override { |
62 size_t vertexStride = this->geometryProcessor()->getVertexStride(); | 62 size_t vertexStride = this->geometryProcessor()->getVertexStride(); |
63 SkASSERT(vertexStride == sizeof(SkPoint)); | 63 SkASSERT(vertexStride == sizeof(SkPoint)); |
64 QuadHelper helper; | 64 QuadHelper helper; |
65 SkPoint* verts = reinterpret_cast<SkPoint*>(helper.init(batchTarget, ver
texStride, 1)); | 65 SkPoint* verts = reinterpret_cast<SkPoint*>(helper.init(target, vertexSt
ride, 1)); |
66 if (!verts) { | 66 if (!verts) { |
67 return; | 67 return; |
68 } | 68 } |
69 | 69 |
70 // Make sure any artifacts around the exterior of path are visible by us
ing overly | 70 // Make sure any artifacts around the exterior of path are visible by us
ing overly |
71 // conservative bounding geometry. | 71 // conservative bounding geometry. |
72 fGeometry.fBounds.outset(5.f, 5.f); | 72 fGeometry.fBounds.outset(5.f, 5.f); |
73 fGeometry.fBounds.toQuad(verts); | 73 fGeometry.fBounds.toQuad(verts); |
74 | 74 |
75 helper.issueDraw(batchTarget); | 75 helper.recordDraw(target); |
76 } | 76 } |
77 | 77 |
78 Geometry fGeometry; | 78 Geometry fGeometry; |
79 | 79 |
80 typedef GrTestBatch INHERITED; | 80 typedef GrTestBatch INHERITED; |
81 }; | 81 }; |
82 | 82 |
83 /** | 83 /** |
84 * This GM directly exercises a GrProcessor that draws convex polygons. | 84 * This GM directly exercises a GrProcessor that draws convex polygons. |
85 */ | 85 */ |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 SkTLList<SkPath> fPaths; | 272 SkTLList<SkPath> fPaths; |
273 SkTLList<SkRect> fRects; | 273 SkTLList<SkRect> fRects; |
274 | 274 |
275 typedef GM INHERITED; | 275 typedef GM INHERITED; |
276 }; | 276 }; |
277 | 277 |
278 DEF_GM( return SkNEW(ConvexPolyEffect); ) | 278 DEF_GM( return SkNEW(ConvexPolyEffect); ) |
279 } | 279 } |
280 | 280 |
281 #endif | 281 #endif |
OLD | NEW |