diff options
author | 2018-05-10 12:57:17 -0400 | |
---|---|---|
committer | 2018-05-10 19:14:16 +0000 | |
commit | 52aacd602f792a01218ca903759f6b9d4ec28450 (patch) | |
tree | ec5a18a5f4493fcbfe785777d02bbe8d7149ca2d /include | |
parent | ce4cf72e3487f661e53f6d0c3416c9b58da4fd00 (diff) |
Add GrContextThreadSafeProxy and remove most friends of GrContextThreadSafeProxy
A step towards removing GrCaps from GrContext.h
Also adds operator== to GrContextThreadSafeProxy.
Change-Id: Ic0bae12299dfb0ac8817d9f1c56a1219d6df97d9
Reviewed-on: https://skia-review.googlesource.com/127329
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkSurfaceCharacterization.h | 19 | ||||
-rw-r--r-- | include/gpu/GrContext.h | 18 |
2 files changed, 14 insertions, 23 deletions
diff --git a/include/core/SkSurfaceCharacterization.h b/include/core/SkSurfaceCharacterization.h index e8efdcf2a9..2abd5b6555 100644 --- a/include/core/SkSurfaceCharacterization.h +++ b/include/core/SkSurfaceCharacterization.h @@ -54,24 +54,7 @@ public: return !(*this == other); } - SkSurfaceCharacterization createResized(int width, int height) const { - const GrCaps* caps = fContextInfo->caps(); - if (!caps) { - return SkSurfaceCharacterization(); - } - - if (width <= 0 || height <= 0 || - width > caps->maxRenderTargetSize() || height > caps->maxRenderTargetSize()) { - return SkSurfaceCharacterization(); - } - - return SkSurfaceCharacterization(fContextInfo, - fCacheMaxResourceBytes, - fImageInfo.makeWH(width, height), - fOrigin, fConfig, fFSAAType, fStencilCnt, - fIsTextureable, fIsMipMapped, fUsesGLFBO0, - fSurfaceProps); - } + SkSurfaceCharacterization createResized(int width, int height) const; GrContextThreadSafeProxy* contextInfo() const { return fContextInfo.get(); } sk_sp<GrContextThreadSafeProxy> refContextInfo() const { return fContextInfo; } diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 1acd30c127..89e805286e 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -21,6 +21,7 @@ class GrBackendFormat; class GrBackendSemaphore; class GrContextPriv; class GrContextThreadSafeProxy; +class GrContextThreadSafeProxyPriv; class GrDrawingManager; struct GrDrawOpAtlasConfig; class GrFragmentProcessor; @@ -398,8 +399,17 @@ public: const SkSurfaceProps& surfaceProps, bool isMipMapped, bool willUseGLFBO0 = false); - const GrCaps* caps() const { return fCaps.get(); } - sk_sp<const GrCaps> refCaps() const { return fCaps; } + bool operator==(const GrContextThreadSafeProxy& that) const { + // Each GrContext should only ever have a single thread-safe proxy. + SkASSERT((this == &that) == (fContextUniqueID == that.fContextUniqueID)); + return this == &that; + } + + bool operator!=(const GrContextThreadSafeProxy& that) const { return !(*this == that); } + + // Provides access to functions that aren't part of the public API. + GrContextThreadSafeProxyPriv priv(); + const GrContextThreadSafeProxyPriv priv() const; private: // DDL TODO: need to add unit tests for backend & maybe options @@ -419,9 +429,7 @@ private: const GrContextOptions fOptions; friend class GrDirectContext; // To construct this object - friend class GrContextPriv; // for access to 'fOptions' in MakeDDL - friend class GrDDLContext; // to implement the GrDDLContext ctor (access to all members) - friend class SkSurfaceCharacterization; // for access to 'fContextUniqueID' for operator== + friend class GrContextThreadSafeProxyPriv; typedef SkRefCnt INHERITED; }; |