diff options
author | Robert Phillips <robertphillips@google.com> | 2017-03-20 14:37:13 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-21 11:39:41 +0000 |
commit | 0db235bc0278887c344eb25b4681e9cca4cf892a (patch) | |
tree | 853a3e84db8d689e36ff5e6730ac38d77a621f14 /gm/image_pict.cpp | |
parent | 53262d0ff466668bfbc76893ba5a581203269572 (diff) |
Make SkImage_Gpu be deferred
This CL removes the GrTexture-based ctor forcing everyone to create deferred SkImage_Gpus.
split out into:
https://skia-review.googlesource.com/c/9106/ (Remove atlas creation from GrResourceProvider)
Change-Id: I266bbe089c242fe54d5b7adcc7895aa5a39440a0
Reviewed-on: https://skia-review.googlesource.com/6680
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'gm/image_pict.cpp')
-rw-r--r-- | gm/image_pict.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp index a6e0bdfcdd..883fd34725 100644 --- a/gm/image_pict.cpp +++ b/gm/image_pict.cpp @@ -344,6 +344,7 @@ protected: static void draw_as_tex(SkCanvas* canvas, SkImageCacherator* cache, SkScalar x, SkScalar y) { #if SK_SUPPORT_GPU sk_sp<SkColorSpace> texColorSpace; + // MDB TODO: this should be lockAsTextureRef sk_sp<GrTexture> texture( cache->lockAsTexture(canvas->getGrContext(), GrSamplerParams::ClampBilerp(), canvas->imageInfo().colorSpace(), &texColorSpace, @@ -359,9 +360,13 @@ protected: canvas->drawLine(r.left(), r.bottom(), r.right(), r.top(), paint); return; } + + sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(texture)); + // No API to draw a GrTexture directly, so we cheat and create a private image subclass - sk_sp<SkImage> image(new SkImage_Gpu(cache->uniqueID(), kPremul_SkAlphaType, - std::move(texture), std::move(texColorSpace), + sk_sp<SkImage> image(new SkImage_Gpu(canvas->getGrContext(), + cache->uniqueID(), kPremul_SkAlphaType, + std::move(proxy), std::move(texColorSpace), SkBudgeted::kNo)); canvas->drawImage(image.get(), x, y); #endif |