diff options
Diffstat (limited to 'src/image/SkSurface_Gpu.cpp')
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 96ac31e16c..5001811cea 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -261,19 +261,36 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context, if (!context) { return nullptr; } - if (!SkSurface_Gpu::Valid(context, desc.fConfig, colorSpace.get())) { + + 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, + const SkSurfaceProps* props) { + if (!context) { + return nullptr; + } + if (!SkSurface_Gpu::Valid(context, backendRT.config(), colorSpace.get())) { return nullptr; } sk_sp<GrRenderTargetContext> rtc( - context->contextPriv().makeBackendRenderTargetRenderTargetContext(desc, + context->contextPriv().makeBackendRenderTargetRenderTargetContext(backendRT, + origin, std::move(colorSpace), props)); if (!rtc) { return nullptr; } - sk_sp<SkGpuDevice> device(SkGpuDevice::Make(context, std::move(rtc), desc.fWidth, desc.fHeight, + sk_sp<SkGpuDevice> device(SkGpuDevice::Make(context, std::move(rtc), + backendRT.width(), backendRT.height(), SkGpuDevice::kUninit_InitContents)); if (!device) { return nullptr; @@ -282,16 +299,6 @@ 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, |