diff options
author | Greg Daniel <egdaniel@google.com> | 2018-03-15 17:00:06 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-16 12:25:51 +0000 |
commit | 6e9a4f6327d1c9b1cac26d4d091b9f4fbb0cf4fc (patch) | |
tree | f14bd0e4c447945ebcc8ed32de8b0172fd1d1c3f /src/gpu | |
parent | bcc00b2a612c3cc7a15fe708ca481e6e572c2085 (diff) |
Make TestForPreservingPMConversions helper use lazy createTextureProxy call.
Bug: skia:
Change-Id: I337efc531aa5685c138b2f9e2bd47b47ba4e1fd5
Reviewed-on: https://skia-review.googlesource.com/114583
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/effects/GrConfigConversionEffect.fp | 19 | ||||
-rw-r--r-- | src/gpu/effects/GrConfigConversionEffect.h | 16 |
2 files changed, 21 insertions, 14 deletions
diff --git a/src/gpu/effects/GrConfigConversionEffect.fp b/src/gpu/effects/GrConfigConversionEffect.fp index 762093ef15..6cc5820fd0 100644 --- a/src/gpu/effects/GrConfigConversionEffect.fp +++ b/src/gpu/effects/GrConfigConversionEffect.fp @@ -53,15 +53,20 @@ // draw readRTC->discard(); - GrSurfaceDesc desc; - desc.fWidth = kSize; - desc.fHeight = kSize; - desc.fConfig = kConfig; - GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); - sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy( - desc, SkBudgeted::kYes, data, 0); + SkPixmap pixmap(ii, srcData, 4 * kSize); + + // This function is only ever called if we are in a GrContext that has a GrGpu since we are + // calling read pixels here. Thus the pixel data will be uploaded immediately and we don't + // need to keep the pixel data alive in the proxy. Therefore the ReleaseProc is nullptr. + sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr); + + sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy(std::move(image), + kNone_GrSurfaceFlags, + 1, + SkBudgeted::kYes, + SkBackingFit::kExact); if (!dataProxy) { return false; } diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h index ca3cd85200..0decae9689 100644 --- a/src/gpu/effects/GrConfigConversionEffect.h +++ b/src/gpu/effects/GrConfigConversionEffect.h @@ -57,15 +57,17 @@ public: // draw readRTC->discard(); - GrSurfaceDesc desc; - desc.fWidth = kSize; - desc.fHeight = kSize; - desc.fConfig = kConfig; - GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); - sk_sp<GrTextureProxy> dataProxy = - proxyProvider->createTextureProxy(desc, SkBudgeted::kYes, data, 0); + SkPixmap pixmap(ii, srcData, 4 * kSize); + + // This function is only ever called if we are in a GrContext that has a GrGpu since we are + // calling read pixels here. Thus the pixel data will be uploaded immediately and we don't + // need to keep the pixel data alive in the proxy. Therefore the ReleaseProc is nullptr. + sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr); + + sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy( + std::move(image), kNone_GrSurfaceFlags, 1, SkBudgeted::kYes, SkBackingFit::kExact); if (!dataProxy) { return false; } |