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(GrContext* context, GrDrawTarget* dt, GrRenderTarget* rt,
const SkPath& path) { |
236 GrTessellatingPathRenderer tess; | 236 GrTessellatingPathRenderer tess(context); |
237 GrPipelineBuilder pipelineBuilder; | 237 GrPipelineBuilder pipelineBuilder; |
238 pipelineBuilder.setRenderTarget(rt); | 238 pipelineBuilder.setRenderTarget(rt); |
239 GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle); | 239 GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle); |
240 tess.drawPath(dt, &pipelineBuilder, SK_ColorWHITE, SkMatrix::I(), path, stro
ke, false); | 240 tess.drawPath(dt, &pipelineBuilder, SK_ColorWHITE, SkMatrix::I(), path, stro
ke, false); |
241 } | 241 } |
242 | 242 |
243 DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) { | 243 DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) { |
244 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 244 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
245 if (NULL == context) { | 245 if (NULL == context) { |
246 return; | 246 return; |
247 } | 247 } |
248 GrSurfaceDesc desc; | 248 GrSurfaceDesc desc; |
249 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 249 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
250 desc.fWidth = 800; | 250 desc.fWidth = 800; |
251 desc.fHeight = 800; | 251 desc.fHeight = 800; |
252 desc.fConfig = kSkia8888_GrPixelConfig; | 252 desc.fConfig = kSkia8888_GrPixelConfig; |
253 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 253 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
254 SkAutoTUnref<GrTexture> texture(context->textureProvider()->refScratchTextur
e(desc, | 254 SkAutoTUnref<GrTexture> texture(context->textureProvider()->refScratchTextur
e(desc, |
255 GrTextureProvider::kExact_ScratchTexMatch)); | 255 GrTextureProvider::kExact_ScratchTexMatch)); |
256 GrTestTarget tt; | 256 GrTestTarget tt; |
257 context->getTestTarget(&tt); | 257 context->getTestTarget(&tt); |
258 GrRenderTarget* rt = texture->asRenderTarget(); | 258 GrRenderTarget* rt = texture->asRenderTarget(); |
259 GrDrawTarget* dt = tt.target(); | 259 GrDrawTarget* dt = tt.target(); |
260 | 260 |
261 test_path(dt, rt, create_path_0()); | 261 test_path(context, dt, rt, create_path_0()); |
262 test_path(dt, rt, create_path_1()); | 262 test_path(context, dt, rt, create_path_1()); |
263 test_path(dt, rt, create_path_2()); | 263 test_path(context, dt, rt, create_path_2()); |
264 test_path(dt, rt, create_path_3()); | 264 test_path(context, dt, rt, create_path_3()); |
265 test_path(dt, rt, create_path_4()); | 265 test_path(context, dt, rt, create_path_4()); |
266 test_path(dt, rt, create_path_5()); | 266 test_path(context, dt, rt, create_path_5()); |
267 test_path(dt, rt, create_path_6()); | 267 test_path(context, dt, rt, create_path_6()); |
268 test_path(dt, rt, create_path_7()); | 268 test_path(context, dt, rt, create_path_7()); |
269 test_path(dt, rt, create_path_8()); | 269 test_path(context, dt, rt, create_path_8()); |
270 test_path(dt, rt, create_path_9()); | 270 test_path(context, dt, rt, create_path_9()); |
271 test_path(dt, rt, create_path_10()); | 271 test_path(context, dt, rt, create_path_10()); |
272 test_path(dt, rt, create_path_11()); | 272 test_path(context, dt, rt, create_path_11()); |
273 test_path(dt, rt, create_path_12()); | 273 test_path(context, dt, rt, create_path_12()); |
274 test_path(dt, rt, create_path_13()); | 274 test_path(context, dt, rt, create_path_13()); |
275 test_path(dt, rt, create_path_14()); | 275 test_path(context, dt, rt, create_path_14()); |
276 test_path(dt, rt, create_path_15()); | 276 test_path(context, dt, rt, create_path_15()); |
277 } | 277 } |
278 #endif | 278 #endif |
OLD | NEW |