Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: src/gpu/GrTextureToYUVPlanes.cpp

Issue 2296193005: Add a makeDrawContextWithFallback that handles config fallback (Closed)
Patch Set: update Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrTextureToYUVPlanes.cpp
diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp
index 7a8647a86756254391c297bd49f0221500bcf0cc..08eed8af6bac74f976d58e9a13f06f6b4070a405 100644
--- a/src/gpu/GrTextureToYUVPlanes.cpp
+++ b/src/gpu/GrTextureToYUVPlanes.cpp
@@ -58,13 +58,6 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
sk_sp<GrDrawContext> uDrawContext;
sk_sp<GrDrawContext> vDrawContext;
- GrPixelConfig singleChannelPixelConfig;
- if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
- singleChannelPixelConfig = kAlpha_8_GrPixelConfig;
- } else {
- singleChannelPixelConfig = kRGBA_8888_GrPixelConfig;
- }
-
// We issue draw(s) to convert from RGBA to Y, U, and V. All three planes may have different
// sizes however we optimize for two other cases - all planes are the same (1 draw to YUV),
// and U and V are the same but Y differs (2 draws, one for Y, one for UV).
@@ -78,7 +71,7 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
} else {
yDrawContext = context->makeDrawContext(SkBackingFit::kApprox,
sizes[0].fWidth, sizes[0].fHeight,
- singleChannelPixelConfig, nullptr);
+ kAlpha_8_GrPixelConfig, nullptr);
if (!yDrawContext) {
return false;
}
@@ -93,10 +86,10 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
} else {
uDrawContext = context->makeDrawContext(SkBackingFit::kApprox,
sizes[1].fWidth, sizes[1].fHeight,
- singleChannelPixelConfig, nullptr);
+ kAlpha_8_GrPixelConfig, nullptr);
vDrawContext = context->makeDrawContext(SkBackingFit::kApprox,
sizes[2].fWidth, sizes[2].fHeight,
- singleChannelPixelConfig, nullptr);
+ kAlpha_8_GrPixelConfig, nullptr);
if (!uDrawContext || !vDrawContext) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698