OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 <functional> | 8 #include <functional> |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 #endif | 620 #endif |
621 | 621 |
622 #if SK_SUPPORT_GPU | 622 #if SK_SUPPORT_GPU |
623 #include "GrGpuResourcePriv.h" | 623 #include "GrGpuResourcePriv.h" |
624 #include "SkGpuDevice.h" | 624 #include "SkGpuDevice.h" |
625 #include "SkImage_Gpu.h" | 625 #include "SkImage_Gpu.h" |
626 #include "SkSurface_Gpu.h" | 626 #include "SkSurface_Gpu.h" |
627 | 627 |
628 static SkBudgeted is_budgeted(const sk_sp<SkSurface>& surf) { | 628 static SkBudgeted is_budgeted(const sk_sp<SkSurface>& surf) { |
629 SkSurface_Gpu* gsurf = (SkSurface_Gpu*)surf.get(); | 629 SkSurface_Gpu* gsurf = (SkSurface_Gpu*)surf.get(); |
630 return gsurf->getDevice()->accessRenderTarget()->resourcePriv().isBudgeted()
; | 630 return gsurf->getDevice()->accessDrawContext()->accessRenderTarget()->resour
cePriv().isBudgeted(); |
631 } | 631 } |
632 | 632 |
633 static SkBudgeted is_budgeted(SkImage* image) { | 633 static SkBudgeted is_budgeted(SkImage* image) { |
634 return ((SkImage_Gpu*)image)->peekTexture()->resourcePriv().isBudgeted(); | 634 return ((SkImage_Gpu*)image)->peekTexture()->resourcePriv().isBudgeted(); |
635 } | 635 } |
636 | 636 |
637 static SkBudgeted is_budgeted(const sk_sp<SkImage> image) { | 637 static SkBudgeted is_budgeted(const sk_sp<SkImage> image) { |
638 return is_budgeted(image.get()); | 638 return is_budgeted(image.get()); |
639 } | 639 } |
640 | 640 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 } | 849 } |
850 } | 850 } |
851 | 851 |
852 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) { | 852 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) { |
853 GrContext* context = ctxInfo.grContext(); | 853 GrContext* context = ctxInfo.grContext(); |
854 | 854 |
855 std::function<GrSurface*(SkSurface*)> grSurfaceGetters[] = { | 855 std::function<GrSurface*(SkSurface*)> grSurfaceGetters[] = { |
856 [] (SkSurface* s){ | 856 [] (SkSurface* s){ |
857 GrDrawContext* dc = s->getCanvas()->internal_private_accessTopLayerD
rawContext(); | 857 GrDrawContext* dc = s->getCanvas()->internal_private_accessTopLayerD
rawContext(); |
858 return dc->accessRenderTarget(); }, | 858 return dc->accessRenderTarget(); }, |
859 [] (SkSurface* s){ | |
860 SkBaseDevice* d = | |
861 s->getCanvas()->getDevice_just_for_deprecated_compatibility_test
ing(); | |
862 return d->accessRenderTarget(); }, | |
863 [] (SkSurface* s){ sk_sp<SkImage> i(s->makeImageSnapshot()); | 859 [] (SkSurface* s){ sk_sp<SkImage> i(s->makeImageSnapshot()); |
864 return as_IB(i)->peekTexture(); } | 860 return as_IB(i)->peekTexture(); } |
865 }; | 861 }; |
866 | 862 |
867 for (auto grSurfaceGetter : grSurfaceGetters) { | 863 for (auto grSurfaceGetter : grSurfaceGetters) { |
868 // Test that non-wrapped RTs are created clear. | 864 // Test that non-wrapped RTs are created clear. |
869 for (auto& surface_func : {&create_gpu_surface, &create_gpu_scratch_surf
ace}) { | 865 for (auto& surface_func : {&create_gpu_surface, &create_gpu_scratch_surf
ace}) { |
870 auto surface = surface_func(context, kPremul_SkAlphaType, nullptr); | 866 auto surface = surface_func(context, kPremul_SkAlphaType, nullptr); |
871 test_surface_clear(reporter, surface, grSurfaceGetter, 0x0); | 867 test_surface_clear(reporter, surface, grSurfaceGetter, 0x0); |
872 } | 868 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 // our surface functions. | 966 // our surface functions. |
971 GrRenderTarget* rt = surface->getCanvas()->internal_private_accessTo
pLayerDrawContext() | 967 GrRenderTarget* rt = surface->getCanvas()->internal_private_accessTo
pLayerDrawContext() |
972 ->accessRenderTarget(); | 968 ->accessRenderTarget(); |
973 REPORTER_ASSERT(reporter, | 969 REPORTER_ASSERT(reporter, |
974 ctxInfo.grContext()->resourceProvider()->attachStenc
ilAttachment(rt)); | 970 ctxInfo.grContext()->resourceProvider()->attachStenc
ilAttachment(rt)); |
975 gpu->deleteTestingOnlyBackendTexture(textureObject); | 971 gpu->deleteTestingOnlyBackendTexture(textureObject); |
976 } | 972 } |
977 } | 973 } |
978 } | 974 } |
979 #endif | 975 #endif |
OLD | NEW |