diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrBackendSurface.cpp | 23 | ||||
-rw-r--r-- | src/image/SkSurface.cpp | 7 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 14 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp index 04216b7508..d37c73a4a0 100644 --- a/src/gpu/GrBackendSurface.cpp +++ b/src/gpu/GrBackendSurface.cpp @@ -97,6 +97,29 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , fBackend(kOpenGL_GrBackend) , fGLInfo(glInfo) {} +GrBackendRenderTarget::GrBackendRenderTarget(const GrBackendRenderTargetDesc& desc, + GrBackend backend) + : fWidth(desc.fWidth) + , fHeight(desc.fHeight) + , fSampleCnt(desc.fSampleCnt) + , fStencilBits(desc.fStencilBits) + , fConfig(desc.fConfig) + , fBackend(backend) { + if (kOpenGL_GrBackend == backend) { + fGLInfo.fFBOID = static_cast<GrGLuint>(desc.fRenderTargetHandle); + } else { + SkASSERT(kVulkan_GrBackend == backend); +#ifdef SK_VULKAN + const GrVkImageInfo* vkInfo = + reinterpret_cast<const GrVkImageInfo*>(desc.fRenderTargetHandle); + fConfig = GrVkFormatToPixelConfig(vkInfo->fFormat); + fVkInfo = *vkInfo; +#else + fConfig = kUnknown_GrPixelConfig; +#endif + } +} + #ifdef SK_VULKAN const GrVkImageInfo* GrBackendRenderTarget::getVkImageInfo() const { if (kVulkan_GrBackend == fBackend) { diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index e0a058093b..d7fa60589a 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -241,6 +241,13 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext*, const GrBackendTe } sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*, + const GrBackendRenderTargetDesc&, + sk_sp<SkColorSpace>, + const SkSurfaceProps*) { + return nullptr; +} + +sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*, const GrBackendRenderTarget&, GrSurfaceOrigin origin, sk_sp<SkColorSpace>, diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 5b51942b38..143a6039f0 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -233,6 +233,20 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context, const GrB } sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context, + const GrBackendRenderTargetDesc& desc, + sk_sp<SkColorSpace> colorSpace, + const SkSurfaceProps* props) { + if (!context) { + return nullptr; + } + + GrBackendRenderTarget backendRT(desc, context->contextPriv().getBackend()); + return MakeFromBackendRenderTarget(context, backendRT, desc.fOrigin, + std::move(colorSpace), props); + +} + +sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context, const GrBackendRenderTarget& backendRT, GrSurfaceOrigin origin, sk_sp<SkColorSpace> colorSpace, |