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 "GrContext.h" | 15 #include "GrContext.h" |
16 #include "GrDefaultGeoProcFactory.h" | 16 #include "GrDefaultGeoProcFactory.h" |
17 #include "GrDrawContext.h" | 17 #include "GrDrawContextPriv.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" |
26 #include "batches/GrVertexBatch.h" | 26 #include "batches/GrVertexBatch.h" |
27 | 27 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 pipelineBuilder.addCoverageFragmentProcessor(fp); | 198 pipelineBuilder.addCoverageFragmentProcessor(fp); |
199 pipelineBuilder.setRenderTarget(rt); | 199 pipelineBuilder.setRenderTarget(rt); |
200 | 200 |
201 ConvexPolyTestBatch::Geometry geometry; | 201 ConvexPolyTestBatch::Geometry geometry; |
202 geometry.fColor = color.fColor; | 202 geometry.fColor = color.fColor; |
203 geometry.fRect = p.getBounds(); | 203 geometry.fRect = p.getBounds(); |
204 geometry.fBounds = p.getBounds(); | 204 geometry.fBounds = p.getBounds(); |
205 | 205 |
206 SkAutoTUnref<GrDrawBatch> batch(ConvexPolyTestBatch::Create(gp,
geometry)); | 206 SkAutoTUnref<GrDrawBatch> batch(ConvexPolyTestBatch::Create(gp,
geometry)); |
207 | 207 |
208 drawContext->internal_drawBatch(pipelineBuilder, batch); | 208 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBui
lder, batch); |
209 | 209 |
210 x += SkScalarCeilToScalar(path->getBounds().width() + 10.f); | 210 x += SkScalarCeilToScalar(path->getBounds().width() + 10.f); |
211 } | 211 } |
212 | 212 |
213 // Draw AA and non AA paths using normal API for reference. | 213 // Draw AA and non AA paths using normal API for reference. |
214 canvas->save(); | 214 canvas->save(); |
215 canvas->translate(x, y); | 215 canvas->translate(x, y); |
216 SkPaint paint; | 216 SkPaint paint; |
217 canvas->drawPath(*path, paint); | 217 canvas->drawPath(*path, paint); |
218 canvas->translate(path->getBounds().width() + 10.f, 0); | 218 canvas->translate(path->getBounds().width() + 10.f, 0); |
(...skipping 26 matching lines...) Expand all Loading... |
245 pipelineBuilder.setRenderTarget(rt); | 245 pipelineBuilder.setRenderTarget(rt); |
246 | 246 |
247 ConvexPolyTestBatch::Geometry geometry; | 247 ConvexPolyTestBatch::Geometry geometry; |
248 geometry.fColor = color.fColor; | 248 geometry.fColor = color.fColor; |
249 geometry.fRect = rect; | 249 geometry.fRect = rect; |
250 geometry.fBounds = rect; | 250 geometry.fBounds = rect; |
251 geometry.fBounds.sort(); | 251 geometry.fBounds.sort(); |
252 | 252 |
253 SkAutoTUnref<GrDrawBatch> batch(ConvexPolyTestBatch::Create(gp,
geometry)); | 253 SkAutoTUnref<GrDrawBatch> batch(ConvexPolyTestBatch::Create(gp,
geometry)); |
254 | 254 |
255 drawContext->internal_drawBatch(pipelineBuilder, batch); | 255 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBui
lder, batch); |
256 | 256 |
257 x += SkScalarCeilToScalar(rect.width() + 10.f); | 257 x += SkScalarCeilToScalar(rect.width() + 10.f); |
258 } | 258 } |
259 | 259 |
260 // Draw rect without and with AA using normal API for reference | 260 // Draw rect without and with AA using normal API for reference |
261 canvas->save(); | 261 canvas->save(); |
262 canvas->translate(x, y); | 262 canvas->translate(x, y); |
263 SkPaint paint; | 263 SkPaint paint; |
264 canvas->drawRect(*iter.get(), paint); | 264 canvas->drawRect(*iter.get(), paint); |
265 x += SkScalarCeilToScalar(iter.get()->width() + 10.f); | 265 x += SkScalarCeilToScalar(iter.get()->width() + 10.f); |
(...skipping 11 matching lines...) Expand all Loading... |
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 |
OLD | NEW |