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

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
Index: src/gpu/GrTextureParamsAdjuster.cpp
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index 68a6f9907041abe8fc62ad54dc2b91bb9371aeb2..36bf20642e2071340f72eb3b984d484276477398 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -33,33 +33,9 @@ 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);
if (!copyDC) {

Powered by Google App Engine
This is Rietveld 408576698