aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-03-21 08:48:40 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-21 19:38:55 +0000
commitbbd7a3be407ce94fcc4f8b1eb475de8b6f49026e (patch)
tree8d2aabdf69316d15483e0af8f86d44c64a2c1a4f /src/gpu
parent7322b52e616a6cec2ed0e88456c4b43f944b8b69 (diff)
Make experimental Perlin noise shader take texture proxies
This is split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors) Change-Id: I18c444981f5c72e9688866e045c90844bc4945b1 Reviewed-on: https://skia-review.googlesource.com/9917 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGr.cpp15
-rw-r--r--src/gpu/SkGr.h5
2 files changed, 16 insertions, 4 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 18f2abb951..18611edad3 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -308,6 +308,17 @@ GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
nullptr, scaleAdjust);
}
+sk_sp<GrTextureProxy> GrRefCachedBitmapTextureProxy(GrContext* ctx,
+ const SkBitmap& bitmap,
+ const GrSamplerParams& params,
+ SkScalar scaleAdjust[2]) {
+ // Caller doesn't care about the texture's color space (they can always get it from the bitmap)
+ sk_sp<GrTexture> tex(GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, nullptr,
+ nullptr,
+ scaleAdjust));
+ return GrSurfaceProxy::MakeWrapped(std::move(tex));
+}
+
sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrResourceProvider* resourceProvider,
const SkBitmap& bitmap) {
GrUniqueKey originalKey;
@@ -332,10 +343,6 @@ sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrResourceProvider* resourceProvid
}
}
- if (!proxy) {
- return nullptr;
- }
-
return proxy;
}
diff --git a/src/gpu/SkGr.h b/src/gpu/SkGr.h
index 993bf839bb..c8990b6a0a 100644
--- a/src/gpu/SkGr.h
+++ b/src/gpu/SkGr.h
@@ -207,6 +207,11 @@ GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10);
GrTexture* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&,
const GrSamplerParams&, SkScalar scaleAdjust[2]);
+sk_sp<GrTextureProxy> GrRefCachedBitmapTextureProxy(GrContext*,
+ const SkBitmap&,
+ const GrSamplerParams&,
+ SkScalar scaleAdjust[2]);
+
/**
* Creates a new texture for the bitmap. Does not concern itself with cache keys or texture params.
* The bitmap must have CPU-accessible pixels. Attempts to take advantage of faster paths for