| 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, GrDrawContext* drawContext, | 235 static void test_path(GrDrawContext* drawContext, GrResourceProvider* rp, const
SkPath& path) { |
| 236 GrResourceProvider* rp, const SkPath& path) { | |
| 237 GrTessellatingPathRenderer tess; | 236 GrTessellatingPathRenderer tess; |
| 238 GrPipelineBuilder pipelineBuilder; | 237 |
| 239 pipelineBuilder.setXPFactory( | 238 GrPaint paint; |
| 240 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); | 239 paint.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->un
ref(); |
| 241 pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); | 240 |
| 242 GrNoClip noClip; | 241 GrNoClip noClip; |
| 243 GrStyle style(SkStrokeRec::kFill_InitStyle); | 242 GrStyle style(SkStrokeRec::kFill_InitStyle); |
| 244 GrPathRenderer::DrawPathArgs args; | 243 GrPathRenderer::DrawPathArgs args; |
| 245 args.fTarget = dt; | 244 args.fPaint = &paint; |
| 246 args.fPipelineBuilder = &pipelineBuilder; | 245 args.fUserStencilSettings = &GrUserStencilSettings::kUnused; |
| 246 args.fDrawContext = drawContext; |
| 247 args.fClip = &noClip; | 247 args.fClip = &noClip; |
| 248 args.fResourceProvider = rp; | 248 args.fResourceProvider = rp; |
| 249 args.fColor = GrColor_WHITE; | 249 args.fColor = GrColor_WHITE; |
| 250 args.fViewMatrix = &SkMatrix::I(); | 250 args.fViewMatrix = &SkMatrix::I(); |
| 251 args.fPath = &path; | 251 args.fPath = &path; |
| 252 args.fStyle = &style; | 252 args.fStyle = &style; |
| 253 args.fAntiAlias = false; | 253 args.fAntiAlias = false; |
| 254 tess.drawPath(args); | 254 tess.drawPath(args); |
| 255 } | 255 } |
| 256 | 256 |
| 257 DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { | 257 DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { |
| 258 sk_sp<GrDrawContext> drawContext(ctxInfo.grContext()->newDrawContext(SkBacki
ngFit::kApprox, | 258 sk_sp<GrDrawContext> drawContext(ctxInfo.grContext()->newDrawContext(SkBacki
ngFit::kApprox, |
| 259 800, 80
0, | 259 800, 80
0, |
| 260 kSkia88
88_GrPixelConfig, | 260 kSkia88
88_GrPixelConfig, |
| 261 0, | 261 0, |
| 262 kTopLef
t_GrSurfaceOrigin)); | 262 kTopLef
t_GrSurfaceOrigin)); |
| 263 if (!drawContext) { | 263 if (!drawContext) { |
| 264 return; | 264 return; |
| 265 } | 265 } |
| 266 | 266 |
| 267 GrTestTarget tt; | 267 GrTestTarget tt; |
| 268 ctxInfo.grContext()->getTestTarget(&tt, drawContext); | 268 ctxInfo.grContext()->getTestTarget(&tt, drawContext); |
| 269 GrDrawTarget* dt = tt.target(); | |
| 270 GrResourceProvider* rp = tt.resourceProvider(); | 269 GrResourceProvider* rp = tt.resourceProvider(); |
| 271 | 270 |
| 272 test_path(dt, drawContext.get(), rp, create_path_0()); | 271 test_path(drawContext.get(), rp, create_path_0()); |
| 273 test_path(dt, drawContext.get(), rp, create_path_1()); | 272 test_path(drawContext.get(), rp, create_path_1()); |
| 274 test_path(dt, drawContext.get(), rp, create_path_2()); | 273 test_path(drawContext.get(), rp, create_path_2()); |
| 275 test_path(dt, drawContext.get(), rp, create_path_3()); | 274 test_path(drawContext.get(), rp, create_path_3()); |
| 276 test_path(dt, drawContext.get(), rp, create_path_4()); | 275 test_path(drawContext.get(), rp, create_path_4()); |
| 277 test_path(dt, drawContext.get(), rp, create_path_5()); | 276 test_path(drawContext.get(), rp, create_path_5()); |
| 278 test_path(dt, drawContext.get(), rp, create_path_6()); | 277 test_path(drawContext.get(), rp, create_path_6()); |
| 279 test_path(dt, drawContext.get(), rp, create_path_7()); | 278 test_path(drawContext.get(), rp, create_path_7()); |
| 280 test_path(dt, drawContext.get(), rp, create_path_8()); | 279 test_path(drawContext.get(), rp, create_path_8()); |
| 281 test_path(dt, drawContext.get(), rp, create_path_9()); | 280 test_path(drawContext.get(), rp, create_path_9()); |
| 282 test_path(dt, drawContext.get(), rp, create_path_10()); | 281 test_path(drawContext.get(), rp, create_path_10()); |
| 283 test_path(dt, drawContext.get(), rp, create_path_11()); | 282 test_path(drawContext.get(), rp, create_path_11()); |
| 284 test_path(dt, drawContext.get(), rp, create_path_12()); | 283 test_path(drawContext.get(), rp, create_path_12()); |
| 285 test_path(dt, drawContext.get(), rp, create_path_13()); | 284 test_path(drawContext.get(), rp, create_path_13()); |
| 286 test_path(dt, drawContext.get(), rp, create_path_14()); | 285 test_path(drawContext.get(), rp, create_path_14()); |
| 287 test_path(dt, drawContext.get(), rp, create_path_15()); | 286 test_path(drawContext.get(), rp, create_path_15()); |
| 288 } | 287 } |
| 289 #endif | 288 #endif |
| OLD | NEW |