Move GrProtected off GrSurfaceDesc and pass separately.
Change-Id: If628c13bb0e5aa885e4249a37432ba572e65d920
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228440
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index e6f0a62..354b381 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -86,8 +86,8 @@
}
sk_sp<GrTexture> GrMockGpu::onCreateTexture(const GrSurfaceDesc& desc, GrRenderable renderable,
- SkBudgeted budgeted, const GrMipLevel texels[],
- int mipLevelCount) {
+ SkBudgeted budgeted, GrProtected isProtected,
+ const GrMipLevel texels[], int mipLevelCount) {
if (fMockOptions.fFailTextureAllocations) {
return nullptr;
}
@@ -102,10 +102,11 @@
GrMockTextureInfo texInfo(ct, NextInternalTextureID());
if (renderable == GrRenderable::kYes) {
GrMockRenderTargetInfo rtInfo(ct, NextInternalRenderTargetID());
- return sk_sp<GrTexture>(new GrMockTextureRenderTarget(this, budgeted, desc, mipMapsStatus,
- texInfo, rtInfo));
+ return sk_sp<GrTexture>(new GrMockTextureRenderTarget(this, budgeted, desc, isProtected,
+ mipMapsStatus, texInfo, rtInfo));
}
- return sk_sp<GrTexture>(new GrMockTexture(this, budgeted, desc, mipMapsStatus, texInfo));
+ return sk_sp<GrTexture>(
+ new GrMockTexture(this, budgeted, desc, isProtected, mipMapsStatus, texInfo));
}
sk_sp<GrTexture> GrMockGpu::onCreateCompressedTexture(int width, int height,
@@ -127,8 +128,9 @@
GrMipMapsStatus mipMapsStatus = tex.hasMipMaps() ? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
-
- return sk_sp<GrTexture>(new GrMockTexture(this, desc, mipMapsStatus, info, wrapType, ioType));
+ auto isProtected = GrProtected(tex.isProtected());
+ return sk_sp<GrTexture>(
+ new GrMockTexture(this, desc, isProtected, mipMapsStatus, info, wrapType, ioType));
}
sk_sp<GrTexture> GrMockGpu::onWrapRenderableBackendTexture(const GrBackendTexture& tex,
@@ -151,8 +153,9 @@
// The client gave us the texture ID but we supply the render target ID.
GrMockRenderTargetInfo rtInfo(texInfo.fColorType, NextInternalRenderTargetID());
- return sk_sp<GrTexture>(
- new GrMockTextureRenderTarget(this, desc, mipMapsStatus, texInfo, rtInfo, cacheable));
+ auto isProtected = GrProtected(tex.isProtected());
+ return sk_sp<GrTexture>(new GrMockTextureRenderTarget(this, desc, isProtected, mipMapsStatus,
+ texInfo, rtInfo, cacheable));
}
sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& rt) {
@@ -164,8 +167,9 @@
desc.fHeight = rt.height();
desc.fConfig = info.pixelConfig();
+ auto isProtected = GrProtected(rt.isProtected());
return sk_sp<GrRenderTarget>(
- new GrMockRenderTarget(this, GrMockRenderTarget::kWrapped, desc, info));
+ new GrMockRenderTarget(this, GrMockRenderTarget::kWrapped, desc, isProtected, info));
}
sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
@@ -182,8 +186,9 @@
// The client gave us the texture ID but we supply the render target ID.
GrMockRenderTargetInfo rtInfo(texInfo.fColorType, NextInternalRenderTargetID());
+ auto isProtected = GrProtected(tex.isProtected());
return sk_sp<GrRenderTarget>(
- new GrMockRenderTarget(this, GrMockRenderTarget::kWrapped, desc, rtInfo));
+ new GrMockRenderTarget(this, GrMockRenderTarget::kWrapped, desc, isProtected, rtInfo));
}
sk_sp<GrGpuBuffer> GrMockGpu::onCreateBuffer(size_t sizeInBytes, GrGpuBufferType type,