| Index: include/gpu/GrTextureProxy.h
|
| diff --git a/include/gpu/GrTextureProxy.h b/include/gpu/GrTextureProxy.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cb58f4b7fa6d565463f2f87454b8b236757988f8
|
| --- /dev/null
|
| +++ b/include/gpu/GrTextureProxy.h
|
| @@ -0,0 +1,50 @@
|
| +/*
|
| + * Copyright 2016 Google Inc.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +
|
| +#ifndef GrTextureProxy_DEFINED
|
| +#define GrTextureProxy_DEFINED
|
| +
|
| +#include "GrSurfaceProxy.h"
|
| +#include "GrTexture.h"
|
| +
|
| +class GrTextureProvider;
|
| +
|
| +// This class delays the acquisition of textures until they are actually required
|
| +class GrTextureProxy : public GrSurfaceProxy {
|
| +public:
|
| + // TODO: need to refine ownership semantics of 'srcData' if we're in completely
|
| + // deferred mode
|
| + static sk_sp<GrTextureProxy> Make(const GrSurfaceDesc&, BackingFit, SkBudgeted,
|
| + const void* srcData = nullptr, size_t rowBytes = 0);
|
| + static sk_sp<GrTextureProxy> Make(sk_sp<GrTexture>);
|
| +
|
| + // TODO: add asRenderTargetProxy variants
|
| + GrTextureProxy* asTextureProxy() override { return this; }
|
| + const GrTextureProxy* asTextureProxy() const override { return this; }
|
| +
|
| + // Actually instantiate the backing texture, if necessary
|
| + GrTexture* instantiate(GrTextureProvider* texProvider);
|
| +
|
| +private:
|
| + GrTextureProxy(const GrSurfaceDesc& desc, BackingFit fit, SkBudgeted budgeted,
|
| + const void* srcData, size_t rowBytes)
|
| + : INHERITED(desc, fit, budgeted) {
|
| + // TODO: Handle 'srcData' here
|
| + SkASSERT(!srcData && !rowBytes);
|
| + }
|
| +
|
| + // Wrapped version
|
| + GrTextureProxy(sk_sp<GrTexture> tex);
|
| +
|
| + // For wrapped textures we store it here.
|
| + // For deferred proxies we will fill this in when we need to instantiate the deferred resource
|
| + sk_sp<GrTexture> fTexture;
|
| +
|
| + typedef GrSurfaceProxy INHERITED;
|
| +};
|
| +
|
| +#endif
|
|
|