Reduce the number of backend->pixelconfig GrCaps virtuals.
Moves method to get GrBackendFormat from GrBackendTexture from GrCaps
to GrBackendTexture so that a GrContext is not required.
Uses kUnknown_GrPixelConfig as failure return from GrCaps functions
rather than an GrPixelConfig* out param and bool result.
Having the texture type be part of GrBackendFormat made removing the
GrCaps function that goes from GrBackendRenderTarget to GrPixelConfig
awkward so that was left alone for now.
Change-Id: If9be0f898c538be4a7b24022b6011f63441a0317
Reviewed-on: https://skia-review.googlesource.com/c/175991
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tools/DDLPromiseImageHelper.cpp b/tools/DDLPromiseImageHelper.cpp
index fcda20e..2586835 100644
--- a/tools/DDLPromiseImageHelper.cpp
+++ b/tools/DDLPromiseImageHelper.cpp
@@ -24,10 +24,6 @@
}
}
-const GrCaps* DDLPromiseImageHelper::PromiseImageCallbackContext::caps() const {
- return fContext->contextPriv().caps();
-}
-
///////////////////////////////////////////////////////////////////////////////////////////////////
DDLPromiseImageHelper::~DDLPromiseImageHelper() {}
@@ -179,8 +175,6 @@
}
SkASSERT(curImage.index() == *indexPtr);
- const GrCaps* caps = curImage.caps();
-
sk_sp<SkImage> image;
if (curImage.isYUV()) {
GrBackendFormat backendFormats[SkYUVASizeInfo::kMaxCount];
@@ -191,8 +185,8 @@
SkAssertResult(SkYUVAIndex::AreValidIndices(curImage.yuvaIndices(), &textureCount));
for (int i = 0; i < textureCount; ++i) {
const GrBackendTexture& backendTex = curImage.backendTexture(i);
- backendFormats[i] = caps->createFormatFromBackendTexture(backendTex);
-
+ backendFormats[i] = backendTex.getBackendFormat();
+ SkASSERT(backendFormats[i].isValid());
contexts[i] = curImage.refCallbackContext(i).release();
sizes[i].set(curImage.yuvPixmap(i).width(), curImage.yuvPixmap(i).height());
}
@@ -215,7 +209,8 @@
} else {
const GrBackendTexture& backendTex = curImage.backendTexture(0);
- GrBackendFormat backendFormat = caps->createFormatFromBackendTexture(backendTex);
+ GrBackendFormat backendFormat = backendTex.getBackendFormat();
+ SkASSERT(backendFormat.isValid());
// Each DDL recorder gets its own ref on the promise callback context for the
// promise images it creates.