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 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 path->transform(m, &p); | 127 path->transform(m, &p); |
128 | 128 |
129 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; | 129 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; |
130 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create(
edgeType, p)); | 130 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create(
edgeType, p)); |
131 if (!fp) { | 131 if (!fp) { |
132 continue; | 132 continue; |
133 } | 133 } |
134 | 134 |
135 GrDrawState ds; | 135 GrDrawState ds; |
136 SkAutoTUnref<const GrGeometryProcessor> gp( | 136 SkAutoTUnref<const GrGeometryProcessor> gp( |
137 GrDefaultGeoProcFactory::Create(0xff000000)); | 137 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory:
:kPosition_GPType, |
| 138 0xff000000)); |
138 ds.addCoverageProcessor(fp); | 139 ds.addCoverageProcessor(fp); |
139 ds.setRenderTarget(rt); | 140 ds.setRenderTarget(rt); |
140 | 141 |
141 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVer
texStride(), 0); | 142 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVer
texStride(), 0); |
142 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); | 143 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); |
143 SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices()); | 144 SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices()); |
144 | 145 |
145 SkRect bounds = p.getBounds(); | 146 SkRect bounds = p.getBounds(); |
146 // Make sure any artifacts around the exterior of path are visib
le by using overly | 147 // Make sure any artifacts around the exterior of path are visib
le by using overly |
147 // conservative bounding geometry. | 148 // conservative bounding geometry. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 SkRect rect = *iter.get(); | 184 SkRect rect = *iter.get(); |
184 rect.offset(x, y); | 185 rect.offset(x, y); |
185 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; | 186 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; |
186 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create(
edgeType, rect)); | 187 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create(
edgeType, rect)); |
187 if (!fp) { | 188 if (!fp) { |
188 continue; | 189 continue; |
189 } | 190 } |
190 | 191 |
191 GrDrawState ds; | 192 GrDrawState ds; |
192 SkAutoTUnref<const GrGeometryProcessor> gp( | 193 SkAutoTUnref<const GrGeometryProcessor> gp( |
193 GrDefaultGeoProcFactory::Create(0xff000000)); | 194 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory:
:kPosition_GPType, |
| 195 0xff000000)); |
194 ds.addCoverageProcessor(fp); | 196 ds.addCoverageProcessor(fp); |
195 ds.setRenderTarget(rt); | 197 ds.setRenderTarget(rt); |
196 | 198 |
197 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVer
texStride(), 0); | 199 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVer
texStride(), 0); |
198 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); | 200 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); |
199 SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices()); | 201 SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices()); |
200 | 202 |
201 SkRect bounds = rect; | 203 SkRect bounds = rect; |
202 bounds.outset(5.f, 5.f); | 204 bounds.outset(5.f, 5.f); |
203 bounds.toQuad(verts); | 205 bounds.toQuad(verts); |
(...skipping 22 matching lines...) Expand all Loading... |
226 SkTLList<SkPath> fPaths; | 228 SkTLList<SkPath> fPaths; |
227 SkTLList<SkRect> fRects; | 229 SkTLList<SkRect> fRects; |
228 | 230 |
229 typedef GM INHERITED; | 231 typedef GM INHERITED; |
230 }; | 232 }; |
231 | 233 |
232 DEF_GM( return SkNEW(ConvexPolyEffect); ) | 234 DEF_GM( return SkNEW(ConvexPolyEffect); ) |
233 } | 235 } |
234 | 236 |
235 #endif | 237 #endif |
OLD | NEW |