Add GrTextureProxyPriv

Several upcoming additions should go in here

Change-Id: I642f3c7cc36b1e6512ee0170640449e88a666d2c
Reviewed-on: https://skia-review.googlesource.com/52661
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2017-09-28 09:00:45 -04:00 committed by Skia Commit-Bot
parent 36dcd7f25d
commit 420c4cfcd7
4 changed files with 47 additions and 2 deletions

View File

@ -186,6 +186,7 @@ skia_gpu_sources = [
"$_src/gpu/GrTextureOpList.cpp",
"$_src/gpu/GrTextureOpList.h",
"$_src/gpu/GrTextureProxyCacheAccess.h",
"$_src/gpu/GrTextureProxyPriv.h",
"$_src/gpu/GrTracing.h",
"$_src/gpu/GrTestUtils.cpp",
"$_src/gpu/GrTestUtils.h",

View File

@ -332,8 +332,8 @@ public:
SkDEBUGCODE(void validate(GrContext*) const;)
// Provides access to functions that aren't part of the public API.
GrSurfaceProxyPriv priv();
const GrSurfaceProxyPriv priv() const;
inline GrSurfaceProxyPriv priv();
inline const GrSurfaceProxyPriv priv() const;
protected:
// Deferred version

View File

@ -15,6 +15,7 @@ class GrCaps;
class GrResourceCache;
class GrResourceProvider;
class GrTextureOpList;
class GrTextureProxyPriv;
// This class delays the acquisition of textures until they are actually required
class GrTextureProxy : virtual public GrSurfaceProxy {
@ -62,6 +63,10 @@ public:
inline CacheAccess cacheAccess();
inline const CacheAccess cacheAccess() const;
// Provides access to special purpose functions.
GrTextureProxyPriv texPriv();
const GrTextureProxyPriv texPriv() const;
protected:
friend class GrSurfaceProxy; // for ctors

View File

@ -0,0 +1,39 @@
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrTextureProxyPriv_DEFINED
#define GrTextureProxyPriv_DEFINED
#include "GrTextureProxy.h"
/**
* This class hides the more specialized capabilities of GrTextureProxy.
*/
class GrTextureProxyPriv {
public:
private:
explicit GrTextureProxyPriv(GrTextureProxy* textureProxy) : fTextureProxy(textureProxy) {}
GrTextureProxyPriv(const GrTextureProxyPriv&) {} // unimpl
GrTextureProxyPriv& operator=(const GrTextureProxyPriv&); // unimpl
// No taking addresses of this type.
const GrTextureProxyPriv* operator&() const;
GrTextureProxyPriv* operator&();
GrTextureProxy* fTextureProxy;
friend class GrTextureProxy; // to construct/copy this type.
};
inline GrTextureProxyPriv GrTextureProxy::texPriv() { return GrTextureProxyPriv(this); }
inline const GrTextureProxyPriv GrTextureProxy::texPriv() const {
return GrTextureProxyPriv(const_cast<GrTextureProxy*>(this));
}
#endif