From 4f358be6b72cca97856b3f59d83448650d359d93 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 23 Mar 2017 08:21:00 -0400 Subject: Make SkImageCacherator be deferred (take 2) Split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors) This is a second pass at: https://skia-review.googlesource.com/c/9945/ (Make SkImageCacherator be deferred) Change-Id: I3451383eed497d1235686e8961087859c7c7bd30 Reviewed-on: https://skia-review.googlesource.com/10034 Reviewed-by: Robert Phillips Commit-Queue: Robert Phillips --- gm/image_pict.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'gm/image_pict.cpp') diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp index 883fd34725..792173ce66 100644 --- a/gm/image_pict.cpp +++ b/gm/image_pict.cpp @@ -344,12 +344,11 @@ protected: static void draw_as_tex(SkCanvas* canvas, SkImageCacherator* cache, SkScalar x, SkScalar y) { #if SK_SUPPORT_GPU sk_sp texColorSpace; - // MDB TODO: this should be lockAsTextureRef - sk_sp texture( - cache->lockAsTexture(canvas->getGrContext(), GrSamplerParams::ClampBilerp(), - canvas->imageInfo().colorSpace(), &texColorSpace, - nullptr, nullptr)); - if (!texture) { + sk_sp proxy( + cache->lockAsTextureProxy(canvas->getGrContext(), GrSamplerParams::ClampBilerp(), + canvas->imageInfo().colorSpace(), &texColorSpace, + nullptr, nullptr)); + if (!proxy) { // show placeholder if we have no texture SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); @@ -361,8 +360,6 @@ protected: return; } - sk_sp proxy = GrSurfaceProxy::MakeWrapped(std::move(texture)); - // No API to draw a GrTexture directly, so we cheat and create a private image subclass sk_sp image(new SkImage_Gpu(canvas->getGrContext(), cache->uniqueID(), kPremul_SkAlphaType, -- cgit v1.2.3