diff options
author | Greg Daniel <egdaniel@google.com> | 2018-03-20 12:09:09 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-20 19:24:51 +0000 |
commit | abadbeee62976ca6bb16ca60fec8d829265996c2 (patch) | |
tree | 0174f7021617cf618ac6c49e154fc77bb0da218c /src/image/SkImage_Gpu.cpp | |
parent | 6357116d96f1462852e2c8253f1649c2c762f3e3 (diff) |
Move MakeCrossContextFromPixmap to use lazy version of createTextureProxy
After this change it is only tests that are using the old API.
Bug: skia:
Change-Id: I421ab5efbc604769d2356609d61670c289574f3d
Reviewed-on: https://skia-review.googlesource.com/115300
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/image/SkImage_Gpu.cpp')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index b8a5bc4953..291b979b7b 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -761,9 +761,12 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromPixmap(GrContext* context, const SkP if (SkImageInfoIsValid(pixmap.info(), colorMode)) { ATRACE_ANDROID_FRAMEWORK("Upload Texture [%ux%u]", pixmap.width(), pixmap.height()); - GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *proxyProvider->caps()); - proxy = proxyProvider->createTextureProxy(desc, SkBudgeted::kYes, pixmap.addr(), - pixmap.rowBytes()); + // We don't need a release proc on the data in pixmap since we know we are in a + // GrContext that has a resource provider. Thus the createTextureProxy call will + // immediately upload the data. + sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr); + proxy = proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, 1, + SkBudgeted::kYes, SkBackingFit::kExact); } } |