diff options
author | 2017-04-18 15:52:36 -0400 | |
---|---|---|
committer | 2017-04-18 20:33:58 +0000 | |
commit | 9440345a81d6c2372ac0aed937080f3da67439dd (patch) | |
tree | 6db32e47129a4469dff10d0f980d29a4d04b07ef /src/image | |
parent | 4d8adbccc46b53e44000c433dabade338eb35c6f (diff) |
Add backend safe classes for passing in external texture and render targets into gpu
This CL adds the GrBackend* classes as well as just updates the API for SkSurface and
SkImage. The implementation on SkSurface/Image and the plumbing down into Ganesh will
be in an additional CL.
Besides the change to use the type safe classes, we also pull the SurfaceFlags, origin,
samples, out of the descriptor and pass those in directly.
Bug: skia:
Change-Id: I9702981fe26c3d5d7d2cbcf6977ba569d356d854
Reviewed-on: https://skia-review.googlesource.com/13122
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage.cpp | 13 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 17 | ||||
-rw-r--r-- | src/image/SkSurface.cpp | 29 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 29 |
4 files changed, 86 insertions, 2 deletions
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 9db4ed1fe8..9866acf3f9 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -339,6 +339,13 @@ sk_sp<SkImage> SkImage::MakeFromTexture(GrContext*, const GrBackendTextureDesc&, return nullptr; } +sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx, + const GrBackendTexture& tex, GrSurfaceOrigin origin, + SkAlphaType at, sk_sp<SkColorSpace> cs, + TextureReleaseProc releaseP, ReleaseContext releaseC) { + return nullptr; +} + size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy&, const DeferredTextureImageUsageParams[], int paramCnt, void* buffer, @@ -356,6 +363,12 @@ sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext*, const GrBackendTextur return nullptr; } +sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, + const GrBackendTexture& tex, GrSurfaceOrigin origin, + SkAlphaType at, sk_sp<SkColorSpace> cs) { + return nullptr; +} + sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx, SkYUVColorSpace space, const GrBackendObject yuvTextureHandles[3], const SkISize yuvSizes[3], diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 932bb383d2..0e74f68577 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -289,6 +289,23 @@ sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, const GrBackendTe nullptr, nullptr); } +sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx, + const GrBackendTexture& tex, GrSurfaceOrigin origin, + SkAlphaType at, sk_sp<SkColorSpace> cs, + TextureReleaseProc releaseP, ReleaseContext releaseC) { + // This function is not implemented yet + sk_throw(); + return nullptr; +} + +sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, + const GrBackendTexture& tex, GrSurfaceOrigin origin, + SkAlphaType at, sk_sp<SkColorSpace> cs) { + // This function is not implemented yet + sk_throw(); + return nullptr; +} + static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpace colorSpace, bool nv12, const GrBackendObject yuvTextureHandles[], diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index 55aab3e992..cd2a5f185f 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -201,6 +201,12 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext*, const GrBackendTe return nullptr; } +sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext*, const GrBackendTexture&, + GrSurfaceOrigin origin, int sampleCnt, + sk_sp<SkColorSpace>, const SkSurfaceProps*) { + return nullptr; +} + sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*, const GrBackendRenderTargetDesc&, sk_sp<SkColorSpace>, @@ -208,8 +214,27 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*, return nullptr; } -sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext*, const GrBackendTextureDesc&, - sk_sp<SkColorSpace>, const SkSurfaceProps*) { +sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*, + const GrBackendRenderTarget&, + GrSurfaceOrigin origin, + sk_sp<SkColorSpace>, + const SkSurfaceProps*) { + return nullptr; +} + +sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext*, + const GrBackendTextureDesc&, + sk_sp<SkColorSpace>, + const SkSurfaceProps*) { + return nullptr; +} + +sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext*, + const GrBackendTexture&, + GrSurfaceOrigin origin, + int sampleCnt, + sk_sp<SkColorSpace>, + const SkSurfaceProps*) { return nullptr; } diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index cef355e091..f024c41b38 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -243,6 +243,14 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context, return sk_make_sp<SkSurface_Gpu>(std::move(device)); } +sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext*, const GrBackendTexture&, + GrSurfaceOrigin origin, int sampleCnt, + sk_sp<SkColorSpace>, const SkSurfaceProps*) { + // This function is not implemented yet + sk_throw(); + return nullptr; +} + sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context, const GrBackendRenderTargetDesc& desc, sk_sp<SkColorSpace> colorSpace, @@ -271,6 +279,16 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context, return sk_make_sp<SkSurface_Gpu>(std::move(device)); } +sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*, + const GrBackendRenderTarget&, + GrSurfaceOrigin origin, + sk_sp<SkColorSpace>, + const SkSurfaceProps*) { + // This function is not implemented yet + sk_throw(); + return nullptr; +} + sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context, const GrBackendTextureDesc& desc, sk_sp<SkColorSpace> colorSpace, @@ -299,4 +317,15 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont return sk_make_sp<SkSurface_Gpu>(std::move(device)); } +sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext*, + const GrBackendTexture&, + GrSurfaceOrigin origin, + int sampleCnt, + sk_sp<SkColorSpace>, + const SkSurfaceProps*) { + // This function is not implemented yet + sk_throw(); + return nullptr; +} + #endif |