From f200a90f3e58ce20753420cadced850d7d00dca1 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Mon, 30 Jan 2017 13:27:37 -0500 Subject: Rationalize GrContext's Gr*Proxy getter naming This CL replaces the entry points: asDeferredSurface asDeferredTexture asDeferredRenderTarget with: GrSurfaceProxy* asSurfaceProxy sk_sp asSurfaceProxyRef GrTextureProxy* asTextureProxy sk_sp asTextureProxyRef GrRenderTargetProxy* asRenderTargetProxy sk_sp asRenderTargetProxyRef Change-Id: I7c2b1ea3d702023ff23019815ca13c9ff6f3b32d Reviewed-on: https://skia-review.googlesource.com/7741 Commit-Queue: Robert Phillips Reviewed-by: Brian Salomon --- include/gpu/GrRenderTargetContext.h | 15 ++++++++++----- include/gpu/GrSurfaceContext.h | 17 +++++++++++------ include/gpu/GrTextureContext.h | 13 +++++++++---- 3 files changed, 30 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/gpu/GrRenderTargetContext.h b/include/gpu/GrRenderTargetContext.h index 040e896b71..403de56f34 100644 --- a/include/gpu/GrRenderTargetContext.h +++ b/include/gpu/GrRenderTargetContext.h @@ -348,10 +348,15 @@ public: return fRenderTargetProxy->instantiate(fContext->textureProvider()); } - GrSurfaceProxy* asDeferredSurface() override { return fRenderTargetProxy.get(); } - const GrSurfaceProxy* asDeferredSurface() const override { return fRenderTargetProxy.get(); } - GrTextureProxy* asDeferredTexture() override; - GrRenderTargetProxy* asDeferredRenderTarget() override { return fRenderTargetProxy.get(); } + GrSurfaceProxy* asSurfaceProxy() override { return fRenderTargetProxy.get(); } + const GrSurfaceProxy* asSurfaceProxy() const override { return fRenderTargetProxy.get(); } + sk_sp asSurfaceProxyRef() override { return fRenderTargetProxy; } + + GrTextureProxy* asTextureProxy() override; + sk_sp asTextureProxyRef() override; + + GrRenderTargetProxy* asRenderTargetProxy() override { return fRenderTargetProxy.get(); } + sk_sp asRenderTargetProxyRef() override { return fRenderTargetProxy; } GrRenderTargetContext* asRenderTargetContext() override { return this; } @@ -362,7 +367,7 @@ public: // TODO: usage of this entry point needs to be reduced and potentially eliminated // since it ends the deferral of the GrRenderTarget's allocation - // It's usage should migrate to asDeferredTexture + // It's usage should migrate to asTextureProxyRef return sk_ref_sp(this->accessRenderTarget()->asTexture()); } diff --git a/include/gpu/GrSurfaceContext.h b/include/gpu/GrSurfaceContext.h index 43d6a10b62..8be63aba68 100644 --- a/include/gpu/GrSurfaceContext.h +++ b/include/gpu/GrSurfaceContext.h @@ -37,8 +37,8 @@ public: bool isGammaCorrect() const { return SkToBool(fColorSpace.get()); } // TODO: these two calls would be way cooler if this object had a GrSurfaceProxy pointer - int width() const { return this->asDeferredSurface()->width(); } - int height() const { return this->asDeferredSurface()->height(); } + int width() const { return this->asSurfaceProxy()->width(); } + int height() const { return this->asSurfaceProxy()->height(); } /* * Copy 'src' into the proxy backing this context @@ -96,10 +96,15 @@ public: } // TODO: this is virtual b.c. this object doesn't have a pointer to the wrapped GrSurfaceProxy? - virtual GrSurfaceProxy* asDeferredSurface() = 0; - virtual const GrSurfaceProxy* asDeferredSurface() const = 0; - virtual GrTextureProxy* asDeferredTexture() = 0; - virtual GrRenderTargetProxy* asDeferredRenderTarget() = 0; + virtual GrSurfaceProxy* asSurfaceProxy() = 0; + virtual const GrSurfaceProxy* asSurfaceProxy() const = 0; + virtual sk_sp asSurfaceProxyRef() = 0; + + virtual GrTextureProxy* asTextureProxy() = 0; + virtual sk_sp asTextureProxyRef() = 0; + + virtual GrRenderTargetProxy* asRenderTargetProxy() = 0; + virtual sk_sp asRenderTargetProxyRef() = 0; virtual GrRenderTargetContext* asRenderTargetContext() { return nullptr; } diff --git a/include/gpu/GrTextureContext.h b/include/gpu/GrTextureContext.h index 2ec8b4b78f..48a2e4842d 100644 --- a/include/gpu/GrTextureContext.h +++ b/include/gpu/GrTextureContext.h @@ -27,10 +27,15 @@ class SK_API GrTextureContext : public GrSurfaceContext { public: ~GrTextureContext() override; - GrSurfaceProxy* asDeferredSurface() override { return fTextureProxy.get(); } - const GrSurfaceProxy* asDeferredSurface() const override { return fTextureProxy.get(); } - GrTextureProxy* asDeferredTexture() override { return fTextureProxy.get(); } - GrRenderTargetProxy* asDeferredRenderTarget() override; + GrSurfaceProxy* asSurfaceProxy() override { return fTextureProxy.get(); } + const GrSurfaceProxy* asSurfaceProxy() const override { return fTextureProxy.get(); } + sk_sp asSurfaceProxyRef() override { return fTextureProxy; } + + GrTextureProxy* asTextureProxy() override { return fTextureProxy.get(); } + sk_sp asTextureProxyRef() override { return fTextureProxy; } + + GrRenderTargetProxy* asRenderTargetProxy() override; + sk_sp asRenderTargetProxyRef() override; protected: GrTextureContext(GrContext*, GrDrawingManager*, sk_sp, -- cgit v1.2.3