aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkSurface_Gpu.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-03-23 15:31:32 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-23 20:44:50 +0000
commit49edccd775a38d93701ae376df28463d7848fd16 (patch)
treea8b9c58bc7440adfa745ba721b712b6a8cb4a33d /src/image/SkSurface_Gpu.cpp
parentf4a00e4b4a0642a9f3e69705632f9cd6e9d1cd4d (diff)
Remove legacy SkSurface::MakeFromBackendRenderTarget that does not take SkColorType
Bug: skia:6718 Change-Id: Iefec5be49bf7450426c5ddb668f5525876f8ec2d Reviewed-on: https://skia-review.googlesource.com/116194 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/image/SkSurface_Gpu.cpp')
-rw-r--r--src/image/SkSurface_Gpu.cpp55
1 files changed, 23 insertions, 32 deletions
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 74169b6548..ace1981bf7 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -381,37 +381,6 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context, const GrB
return sk_make_sp<SkSurface_Gpu>(std::move(device));
}
-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(backendRT,
- origin,
- std::move(colorSpace),
- props));
- if (!rtc) {
- return nullptr;
- }
-
- sk_sp<SkGpuDevice> device(SkGpuDevice::Make(context, std::move(rtc),
- backendRT.width(), backendRT.height(),
- SkGpuDevice::kUninit_InitContents));
- if (!device) {
- return nullptr;
- }
-
- return sk_make_sp<SkSurface_Gpu>(std::move(device));
-}
-
bool validate_backend_render_target(GrContext* ctx, const GrBackendRenderTarget& rt,
GrPixelConfig* config, SkColorType ct, sk_sp<SkColorSpace> cs) {
// TODO: Create a SkImageColorInfo struct for color, alpha, and color space so we don't need to
@@ -446,12 +415,34 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
if (!context) {
return nullptr;
}
+
GrBackendRenderTarget rtCopy = rt;
if (!validate_backend_render_target(context, rtCopy, &rtCopy.fConfig, colorType, colorSpace)) {
return nullptr;
}
+ if (!SkSurface_Gpu::Valid(context, rtCopy.config(), colorSpace.get())) {
+ return nullptr;
+ }
+
+ if (!context) {
+ return nullptr;
+ }
+
+ sk_sp<GrRenderTargetContext> rtc(
+ context->contextPriv().makeBackendRenderTargetRenderTargetContext(
+ rtCopy, origin, std::move(colorSpace), props));
+ if (!rtc) {
+ return nullptr;
+ }
+
+ sk_sp<SkGpuDevice> device(SkGpuDevice::Make(context, std::move(rtc), rtCopy.width(),
+ rtCopy.height(),
+ SkGpuDevice::kUninit_InitContents));
+ if (!device) {
+ return nullptr;
+ }
- return MakeFromBackendRenderTarget(context, rtCopy, origin, colorSpace, props);
+ return sk_make_sp<SkSurface_Gpu>(std::move(device));
}
sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context,