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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return; | 159 return; |
160 } | 160 } |
161 | 161 |
162 Color color(0xff000000); | 162 Color color(0xff000000); |
163 Coverage coverage(Coverage::kSolid_Type); | 163 Coverage coverage(Coverage::kSolid_Type); |
164 LocalCoords localCoords(LocalCoords::kUnused_Type); | 164 LocalCoords localCoords(LocalCoords::kUnused_Type); |
165 SkAutoTUnref<const GrGeometryProcessor> gp( | 165 SkAutoTUnref<const GrGeometryProcessor> gp( |
166 GrDefaultGeoProcFactory::Create(color, coverage, localCoords, Sk
Matrix::I())); | 166 GrDefaultGeoProcFactory::Create(color, coverage, localCoords, Sk
Matrix::I())); |
167 | 167 |
168 SkScalar y = 0; | 168 SkScalar y = 0; |
169 for (SkTLList<SkPath>::Iter iter(fPaths, SkTLList<SkPath>::Iter::kHead_I
terStart); | 169 for (PathList::Iter iter(fPaths, PathList::Iter::kHead_IterStart); |
170 iter.get(); | 170 iter.get(); |
171 iter.next()) { | 171 iter.next()) { |
172 const SkPath* path = iter.get(); | 172 const SkPath* path = iter.get(); |
173 SkScalar x = 0; | 173 SkScalar x = 0; |
174 | 174 |
175 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { | 175 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { |
176 GrTestTarget tt; | 176 GrTestTarget tt; |
177 context->getTestTarget(&tt, rt); | 177 context->getTestTarget(&tt, rt); |
178 if (nullptr == tt.target()) { | 178 if (nullptr == tt.target()) { |
179 SkDEBUGFAIL("Couldn't get Gr test target."); | 179 SkDEBUGFAIL("Couldn't get Gr test target."); |
(...skipping 30 matching lines...) Expand all Loading... |
210 SkPaint paint; | 210 SkPaint paint; |
211 canvas->drawPath(*path, paint); | 211 canvas->drawPath(*path, paint); |
212 canvas->translate(path->getBounds().width() + 10.f, 0); | 212 canvas->translate(path->getBounds().width() + 10.f, 0); |
213 paint.setAntiAlias(true); | 213 paint.setAntiAlias(true); |
214 canvas->drawPath(*path, paint); | 214 canvas->drawPath(*path, paint); |
215 canvas->restore(); | 215 canvas->restore(); |
216 | 216 |
217 y += SkScalarCeilToScalar(path->getBounds().height() + 20.f); | 217 y += SkScalarCeilToScalar(path->getBounds().height() + 20.f); |
218 } | 218 } |
219 | 219 |
220 for (SkTLList<SkRect>::Iter iter(fRects, SkTLList<SkRect>::Iter::kHead_I
terStart); | 220 for (RectList::Iter iter(fRects, RectList::Iter::kHead_IterStart); |
221 iter.get(); | 221 iter.get(); |
222 iter.next()) { | 222 iter.next()) { |
223 | 223 |
224 SkScalar x = 0; | 224 SkScalar x = 0; |
225 | 225 |
226 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { | 226 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { |
227 GrTestTarget tt; | 227 GrTestTarget tt; |
228 context->getTestTarget(&tt, rt); | 228 context->getTestTarget(&tt, rt); |
229 if (nullptr == tt.target()) { | 229 if (nullptr == tt.target()) { |
230 SkDEBUGFAIL("Couldn't get Gr test target."); | 230 SkDEBUGFAIL("Couldn't get Gr test target."); |
(...skipping 30 matching lines...) Expand all Loading... |
261 x += SkScalarCeilToScalar(iter.get()->width() + 10.f); | 261 x += SkScalarCeilToScalar(iter.get()->width() + 10.f); |
262 paint.setAntiAlias(true); | 262 paint.setAntiAlias(true); |
263 canvas->drawRect(*iter.get(), paint); | 263 canvas->drawRect(*iter.get(), paint); |
264 canvas->restore(); | 264 canvas->restore(); |
265 | 265 |
266 y += SkScalarCeilToScalar(iter.get()->height() + 20.f); | 266 y += SkScalarCeilToScalar(iter.get()->height() + 20.f); |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 private: | 270 private: |
271 SkTLList<SkPath> fPaths; | 271 typedef SkTLList<SkPath, 1> PathList; |
272 SkTLList<SkRect> fRects; | 272 typedef SkTLList<SkRect, 1> RectList; |
| 273 PathList fPaths; |
| 274 RectList fRects; |
273 | 275 |
274 typedef GM INHERITED; | 276 typedef GM INHERITED; |
275 }; | 277 }; |
276 | 278 |
277 DEF_GM(return new ConvexPolyEffect;) | 279 DEF_GM(return new ConvexPolyEffect;) |
278 } | 280 } |
279 | 281 |
280 #endif | 282 #endif |
OLD | NEW |