Lines Matching refs:surface
245 sk_sp<SkSurface>& surface, in test_canvas_peek() argument
250 surface->getCanvas()->clear(color); in test_canvas_peek()
253 bool success = surface->getCanvas()->peekPixels(&pmap); in test_canvas_peek()
257 const void* addr2 = surface->peekPixels(&pmap2) ? pmap2.addr() : nullptr; in test_canvas_peek()
274 auto surface(surface_func(kPremul_SkAlphaType, &requestInfo)); in DEF_TEST() local
275 test_canvas_peek(reporter, surface, requestInfo, true); in DEF_TEST()
281 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, &requestInfo)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
282 test_canvas_peek(reporter, surface, requestInfo, false); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
286 static void test_snapshot_alphatype(skiatest::Reporter* reporter, const sk_sp<SkSurface>& surface, in test_snapshot_alphatype() argument
288 REPORTER_ASSERT(reporter, surface); in test_snapshot_alphatype()
289 if (surface) { in test_snapshot_alphatype()
290 sk_sp<SkImage> image(surface->makeImageSnapshot()); in test_snapshot_alphatype()
300 auto surface(surface_func(at, nullptr)); in DEF_TEST() local
301 test_snapshot_alphatype(reporter, surface, at); in DEF_TEST()
309 auto surface(surface_func(ctxInfo.grContext(), at, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
310 test_snapshot_alphatype(reporter, surface, at); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
316 skiatest::Reporter* reporter, SkSurface* surface, SkSurface::BackendHandleAccess access) { in test_backend_texture_access_copy_on_write() argument
317 GrBackendTexture tex1 = surface->getBackendTexture(access); in test_backend_texture_access_copy_on_write()
318 sk_sp<SkImage> snap1(surface->makeImageSnapshot()); in test_backend_texture_access_copy_on_write()
320 GrBackendTexture tex2 = surface->getBackendTexture(access); in test_backend_texture_access_copy_on_write()
321 sk_sp<SkImage> snap2(surface->makeImageSnapshot()); in test_backend_texture_access_copy_on_write()
328 skiatest::Reporter* reporter, SkSurface* surface, SkSurface::BackendHandleAccess access) { in test_backend_rendertarget_access_copy_on_write() argument
329 GrBackendRenderTarget rt1 = surface->getBackendRenderTarget(access); in test_backend_rendertarget_access_copy_on_write()
330 sk_sp<SkImage> snap1(surface->makeImageSnapshot()); in test_backend_rendertarget_access_copy_on_write()
332 GrBackendRenderTarget rt2 = surface->getBackendRenderTarget(access); in test_backend_rendertarget_access_copy_on_write()
333 sk_sp<SkImage> snap2(surface->makeImageSnapshot()); in test_backend_rendertarget_access_copy_on_write()
350 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
351 test_backend_texture_access_copy_on_write(reporter, surface.get(), accessMode); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
354 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
355 test_backend_rendertarget_access_copy_on_write(reporter, surface.get(), accessMode); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
362 static void test_backend_unique_id(skiatest::Reporter* reporter, SkSurface* surface) { in test_backend_unique_id() argument
363 sk_sp<SkImage> image0(surface->makeImageSnapshot()); in test_backend_unique_id()
365 Type obj = (surface->*func)(SkSurface::kFlushRead_BackendHandleAccess); in test_backend_unique_id()
367 sk_sp<SkImage> image1(surface->makeImageSnapshot()); in test_backend_unique_id()
371 obj = (surface->*func)(SkSurface::kFlushWrite_BackendHandleAccess); in test_backend_unique_id()
373 sk_sp<SkImage> image2(surface->makeImageSnapshot()); in test_backend_unique_id()
377 obj = (surface->*func)(SkSurface::kDiscardWrite_BackendHandleAccess); in test_backend_unique_id()
379 sk_sp<SkImage> image3(surface->makeImageSnapshot()); in test_backend_unique_id()
389 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
391 surface.get()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
394 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
396 reporter, surface.get()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
402 static void test_copy_on_write(skiatest::Reporter* reporter, SkSurface* surface) { in test_copy_on_write() argument
403 SkCanvas* canvas = surface->getCanvas(); in test_copy_on_write()
438 sk_sp<SkImage> imageBefore = surface->makeImageSnapshot(); \ in test_copy_on_write()
441 sk_sp<SkImage> imageAfter = surface->makeImageSnapshot(); \ in test_copy_on_write()
464 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
465 test_copy_on_write(reporter, surface.get()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
470 SkSurface* surface) { in test_writable_after_snapshot_release() argument
474 SkCanvas* canvas = surface->getCanvas(); in test_writable_after_snapshot_release()
476 surface->makeImageSnapshot(); // Create and destroy SkImage in test_writable_after_snapshot_release()
484 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
485 test_writable_after_snapshot_release(reporter, surface.get()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
530 auto surface(create_surface()); in DEF_TEST() local
531 sk_sp<SkImage> image(surface->makeImageSnapshot()); in DEF_TEST()
533 surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode); in DEF_TEST()
538 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
539 sk_sp<SkImage> image(surface->makeImageSnapshot()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
544 surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
570 auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), budgeted, info)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
571 SkASSERT(surface); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
572 REPORTER_ASSERT(reporter, budgeted == is_budgeted(surface)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
574 sk_sp<SkImage> image(surface->makeImageSnapshot()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
578 REPORTER_ASSERT(reporter, budgeted == is_budgeted(surface)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
582 surface->getCanvas()->clear(SK_ColorBLUE); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
585 REPORTER_ASSERT(reporter, budgeted == is_budgeted(surface)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
591 SkSurface* surface, in test_no_canvas1() argument
594 surface->notifyContentWillChange(mode); in test_no_canvas1()
597 SkSurface* surface, in test_no_canvas2() argument
601 sk_sp<SkImage> image1 = surface->makeImageSnapshot(); in test_no_canvas2()
603 surface->notifyContentWillChange(mode); in test_no_canvas2()
604 sk_sp<SkImage> image2 = surface->makeImageSnapshot(); in test_no_canvas2()
623 auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
624 test_func(reporter, surface.get(), mode); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
630 static void check_rowbytes_remain_consistent(SkSurface* surface, skiatest::Reporter* reporter) { in check_rowbytes_remain_consistent() argument
632 REPORTER_ASSERT(reporter, surface->peekPixels(&surfacePM)); in check_rowbytes_remain_consistent()
634 sk_sp<SkImage> image(surface->makeImageSnapshot()); in check_rowbytes_remain_consistent()
641 surface->getCanvas()->drawPaint(SkPaint()); in check_rowbytes_remain_consistent()
642 sk_sp<SkImage> image2(surface->makeImageSnapshot()); in check_rowbytes_remain_consistent()
712 sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(ctx, *outTexture, in create_gpu_surface_backend_texture() local
716 if (!surface) { in create_gpu_surface_backend_texture()
720 return surface; in create_gpu_surface_backend_texture()
736 sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTextureAsRenderTarget( in create_gpu_surface_backend_texture_as_render_target() local
740 if (!surface) { in create_gpu_surface_backend_texture_as_render_target()
744 return surface; in create_gpu_surface_backend_texture_as_render_target()
782 auto makeImageSurfaceContext = [context](SkSurface* surface) { in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS() argument
783 sk_sp<SkImage> i(surface->makeImageSnapshot()); in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
792 auto surface = surface_func(context, kPremul_SkAlphaType, nullptr); in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS() local
793 if (!surface) { in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
797 auto rtc = surface->getCanvas()->internal_private_accessTopLayerRenderTargetContext(); in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
803 auto imageSurfaceCtx = makeImageSurfaceContext(surface.get()); in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
812 auto surface = surfaceFunc(context, 1, kOrigColor, &backendTex); in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS() local
813 if (!surface) { in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
817 auto rtc = surface->getCanvas()->internal_private_accessTopLayerRenderTargetContext(); in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
823 auto imageSurfaceCtx = makeImageSurfaceContext(surface.get()); in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
830 skiatest::Reporter* reporter, sk_sp<SkSurface> surface, SkColor origColor) { in test_surface_draw_partially() argument
831 const int kW = surface->width(); in test_surface_draw_partially()
832 const int kH = surface->height(); in test_surface_draw_partially()
836 surface->getCanvas()->drawRect(SkRect::MakeIWH(kW, kH/2), paint); in test_surface_draw_partially()
845 SkAssertResult(surface->readPixels(readback.info(), readback.writable_addr(), in test_surface_draw_partially()
892 auto surface = surfaceFunc(context, 1, kOrigColor, &backendTex); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
893 if (surface) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
894 test_surface_draw_partially(reporter, surface, kOrigColor.toSkColor()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
895 surface.reset(); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
920 sk_sp<SkSurface> surface; in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
933 surface = SkSurface::MakeFromBackendTexture(ctx, backendTex, texOrigin, 1, in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
944 surface = SkSurface::MakeFromBackendRenderTarget(ctx, backendRT, texOrigin, in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
950 if (!surface) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
955 surface->getCanvas()->clear(SK_ColorRED); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
956 surface->flush(); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
961 surface.reset(nullptr); // force a release of the surface in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
988 auto surface = surfaceFunc(context, sampleCnt, kOrigColor, &backendTex); in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS() local
990 if (!surface && sampleCnt > 1) { in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
997 GrRenderTarget* rt = surface->getCanvas() in DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS()
1110 static void test_overdraw_surface(skiatest::Reporter* r, SkSurface* surface) { in test_overdraw_surface() argument
1111 SkOverdrawCanvas canvas(surface->getCanvas()); in test_overdraw_surface()
1113 sk_sp<SkImage> image = surface->makeImageSnapshot(); in test_overdraw_surface()
1125 sk_sp<SkSurface> surface = create_surface(); in DEF_TEST() local
1126 test_overdraw_surface(r, surface.get()); in DEF_TEST()
1131 sk_sp<SkSurface> surface = create_gpu_surface(context); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
1132 test_overdraw_surface(r, surface.get()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()