diff options
author | Robert Phillips <robertphillips@google.com> | 2018-02-13 10:20:13 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-13 16:03:50 +0000 |
commit | d76e56d93c27856b10d6636882a5ffcd79a9d967 (patch) | |
tree | e20c54f11793cfbc57fa4b878d95931ae80a020d /src/gpu/mock | |
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 'src/gpu/mock')
-rw-r--r-- | src/gpu/mock/GrMockCaps.h | 20 | ||||
-rw-r--r-- | src/gpu/mock/GrMockGpu.cpp | 2 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h index 1e448516d7..d96a690b31 100644 --- a/src/gpu/mock/GrMockCaps.h +++ b/src/gpu/mock/GrMockCaps.h @@ -72,8 +72,14 @@ public: } bool validateBackendTexture(const GrBackendTexture& tex, SkColorType, - GrPixelConfig*) const override { - return SkToBool(tex.getMockTextureInfo()); + GrPixelConfig* config) const override { + const GrMockTextureInfo* texInfo = tex.getMockTextureInfo(); + if (!texInfo) { + return false; + } + + *config = texInfo->fConfig; + return true; } bool validateBackendRenderTarget(const GrBackendRenderTarget& rt, SkColorType, @@ -81,6 +87,16 @@ public: return false; } + bool getConfigFromBackendFormat(const GrBackendFormat& format, SkColorType ct, + GrPixelConfig* config) const override { + const GrPixelConfig* mockFormat = format.getMockFormat(); + if (!mockFormat) { + return false; + } + *config = *mockFormat; + return true; + } + private: static const int kMaxSampleCnt = 16; diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp index da6b21aea0..9d1661be44 100644 --- a/src/gpu/mock/GrMockGpu.cpp +++ b/src/gpu/mock/GrMockGpu.cpp @@ -69,6 +69,7 @@ sk_sp<GrTexture> GrMockGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgete GrMipMapsStatus mipMapsStatus = mipLevelCount > 1 ? GrMipMapsStatus::kValid : GrMipMapsStatus::kNotAllocated; GrMockTextureInfo info; + info.fConfig = desc.fConfig; info.fID = NextInternalTextureID(); if (desc.fFlags & kRenderTarget_GrSurfaceFlag) { return sk_sp<GrTexture>( @@ -94,6 +95,7 @@ GrBackendTexture GrMockGpu::createTestingOnlyBackendTexture(void* pixels, int w, GrPixelConfig config, bool isRT, GrMipMapped) { GrMockTextureInfo info; + info.fConfig = config; info.fID = NextExternalTextureID(); fOutstandingTestingOnlyTextureIDs.add(info.fID); return GrBackendTexture(w, h, config, info); |