OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPath.h" | 8 #include "SkPath.h" |
9 | 9 |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 static SkPath create_path_15() { | 225 static SkPath create_path_15() { |
226 SkPath path; | 226 SkPath path; |
227 path.moveTo( 0.0f, 0.0f); | 227 path.moveTo( 0.0f, 0.0f); |
228 path.lineTo(10000.0f, 0.0f); | 228 path.lineTo(10000.0f, 0.0f); |
229 path.lineTo( 0.0f, -1.0f); | 229 path.lineTo( 0.0f, -1.0f); |
230 path.lineTo(10000.0f, 0.000001f); | 230 path.lineTo(10000.0f, 0.000001f); |
231 path.lineTo( 0.0f, -30.0f); | 231 path.lineTo( 0.0f, -30.0f); |
232 return path; | 232 return path; |
233 } | 233 } |
234 | 234 |
235 static void test_path(GrDrawTarget* dt, GrRenderTarget* rt, const SkPath& path)
{ | 235 static void test_path(GrDrawTarget* dt, GrRenderTarget* rt, GrResourceProvider*
rp, |
| 236 const SkPath& path) { |
236 GrTessellatingPathRenderer tess; | 237 GrTessellatingPathRenderer tess; |
237 GrPipelineBuilder pipelineBuilder; | 238 GrPipelineBuilder pipelineBuilder; |
238 pipelineBuilder.setRenderTarget(rt); | 239 pipelineBuilder.setRenderTarget(rt); |
239 GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle); | 240 GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle); |
240 tess.drawPath(dt, &pipelineBuilder, SK_ColorWHITE, SkMatrix::I(), path, stro
ke, false); | 241 GrPathRenderer::DrawPathArgs args; |
| 242 args.fTarget = dt; |
| 243 args.fPipelineBuilder = &pipelineBuilder; |
| 244 args.fResourceProvider = rp; |
| 245 args.fColor = GrColor_WHITE; |
| 246 args.fViewMatrix = &SkMatrix::I(); |
| 247 args.fPath = &path; |
| 248 args.fStroke = &stroke; |
| 249 args.fAntiAlias = false; |
| 250 tess.drawPath(args); |
241 } | 251 } |
242 | 252 |
243 DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) { | 253 DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) { |
244 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 254 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
245 if (NULL == context) { | 255 if (NULL == context) { |
246 return; | 256 return; |
247 } | 257 } |
248 GrSurfaceDesc desc; | 258 GrSurfaceDesc desc; |
249 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 259 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
250 desc.fWidth = 800; | 260 desc.fWidth = 800; |
251 desc.fHeight = 800; | 261 desc.fHeight = 800; |
252 desc.fConfig = kSkia8888_GrPixelConfig; | 262 desc.fConfig = kSkia8888_GrPixelConfig; |
253 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 263 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
254 SkAutoTUnref<GrTexture> texture(context->textureProvider()->refScratchTextur
e(desc, | 264 SkAutoTUnref<GrTexture> texture(context->textureProvider()->refScratchTextur
e(desc, |
255 GrTextureProvider::kExact_ScratchTexMatch)); | 265 GrTextureProvider::kExact_ScratchTexMatch)); |
256 GrTestTarget tt; | 266 GrTestTarget tt; |
257 context->getTestTarget(&tt); | 267 context->getTestTarget(&tt); |
258 GrRenderTarget* rt = texture->asRenderTarget(); | 268 GrRenderTarget* rt = texture->asRenderTarget(); |
259 GrDrawTarget* dt = tt.target(); | 269 GrDrawTarget* dt = tt.target(); |
| 270 GrResourceProvider* rp = tt.resourceProvider(); |
260 | 271 |
261 test_path(dt, rt, create_path_0()); | 272 test_path(dt, rt, rp, create_path_0()); |
262 test_path(dt, rt, create_path_1()); | 273 test_path(dt, rt, rp, create_path_1()); |
263 test_path(dt, rt, create_path_2()); | 274 test_path(dt, rt, rp, create_path_2()); |
264 test_path(dt, rt, create_path_3()); | 275 test_path(dt, rt, rp, create_path_3()); |
265 test_path(dt, rt, create_path_4()); | 276 test_path(dt, rt, rp, create_path_4()); |
266 test_path(dt, rt, create_path_5()); | 277 test_path(dt, rt, rp, create_path_5()); |
267 test_path(dt, rt, create_path_6()); | 278 test_path(dt, rt, rp, create_path_6()); |
268 test_path(dt, rt, create_path_7()); | 279 test_path(dt, rt, rp, create_path_7()); |
269 test_path(dt, rt, create_path_8()); | 280 test_path(dt, rt, rp, create_path_8()); |
270 test_path(dt, rt, create_path_9()); | 281 test_path(dt, rt, rp, create_path_9()); |
271 test_path(dt, rt, create_path_10()); | 282 test_path(dt, rt, rp, create_path_10()); |
272 test_path(dt, rt, create_path_11()); | 283 test_path(dt, rt, rp, create_path_11()); |
273 test_path(dt, rt, create_path_12()); | 284 test_path(dt, rt, rp, create_path_12()); |
274 test_path(dt, rt, create_path_13()); | 285 test_path(dt, rt, rp, create_path_13()); |
275 test_path(dt, rt, create_path_14()); | 286 test_path(dt, rt, rp, create_path_14()); |
276 test_path(dt, rt, create_path_15()); | 287 test_path(dt, rt, rp, create_path_15()); |
277 } | 288 } |
278 #endif | 289 #endif |
OLD | NEW |