diff options
author | Greg Daniel <egdaniel@google.com> | 2018-04-06 09:27:20 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-06 14:42:23 +0000 |
commit | 9ca3065ca5bac6cc45c0ea5de23aebab92282227 (patch) | |
tree | f0cb50532b33281d2cccf414403f1a837cf52891 | |
parent | a39991ebd70f4aaf1290dd516467d729811e45ee (diff) |
Don't use GrPixelConfig value as proxy for valid on GrBackendSurface.
Bug: skia:
Change-Id: I275b74b915240c9918bb2efa6a9708341f3bb189
Reviewed-on: https://skia-review.googlesource.com/119004
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
-rw-r--r-- | include/gpu/GrBackendSurface.h | 10 | ||||
-rw-r--r-- | src/gpu/GrBackendSurface.cpp | 24 |
2 files changed, 22 insertions, 12 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index 8d7886ee14..f0d716cad0 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -100,7 +100,7 @@ private: class SK_API GrBackendTexture { public: // Creates an invalid backend texture. - GrBackendTexture() : fConfig(kUnknown_GrPixelConfig) {} + GrBackendTexture() : fIsValid(false) {} #if GR_TEST_UTILS // GrGLTextureInfo::fFormat is ignored @@ -156,7 +156,7 @@ public: const GrMockTextureInfo* getMockTextureInfo() const; // Returns true if the backend texture has been initialized. - bool isValid() const { return fConfig != kUnknown_GrPixelConfig; } + bool isValid() const { return fIsValid; } /** * Create a GrBackendFormat object that matches this texture @@ -182,6 +182,7 @@ private: GrPixelConfig config() const { return fConfig; } + bool fIsValid; int fWidth; //<! width in pixels int fHeight; //<! height in pixels GrPixelConfig fConfig; @@ -200,7 +201,7 @@ private: class SK_API GrBackendRenderTarget { public: // Creates an invalid backend texture. - GrBackendRenderTarget() : fConfig(kUnknown_GrPixelConfig) {} + GrBackendRenderTarget() : fIsValid(false) {} #if GR_TEST_UTILS // GrGLTextureInfo::fFormat is ignored @@ -255,7 +256,7 @@ public: const GrMockRenderTargetInfo* getMockRenderTargetInfo() const; // Returns true if the backend texture has been initialized. - bool isValid() const { return fConfig != kUnknown_GrPixelConfig; } + bool isValid() const { return fIsValid; } #if GR_TEST_UTILS @@ -274,6 +275,7 @@ private: friend class GrVkGpu; GrPixelConfig config() const { return fConfig; } + bool fIsValid; int fWidth; //<! width in pixels int fHeight; //<! height in pixels diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp index 97b4d64706..5832fa6e0a 100644 --- a/src/gpu/GrBackendSurface.cpp +++ b/src/gpu/GrBackendSurface.cpp @@ -67,7 +67,8 @@ const GrPixelConfig* GrBackendFormat::getMockFormat() const { GrBackendTexture::GrBackendTexture(int width, int height, const GrVkImageInfo& vkInfo) - : fWidth(width) + : fIsValid(true) + , fWidth(width) , fHeight(height) , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat)) , fMipMapped(GrMipMapped(vkInfo.fLevelCount > 1)) @@ -88,7 +89,8 @@ GrBackendTexture::GrBackendTexture(int width, GrPixelConfig config, GrMipMapped mipMapped, const GrGLTextureInfo& glInfo) - : fWidth(width) + : fIsValid(true) + , fWidth(width) , fHeight(height) , fConfig(config) , fMipMapped(mipMapped) @@ -100,7 +102,8 @@ GrBackendTexture::GrBackendTexture(int width, int height, GrMipMapped mipMapped, const GrGLTextureInfo& glInfo) - : fWidth(width) + : fIsValid(true) + , fWidth(width) , fHeight(height) , fConfig(GrGLSizedFormatToPixelConfig(glInfo.fFormat)) , fMipMapped(mipMapped) @@ -111,7 +114,8 @@ GrBackendTexture::GrBackendTexture(int width, int height, GrMipMapped mipMapped, const GrMockTextureInfo& mockInfo) - : fWidth(width) + : fIsValid(true) + , fWidth(width) , fHeight(height) , fConfig(mockInfo.fConfig) , fMipMapped(mipMapped) @@ -217,7 +221,8 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, int height, int sampleCnt, const GrVkImageInfo& vkInfo) - : fWidth(width) + : fIsValid(true) + , fWidth(width) , fHeight(height) , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(0) // We always create stencil buffers internally for vulkan @@ -234,7 +239,8 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, int stencilBits, GrPixelConfig config, const GrGLFramebufferInfo& glInfo) - : fWidth(width) + : fIsValid(true) + , fWidth(width) , fHeight(height) , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(stencilBits) @@ -248,7 +254,8 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, int sampleCnt, int stencilBits, const GrGLFramebufferInfo& glInfo) - : fWidth(width) + : fIsValid(true) + , fWidth(width) , fHeight(height) , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(stencilBits) @@ -261,7 +268,8 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, int sampleCnt, int stencilBits, const GrMockRenderTargetInfo& mockInfo) - : fWidth(width) + : fIsValid(true) + , fWidth(width) , fHeight(height) , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(stencilBits) |