Lines Matching refs:SkSurface
14 #include "include/core/SkSurface.h"
46 static sk_sp<SkSurface> create_surface(SkAlphaType at = kPremul_SkAlphaType,
52 return SkSurface::MakeRaster(info);
54 static sk_sp<SkSurface> create_direct_surface(SkAlphaType at = kPremul_SkAlphaType,
62 return SkSurface::MakeRasterDirectReleaseProc(info, storage, rowBytes,
66 static sk_sp<SkSurface> create_gpu_surface(GrRecordingContext* rContext,
73 return SkSurface::MakeRenderTarget(rContext, SkBudgeted::kNo, info);
75 static sk_sp<SkSurface> create_gpu_scratch_surface(GrRecordingContext* rContext,
82 return SkSurface::MakeRenderTarget(rContext, SkBudgeted::kYes, info);
87 REPORTER_ASSERT(reporter, nullptr == SkSurface::MakeRaster(info));
88 REPORTER_ASSERT(reporter, nullptr == SkSurface::MakeRasterDirect(info, nullptr, 0));
94 SkSurface::MakeRenderTarget(ctxInfo.directContext(), SkBudgeted::kNo, info));
108 auto surf = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info, 1, nullptr);
126 auto surf = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info, kSampleCnt,
136 // Ensure that the sample count stored on the resulting SkSurface is a valid value.
215 sk_sp<SkSurface>& surface,
256 static void test_snapshot_alphatype(skiatest::Reporter* reporter, const sk_sp<SkSurface>& surface,
286 skiatest::Reporter* reporter, SkSurface* surface, SkSurface::BackendHandleAccess access) {
298 skiatest::Reporter* reporter, SkSurface* surface, SkSurface::BackendHandleAccess access) {
311 const SkSurface::BackendHandleAccess accessModes[] = {
312 SkSurface::kFlushRead_BackendHandleAccess,
313 SkSurface::kFlushWrite_BackendHandleAccess,
314 SkSurface::kDiscardWrite_BackendHandleAccess,
331 template<typename Type, Type(SkSurface::*func)(SkSurface::BackendHandleAccess)>
332 static void test_backend_unique_id(skiatest::Reporter* reporter, SkSurface* surface) {
335 Type obj = (surface->*func)(SkSurface::kFlushRead_BackendHandleAccess);
341 obj = (surface->*func)(SkSurface::kFlushWrite_BackendHandleAccess);
347 obj = (surface->*func)(SkSurface::kDiscardWrite_BackendHandleAccess);
360 test_backend_unique_id<GrBackendTexture, &SkSurface::getBackendTexture>(reporter,
365 test_backend_unique_id<GrBackendRenderTarget, &SkSurface::getBackendRenderTarget>(
374 sk_sp<SkSurface> surface = create_gpu_surface(direct, kPremul_SkAlphaType, nullptr);
389 sk_sp<SkSurface> surface = create_gpu_surface(dContext, kPremul_SkAlphaType, nullptr);
395 surface->getBackendRenderTarget(SkSurface::kFlushRead_BackendHandleAccess);
398 surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess);
405 beRT = surface->getBackendRenderTarget(SkSurface::kFlushRead_BackendHandleAccess);
407 beTex = surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess);
412 static void test_copy_on_write(skiatest::Reporter* reporter, SkSurface* surface) {
479 SkSurface* surface) {
499 SkSurface* surface1,
500 SkSurface* surface2) {
549 surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
560 surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
567 static SkBudgeted is_budgeted(const sk_sp<SkSurface>& surf) {
582 auto surface(SkSurface::MakeRenderTarget(dContext, budgeted, info));
603 SkSurface* surface,
604 SkSurface::ContentChangeMode mode) {
609 SkSurface* surface,
610 SkSurface::ContentChangeMode mode) {
611 // Verifies the robustness of SkSurface for handling use cases where calls
621 SkSurface::ContentChangeMode modes[] =
622 { SkSurface::kDiscard_ContentChangeMode, SkSurface::kRetain_ContentChangeMode};
630 SkSurface::ContentChangeMode modes[] =
631 { SkSurface::kDiscard_ContentChangeMode, SkSurface::kRetain_ContentChangeMode};
642 static void check_rowbytes_remain_consistent(SkSurface* surface, skiatest::Reporter* reporter) {
665 auto surf0(SkSurface::MakeRaster(info));
669 auto surf1(SkSurface::MakeRaster(info, 500, nullptr));
673 auto s = SkSurface::MakeRaster(info, 396, nullptr); // needs to be at least 400
675 s = SkSurface::MakeRaster(info, std::numeric_limits<size_t>::max(), nullptr);
680 sk_sp<SkSurface> s(SkSurface::MakeRasterN32Premul(100, 100));
691 static sk_sp<SkSurface> create_gpu_surface_backend_texture(GrDirectContext* dContext,
729 static bool supports_readpixels(const GrCaps* caps, SkSurface* surface) {
738 static sk_sp<SkSurface> create_gpu_surface_backend_render_target(GrDirectContext* dContext,
776 msg = "SkSurface should have left render target unmodified";
778 msg = "SkSurface should have cleared the render target";
792 auto makeImageSurfaceContext = [dContext](SkSurface* surface) {
804 ERRORF(reporter, "Could not create GPU SkSurface.");
809 ERRORF(reporter, "Could access surface context of GPU SkSurface.");
823 ERRORF(reporter, "Could not create GPU SkSurface.");
828 ERRORF(reporter, "Could access surface context of GPU SkSurface.");
839 skiatest::Reporter* reporter, sk_sp<SkSurface> surface, SkColor origColor) {
926 sk_sp<SkSurface> surface;
940 surface = SkSurface::MakeFromBackendTexture(
956 surface = SkSurface::MakeFromBackendRenderTarget(ctx, backendRT, texOrigin,
1004 // Validate that we can attach a stencil buffer to an SkSurface created by either of
1039 auto surf = SkSurface::MakeFromBackendTexture(
1075 surf = SkSurface::MakeFromBackendTexture(
1104 // Can't replace texture of non-wrapped SkSurface.
1105 surf = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, ii, sampleCnt, nullptr);
1114 static void test_overdraw_surface(skiatest::Reporter* r, SkSurface* surface) {
1129 sk_sp<SkSurface> surface = create_surface();
1135 sk_sp<SkSurface> surface = create_gpu_surface(context);
1140 REPORTER_ASSERT(r, SkSurface::MakeNull(0, 0) == nullptr);
1144 auto surf = SkSurface::MakeNull(w, h);
1156 auto surf = SkSurface::MakeRaster(info, rowBytes, nullptr);