aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mock
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-02-13 17:03:00 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-14 12:42:18 +0000
commitfc711a2b0143aa4f559ef041068af1c04d7dab85 (patch)
tree3cd87b121b87566b9837112badccd5aa958f75f5 /src/gpu/mock
parent6ce969472e2ede1e3d6549579c095a12c2d576ca (diff)
Add SkCharacterization creation helper to GrContextThreadSafeProxy (take 2)
TBR=bsalomon@google.com Change-Id: Id96d4fdbb6889065f10a4a7e0c22a03ad9aa5fef Reviewed-on: https://skia-review.googlesource.com/107000 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/mock')
-rw-r--r--src/gpu/mock/GrMockCaps.h20
-rw-r--r--src/gpu/mock/GrMockGpu.cpp2
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);