Chromium Code Reviews| Index: src/gpu/GrContext.cpp |
| diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
| index 015776099038649fd1134e0974329ec17028a2c1..a25bcf1dc5acf599284ed3a8821afa73c9350c2c 100644 |
| --- a/src/gpu/GrContext.cpp |
| +++ b/src/gpu/GrContext.cpp |
| @@ -689,6 +689,29 @@ sk_sp<GrDrawContext> GrContext::makeDrawContext(SkBackingFit fit, |
| GrSurfaceOrigin origin, |
| const SkSurfaceProps* surfaceProps, |
| SkBudgeted budgeted) { |
| + // If the config isn't renderable try converting to either A8 or an 32 bit config. Otherwise, |
|
bsalomon
2016/09/01 19:47:05
I think this should be more narrowly defined as al
robertphillips
2016/09/01 20:52:54
Done.
|
| + // fail. |
| + if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) { |
| + if (GrPixelConfigIsAlphaOnly(config)) { |
| + if (this->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, sampleCnt > 0)) { |
| + config = kAlpha_8_GrPixelConfig; |
| + } else if (this->caps()->isConfigRenderable(kSkia8888_GrPixelConfig, sampleCnt > 0)) { |
|
bsalomon
2016/09/01 19:47:05
Let's not use kSkia8888. I'd like to remove it. kR
robertphillips
2016/09/01 20:52:54
Done.
|
| + config = kSkia8888_GrPixelConfig; |
| + } else { |
| + return nullptr; |
| + } |
| + } else if (kRGB_GrColorComponentFlags == |
| + (kRGB_GrColorComponentFlags & GrPixelConfigComponentMask(config))) { |
| + if (this->caps()->isConfigRenderable(kSkia8888_GrPixelConfig, sampleCnt > 0)) { |
| + config = kSkia8888_GrPixelConfig; |
| + } else { |
| + return nullptr; |
| + } |
| + } else { |
| + return nullptr; |
| + } |
| + } |
| + |
| GrSurfaceDesc desc; |
| desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| desc.fOrigin = origin; |