diff options
author | Greg Daniel <egdaniel@google.com> | 2017-04-26 12:19:14 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-27 18:15:38 +0000 |
commit | fdd77daedbba3b7c53be74a82fb9fae891b51696 (patch) | |
tree | af2780b3f60109deb860b774eb128487d0134de0 /src/image | |
parent | a41d48b739c144ee7b36290a9642064bc6cdcd05 (diff) |
Plumb the use of GrBackendRenderTarget throughout Skia
Bug: skia:
Change-Id: Ib99a58d9552f5c7b8d77c09dcc72fa88326c26aa
Reviewed-on: https://skia-review.googlesource.com/14148
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/image')
-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, |