3743013f75
I think GrSurfaceDesc is still the most compact way to communicate the deferred GrSurface's settings to the Proxy but this CL, at least, reduces where it is used. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4559 Change-Id: Ica599c28a5aef1ed4094f47a4ac119e2d204d652 Reviewed-on: https://skia-review.googlesource.com/4559 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
/*
|
|
* 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 GrCaps;
|
|
class GrTextureProvider;
|
|
|
|
// This class delays the acquisition of textures until they are actually required
|
|
class GrTextureProxy : virtual public GrSurfaceProxy {
|
|
public:
|
|
GrTextureProxy* asTextureProxy() override { return this; }
|
|
const GrTextureProxy* asTextureProxy() const override { return this; }
|
|
|
|
// Actually instantiate the backing texture, if necessary
|
|
GrTexture* instantiate(GrTextureProvider*);
|
|
|
|
protected:
|
|
friend class GrSurfaceProxy; // for ctors
|
|
|
|
// Deferred version
|
|
GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit, SkBudgeted,
|
|
const void* srcData, size_t srcRowBytes);
|
|
// Wrapped version
|
|
GrTextureProxy(sk_sp<GrSurface>);
|
|
|
|
private:
|
|
size_t onGpuMemorySize() const override;
|
|
|
|
// For wrapped proxies the GrTexture pointer is stored in GrIORefProxy.
|
|
// For deferred proxies that pointer will be filled n when we need to instantiate
|
|
// the deferred resource
|
|
|
|
typedef GrSurfaceProxy INHERITED;
|
|
};
|
|
|
|
#endif
|