aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-11-09 06:50:43 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-09 12:20:50 +0000
commit3743013f755d23c215d852af7d829c3cd74f34a2 (patch)
treef685cc82d3dc40153863552b55c2519582c84d15 /include
parent7b8400dad2f82dcc6ed3c7cc1707ebaf85f04840 (diff)
Consolidate GrSurfaceProxy Make methods
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>
Diffstat (limited to 'include')
-rw-r--r--include/private/GrRenderTargetProxy.h11
-rw-r--r--include/private/GrSurfaceProxy.h17
-rw-r--r--include/private/GrTextureProxy.h11
-rw-r--r--include/private/GrTextureRenderTargetProxy.h11
4 files changed, 24 insertions, 26 deletions
diff --git a/include/private/GrRenderTargetProxy.h b/include/private/GrRenderTargetProxy.h
index 267d7549e3..3c2597b97e 100644
--- a/include/private/GrRenderTargetProxy.h
+++ b/include/private/GrRenderTargetProxy.h
@@ -20,13 +20,6 @@ class GrTextureProvider;
// the uniqueID of the RenderTarget it represents!
class GrRenderTargetProxy : virtual public GrSurfaceProxy {
public:
- /**
- * The caller gets the creation ref.
- */
- static sk_sp<GrRenderTargetProxy> Make(const GrCaps&, const GrSurfaceDesc&,
- SkBackingFit, SkBudgeted);
- static sk_sp<GrRenderTargetProxy> Make(sk_sp<GrRenderTarget>);
-
GrRenderTargetProxy* asRenderTargetProxy() override { return this; }
const GrRenderTargetProxy* asRenderTargetProxy() const override { return this; }
@@ -65,11 +58,13 @@ public:
SkDEBUGCODE(void validate(GrContext*) const;)
protected:
+ friend class GrSurfaceProxy; // for ctors
+
// Deferred version
GrRenderTargetProxy(const GrCaps&, const GrSurfaceDesc&, SkBackingFit, SkBudgeted);
// Wrapped version
- GrRenderTargetProxy(sk_sp<GrRenderTarget> rt);
+ GrRenderTargetProxy(sk_sp<GrSurface>);
private:
size_t onGpuMemorySize() const override;
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 539aaf65aa..1e846c5223 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -12,10 +12,12 @@
#include "GrSurface.h"
#include "SkRect.h"
+class GrCaps;
class GrOpList;
class GrTextureProvider;
class GrTextureProxy;
class GrRenderTargetProxy;
+class GrTextureProvider;
// This class replicates the functionality GrIORef<GrSurface> but tracks the
// utilitization for later resource allocation (for the deferred case) and
@@ -75,6 +77,17 @@ protected:
class GrSurfaceProxy : public GrIORefProxy {
public:
+ static sk_sp<GrSurfaceProxy> MakeWrapped(sk_sp<GrSurface>);
+
+ static sk_sp<GrSurfaceProxy> MakeDeferred(const GrCaps&, const GrSurfaceDesc&,
+ SkBackingFit, SkBudgeted);
+
+ // TODO: need to refine ownership semantics of 'srcData' if we're in completely
+ // deferred mode
+ static sk_sp<GrSurfaceProxy> MakeDeferred(const GrCaps&, GrTextureProvider*,
+ const GrSurfaceDesc&, SkBudgeted,
+ const void* srcData, size_t rowBytes);
+
const GrSurfaceDesc& desc() const { return fDesc; }
GrSurfaceOrigin origin() const {
@@ -88,6 +101,8 @@ public:
uint32_t uniqueID() const { return fUniqueID; }
+ GrSurface* instantiate(GrTextureProvider* texProvider);
+
/**
* Helper that gets the width and height of the surface as a bounding rectangle.
*/
@@ -146,8 +161,6 @@ protected:
virtual ~GrSurfaceProxy();
- GrSurface* instantiate(GrTextureProvider* texProvider);
-
// For wrapped resources, 'fDesc' will always be filled in from the wrapped resource.
const GrSurfaceDesc fDesc;
const SkBackingFit fFit; // always exact for wrapped resources
diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h
index 75f09de800..a206e76e37 100644
--- a/include/private/GrTextureProxy.h
+++ b/include/private/GrTextureProxy.h
@@ -17,13 +17,6 @@ class GrTextureProvider;
// This class delays the acquisition of textures until they are actually required
class GrTextureProxy : virtual public GrSurfaceProxy {
public:
- // TODO: need to refine ownership semantics of 'srcData' if we're in completely
- // deferred mode
- static sk_sp<GrTextureProxy> Make(const GrCaps&, GrTextureProvider*, const GrSurfaceDesc&,
- SkBackingFit, SkBudgeted,
- const void* srcData = nullptr, size_t rowBytes = 0);
- static sk_sp<GrTextureProxy> Make(sk_sp<GrTexture>);
-
GrTextureProxy* asTextureProxy() override { return this; }
const GrTextureProxy* asTextureProxy() const override { return this; }
@@ -31,11 +24,13 @@ public:
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<GrTexture> tex);
+ GrTextureProxy(sk_sp<GrSurface>);
private:
size_t onGpuMemorySize() const override;
diff --git a/include/private/GrTextureRenderTargetProxy.h b/include/private/GrTextureRenderTargetProxy.h
index c4d190f94d..b3a9a239fc 100644
--- a/include/private/GrTextureRenderTargetProxy.h
+++ b/include/private/GrTextureRenderTargetProxy.h
@@ -22,19 +22,14 @@
// Beware: the uniqueID of the TextureRenderTargetProxy will usually be different than
// the uniqueID of the RenderTarget/Texture it represents!
class GrTextureRenderTargetProxy : public GrTextureProxy, public GrRenderTargetProxy {
-public:
- static sk_sp<GrTextureRenderTargetProxy> Make(const GrCaps&,
- const GrSurfaceDesc&,
- SkBackingFit, SkBudgeted);
- static sk_sp<GrTextureRenderTargetProxy> Make(sk_sp<GrTexture>);
- static sk_sp<GrTextureRenderTargetProxy> Make(sk_sp<GrRenderTarget>);
-
private:
+ friend class GrSurfaceProxy; // for ctors
+
// Deferred version
GrTextureRenderTargetProxy(const GrCaps&, const GrSurfaceDesc&, SkBackingFit, SkBudgeted);
// Wrapped version
- GrTextureRenderTargetProxy(sk_sp<GrRenderTarget> rt);
+ GrTextureRenderTargetProxy(sk_sp<GrSurface>);
size_t onGpuMemorySize() const override;
};