diff options
author | 2018-02-13 10:20:13 -0500 | |
---|---|---|
committer | 2018-02-13 16:03:50 +0000 | |
commit | d76e56d93c27856b10d6636882a5ffcd79a9d967 (patch) | |
tree | e20c54f11793cfbc57fa4b878d95931ae80a020d /include/private | |
parent | 366093f2124c38fa5c590c9ed2d1811817fed8ee (diff) |
Add SkCharacterization creation helper to GrContextThreadSafeProxy
Change-Id: I8ad7cf335f2b586cf501eaa70573690fbbd53efa
Reviewed-on: https://skia-review.googlesource.com/106105
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include/private')
-rw-r--r-- | include/private/SkSurfaceCharacterization.h | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/include/private/SkSurfaceCharacterization.h b/include/private/SkSurfaceCharacterization.h index 9e5f40df64..48c22351b3 100644 --- a/include/private/SkSurfaceCharacterization.h +++ b/include/private/SkSurfaceCharacterization.h @@ -36,8 +36,7 @@ public: enum class MipMapped : bool { kNo = false, kYes = true }; SkSurfaceCharacterization() - : fCacheMaxResourceCount(0) - , fCacheMaxResourceBytes(0) + : fCacheMaxResourceBytes(0) , fOrigin(kBottomLeft_GrSurfaceOrigin) , fWidth(0) , fHeight(0) @@ -56,9 +55,10 @@ public: SkSurfaceCharacterization& operator=(const SkSurfaceCharacterization& other) = default; GrContextThreadSafeProxy* contextInfo() const { return fContextInfo.get(); } - int cacheMaxResourceCount() const { return fCacheMaxResourceCount; } size_t cacheMaxResourceBytes() const { return fCacheMaxResourceBytes; } + bool isValid() const { return kUnknown_GrPixelConfig != fConfig; } + GrSurfaceOrigin origin() const { return fOrigin; } int width() const { return fWidth; } int height() const { return fHeight; } @@ -73,9 +73,30 @@ public: private: friend class SkSurface_Gpu; // for 'set' + friend class GrContextThreadSafeProxy; // for private ctor + + SkSurfaceCharacterization(sk_sp<GrContextThreadSafeProxy> contextInfo, + size_t cacheMaxResourceBytes, + GrSurfaceOrigin origin, int width, int height, + GrPixelConfig config, GrFSAAType FSAAType, int stencilCnt, + Textureable isTextureable, MipMapped isMipMapped, + sk_sp<SkColorSpace> colorSpace, + const SkSurfaceProps& surfaceProps) + : fContextInfo(std::move(contextInfo)) + , fCacheMaxResourceBytes(cacheMaxResourceBytes) + , fOrigin(origin) + , fWidth(width) + , fHeight(height) + , fConfig(config) + , fFSAAType(FSAAType) + , fStencilCnt(stencilCnt) + , fIsTextureable(isTextureable) + , fIsMipMapped(isMipMapped) + , fColorSpace(std::move(colorSpace)) + , fSurfaceProps(surfaceProps) { + } void set(sk_sp<GrContextThreadSafeProxy> contextInfo, - int cacheMaxResourceCount, size_t cacheMaxResourceBytes, GrSurfaceOrigin origin, int width, int height, @@ -89,7 +110,6 @@ private: SkASSERT(MipMapped::kNo == isMipMapped || Textureable::kYes == isTextureable); fContextInfo = contextInfo; - fCacheMaxResourceCount = cacheMaxResourceCount; fCacheMaxResourceBytes = cacheMaxResourceBytes; fOrigin = origin; @@ -105,7 +125,6 @@ private: } sk_sp<GrContextThreadSafeProxy> fContextInfo; - int fCacheMaxResourceCount; size_t fCacheMaxResourceBytes; GrSurfaceOrigin fOrigin; @@ -130,6 +149,8 @@ public: , fSurfaceProps(0, kUnknown_SkPixelGeometry) { } + bool isValid() const { return false; } + int width() const { return fWidth; } int height() const { return fHeight; } SkColorSpace* colorSpace() const { return fColorSpace.get(); } |