diff options
author | Robert Phillips <robertphillips@google.com> | 2018-01-17 11:40:14 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-17 17:04:26 +0000 |
commit | 777707be8445b7d2f9cb235cd040cd1994dd2996 (patch) | |
tree | 3b7ee9039c39b1c77e75e6a880210f5a856a146b /src/gpu/GrProxyProvider.h | |
parent | 95379ebc0dfa6fe5af14dbebe251aec43c5ce919 (diff) |
Move GrSurfaceProxy::MakeLazy to GrProxyProvider::createLazy
This is pretty much a straight up move of the GrSurfaceProxy code with some plumbing to get the ProxyProvider in the right places.
Change-Id: I63cecb242dada503f97dbd1c0ce7ede75323100d
Reviewed-on: https://skia-review.googlesource.com/94200
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrProxyProvider.h')
-rw-r--r-- | src/gpu/GrProxyProvider.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h index 1150c794a6..4c93886da6 100644 --- a/src/gpu/GrProxyProvider.h +++ b/src/gpu/GrProxyProvider.h @@ -87,7 +87,6 @@ public: SkDestinationSurfaceColorMode mipColorMode = SkDestinationSurfaceColorMode::kLegacy); - /* * Create a mipmapped texture proxy without any data. * @@ -128,6 +127,30 @@ public: GrSurfaceOrigin origin, int sampleCnt); + using LazyInstantiateCallback = std::function<sk_sp<GrTexture>(GrResourceProvider*, + GrSurfaceOrigin* outOrigin)>; + + enum class Renderable : bool { + kNo = false, + kYes = true + }; + + /** + * Creates a texture proxy that will be instantiated by a user-supplied callback during flush. + * (Stencil is not supported by this method.) The width and height must either both be greater + * than 0 or both less than or equal to zero. A non-positive value is a signal that the width + * and height are currently unknown. + * + * When called, the callback must be able to cleanup any resources that it captured at creation. + * It also must support being passed in a null GrResourceProvider. When this happens, the + * callback should cleanup any resources it captured and return an empty sk_sp<GrTextureProxy>. + */ + sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&, const GrSurfaceDesc&, + GrMipMapped, SkBackingFit, SkBudgeted); + + sk_sp<GrTextureProxy> createFullyLazyProxy(LazyInstantiateCallback&&, + Renderable, GrPixelConfig); + // 'proxy' is about to be used as a texture src or drawn to. This query can be used to // determine if it is going to need a texture domain or a full clear. static bool IsFunctionallyExact(GrSurfaceProxy* proxy); |