Make rest of GrGpu::wrapBackend* methods take a GrColorType (take 2)
This CL is intended to further wean Ganesh off of using the GrBackendTexture's pixel config
TBR=bsalomon@google.com
Bug: skia:6718
Change-Id: Iedaa7811f9c4aac552f219c702627bc476325317
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228338
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index 5de09e7..d45d334 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -174,22 +174,23 @@
return nullptr;
}
-sk_sp<GrTexture> GrMockGpu::onWrapBackendTexture(const GrBackendTexture& tex,
+sk_sp<GrTexture> GrMockGpu::onWrapBackendTexture(const GrBackendTexture& tex, GrColorType colorType,
GrWrapOwnership ownership,
GrWrapCacheable wrapType, GrIOType ioType) {
- GrMockTextureInfo info;
- SkAssertResult(tex.getMockTextureInfo(&info));
+ GrMockTextureInfo texInfo;
+ SkAssertResult(tex.getMockTextureInfo(&texInfo));
+ SkASSERT(colorType == texInfo.fColorType);
GrSurfaceDesc desc;
desc.fWidth = tex.width();
desc.fHeight = tex.height();
- desc.fConfig = info.pixelConfig();
+ desc.fConfig = texInfo.pixelConfig();
GrMipMapsStatus mipMapsStatus = tex.hasMipMaps() ? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
auto isProtected = GrProtected(tex.isProtected());
return sk_sp<GrTexture>(
- new GrMockTexture(this, desc, isProtected, mipMapsStatus, info, wrapType, ioType));
+ new GrMockTexture(this, desc, isProtected, mipMapsStatus, texInfo, wrapType, ioType));
}
sk_sp<GrTexture> GrMockGpu::onWrapRenderableBackendTexture(const GrBackendTexture& tex,
@@ -217,10 +218,12 @@
this, desc, sampleCnt, isProtected, mipMapsStatus, texInfo, rtInfo, cacheable));
}
-sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& rt) {
+sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& rt,
+ GrColorType colorType) {
GrMockRenderTargetInfo info;
SkAssertResult(rt.getMockRenderTargetInfo(&info));
+ SkASSERT(colorType == info.colorType());
GrSurfaceDesc desc;
desc.fWidth = rt.width();
desc.fHeight = rt.height();
@@ -232,10 +235,12 @@
}
sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
- int sampleCnt) {
+ int sampleCnt,
+ GrColorType colorType) {
GrMockTextureInfo texInfo;
SkAssertResult(tex.getMockTextureInfo(&texInfo));
+ SkASSERT(colorType == texInfo.fColorType);
GrSurfaceDesc desc;
desc.fWidth = tex.width();
desc.fHeight = tex.height();