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

Unified Diff: src/gpu/GrTextureParamsAdjuster.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
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrTextureToYUVPlanes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextureParamsAdjuster.cpp
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index 68a6f9907041abe8fc62ad54dc2b91bb9371aeb2..3ca90f5adb0a6e433743f9f2d9b406adb0021487 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -33,35 +33,13 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset,
SkASSERT(!subset || !subset->isEmpty());
GrContext* context = inputTexture->getContext();
SkASSERT(context);
- const GrCaps* caps = context->caps();
GrPixelConfig config = GrMakePixelConfigUncompressed(inputTexture->config());
- // If the config isn't renderable try converting to either A8 or an 32 bit config. Otherwise,
- // fail.
- if (!caps->isConfigRenderable(config, false)) {
- if (GrPixelConfigIsAlphaOnly(config)) {
- if (caps->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
- config = kAlpha_8_GrPixelConfig;
- } else if (caps->isConfigRenderable(kSkia8888_GrPixelConfig, false)) {
- config = kSkia8888_GrPixelConfig;
- } else {
- return nullptr;
- }
- } else if (kRGB_GrColorComponentFlags ==
- (kRGB_GrColorComponentFlags & GrPixelConfigComponentMask(config))) {
- if (caps->isConfigRenderable(kSkia8888_GrPixelConfig, false)) {
- config = kSkia8888_GrPixelConfig;
- } else {
- return nullptr;
- }
- } else {
- return nullptr;
- }
- }
-
- sk_sp<GrDrawContext> copyDC = context->makeDrawContext(SkBackingFit::kExact, copyParams.fWidth,
- copyParams.fHeight, config, nullptr);
+ sk_sp<GrDrawContext> copyDC = context->makeDrawContextWithFallback(SkBackingFit::kExact,
+ copyParams.fWidth,
+ copyParams.fHeight,
+ config, nullptr);
if (!copyDC) {
return nullptr;
}
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrTextureToYUVPlanes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698