Lines Matching refs:SkSurface
25 #include "SkSurface.h"
41 static sk_sp<SkSurface> create_surface(SkAlphaType at = kPremul_SkAlphaType,
47 return SkSurface::MakeRaster(info);
49 static sk_sp<SkSurface> create_direct_surface(SkAlphaType at = kPremul_SkAlphaType,
57 return SkSurface::MakeRasterDirectReleaseProc(info, storage, rowBytes,
61 static sk_sp<SkSurface> create_gpu_surface(GrContext* context, SkAlphaType at = kPremul_SkAlphaType,
67 return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
69 static sk_sp<SkSurface> create_gpu_scratch_surface(GrContext* context,
76 return SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info);
81 REPORTER_ASSERT(reporter, nullptr == SkSurface::MakeRaster(info));
82 REPORTER_ASSERT(reporter, nullptr == SkSurface::MakeRasterDirect(info, nullptr, 0));
88 SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info));
98 auto surf = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, info, 1,
106 surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex,
112 surf = SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.grContext(), backendTex,
127 surf = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, info, kSampleCnt,
134 surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex,
140 // Ensure that the sample count stored on the resulting SkSurface is a valid value.
151 surf = SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.grContext(), backendTex,
176 surf = SkSurface::MakeFromBackendRenderTarget(ctxInfo.grContext(), backendRenderTarget,
206 auto surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex,
222 sk_sp<SkSurface>& surface,
263 static void test_snapshot_alphatype(skiatest::Reporter* reporter, const sk_sp<SkSurface>& surface,
293 skiatest::Reporter* reporter, SkSurface* surface, SkSurface::BackendHandleAccess access) {
305 skiatest::Reporter* reporter, SkSurface* surface, SkSurface::BackendHandleAccess access) {
318 const SkSurface::BackendHandleAccess accessModes[] = {
319 SkSurface::kFlushRead_BackendHandleAccess,
320 SkSurface::kFlushWrite_BackendHandleAccess,
321 SkSurface::kDiscardWrite_BackendHandleAccess,
338 template<typename Type, Type(SkSurface::*func)(SkSurface::BackendHandleAccess)>
339 static void test_backend_unique_id(skiatest::Reporter* reporter, SkSurface* surface) {
342 Type obj = (surface->*func)(SkSurface::kFlushRead_BackendHandleAccess);
348 obj = (surface->*func)(SkSurface::kFlushWrite_BackendHandleAccess);
354 obj = (surface->*func)(SkSurface::kDiscardWrite_BackendHandleAccess);
367 test_backend_unique_id<GrBackendTexture, &SkSurface::getBackendTexture>(reporter,
372 test_backend_unique_id<GrBackendRenderTarget, &SkSurface::getBackendRenderTarget>(
379 static void test_copy_on_write(skiatest::Reporter* reporter, SkSurface* surface) {
447 SkSurface* surface) {
467 SkSurface* surface1,
468 SkSurface* surface2) {
510 surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
521 surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
528 static SkBudgeted is_budgeted(const sk_sp<SkSurface>& surf) {
547 auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), budgeted, info));
568 SkSurface* surface,
569 SkSurface::ContentChangeMode mode) {
574 SkSurface* surface,
575 SkSurface::ContentChangeMode mode) {
576 // Verifies the robustness of SkSurface for handling use cases where calls
586 SkSurface::ContentChangeMode modes[] =
587 { SkSurface::kDiscard_ContentChangeMode, SkSurface::kRetain_ContentChangeMode};
595 SkSurface::ContentChangeMode modes[] =
596 { SkSurface::kDiscard_ContentChangeMode, SkSurface::kRetain_ContentChangeMode};
607 static void check_rowbytes_remain_consistent(SkSurface* surface, skiatest::Reporter* reporter) {
630 auto surf0(SkSurface::MakeRaster(info));
634 auto surf1(SkSurface::MakeRaster(info, 500, nullptr));
638 auto s = SkSurface::MakeRaster(info, 396, nullptr); // needs to be at least 400
640 s = SkSurface::MakeRaster(info, std::numeric_limits<size_t>::max(), nullptr);
645 sk_sp<SkSurface> s(SkSurface::MakeRasterN32Premul(100, 100));
656 static sk_sp<SkSurface> create_gpu_surface_backend_texture(
693 sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(context, *outTexture,
704 static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
720 sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTextureAsRenderTarget(
731 static void test_surface_clear(skiatest::Reporter* reporter, sk_sp<SkSurface> surface,
732 std::function<sk_sp<GrSurfaceContext>(SkSurface*)> grSurfaceGetter,
735 ERRORF(reporter, "Could not create GPU SkSurface.");
745 ERRORF(reporter, "Could access render target of GPU SkSurface.");
758 msg = "SkSurface should have left render target unmodified";
760 msg = "SkSurface should have cleared the render target";
775 std::function<sk_sp<GrSurfaceContext>(SkSurface*)> grSurfaceContextGetters[] = {
776 [] (SkSurface* s){
779 [] (SkSurface* s){
809 skiatest::Reporter* reporter, sk_sp<SkSurface> surface, uint32_t origColor) {
896 // Validate that we can attach a stencil buffer to an SkSurface created by either of
906 static void test_overdraw_surface(skiatest::Reporter* r, SkSurface* surface) {
921 sk_sp<SkSurface> surface = create_surface();
927 sk_sp<SkSurface> surface = create_gpu_surface(context);
932 REPORTER_ASSERT(r, SkSurface::MakeNull(0, 0) == nullptr);
936 auto surf = SkSurface::MakeNull(w, h);
948 auto surf = SkSurface::MakeRaster(info, rowBytes, nullptr);