GrColorSpaceInfo stores SkAlphaType.
This means GrSurfaceContext's know their alpha type.
All GrRenderTargetSurfaceContexts are kPremul.
Make GrTextureProducer store GrColorSpaceInfo.
Bug: skia:7580
Change-Id: I5ff321ef52c0edd32e5fac99dff95d44aa66f592
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223184
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 405ec01..c4438ef 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -144,30 +144,34 @@
}
sk_sp<GrSurfaceContext> GrRecordingContext::makeWrappedSurfaceContext(
- sk_sp<GrSurfaceProxy> proxy,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* props) {
+ sk_sp<GrSurfaceProxy> proxy,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* props) {
ASSERT_SINGLE_OWNER_PRIV
if (proxy->asRenderTargetProxy()) {
+ SkASSERT(kPremul_SkAlphaType == alphaType || kOpaque_SkAlphaType == alphaType);
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
std::move(colorSpace), props);
} else {
SkASSERT(proxy->asTextureProxy());
SkASSERT(!props);
- return this->drawingManager()->makeTextureContext(std::move(proxy), std::move(colorSpace));
+ return this->drawingManager()->makeTextureContext(std::move(proxy), alphaType,
+ std::move(colorSpace));
}
}
sk_sp<GrSurfaceContext> GrRecordingContext::makeDeferredSurfaceContext(
- const GrBackendFormat& format,
- const GrSurfaceDesc& dstDesc,
- GrSurfaceOrigin origin,
- GrMipMapped mipMapped,
- SkBackingFit fit,
- SkBudgeted isDstBudgeted,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* props) {
+ const GrBackendFormat& format,
+ const GrSurfaceDesc& dstDesc,
+ GrSurfaceOrigin origin,
+ GrMipMapped mipMapped,
+ SkBackingFit fit,
+ SkBudgeted isDstBudgeted,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* props) {
sk_sp<GrTextureProxy> proxy;
if (GrMipMapped::kNo == mipMapped) {
proxy = this->proxyProvider()->createProxy(format, dstDesc, origin, fit, isDstBudgeted);
@@ -180,6 +184,7 @@
}
sk_sp<GrSurfaceContext> sContext = this->makeWrappedSurfaceContext(std::move(proxy),
+ alphaType,
std::move(colorSpace),
props);
if (sContext && sContext->asRenderTargetContext()) {
@@ -300,23 +305,27 @@
}
sk_sp<GrSurfaceContext> GrRecordingContextPriv::makeWrappedSurfaceContext(
- sk_sp<GrSurfaceProxy> proxy,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* props) {
- return fContext->makeWrappedSurfaceContext(std::move(proxy), std::move(colorSpace), props);
+ sk_sp<GrSurfaceProxy> proxy,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* props) {
+ return fContext->makeWrappedSurfaceContext(std::move(proxy), alphaType, std::move(colorSpace),
+ props);
}
sk_sp<GrSurfaceContext> GrRecordingContextPriv::makeDeferredSurfaceContext(
- const GrBackendFormat& format,
- const GrSurfaceDesc& dstDesc,
- GrSurfaceOrigin origin,
- GrMipMapped mipMapped,
- SkBackingFit fit,
- SkBudgeted isDstBudgeted,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* props) {
+ const GrBackendFormat& format,
+ const GrSurfaceDesc& dstDesc,
+ GrSurfaceOrigin origin,
+ GrMipMapped mipMapped,
+ SkBackingFit fit,
+ SkBudgeted isDstBudgeted,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* props) {
return fContext->makeDeferredSurfaceContext(format, dstDesc, origin, mipMapped, fit,
- isDstBudgeted, std::move(colorSpace), props);
+ isDstBudgeted, alphaType, std::move(colorSpace),
+ props);
}
sk_sp<GrRenderTargetContext> GrRecordingContextPriv::makeDeferredRenderTargetContext(