Chromium Code Reviews| Index: src/gpu/GrContext.cpp |
| diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
| index 9077bc0d054c86a19ed09036b643688700905a74..d57b3aa80f358dbc1640ebf4cf9402be53000714 100755 |
| --- a/src/gpu/GrContext.cpp |
| +++ b/src/gpu/GrContext.cpp |
| @@ -345,9 +345,12 @@ bool GrContext::writeSurfacePixels(GrSurface* surface, |
| } |
| applyPremulToSrc = true; |
| } |
| - GrGpu::DrawPreference drawPreference = applyPremulToSrc ? |
| - GrGpu::kCallerPrefersDraw_DrawPreference : |
| - GrGpu::kNoDraw_DrawPreference; |
| + |
| + GrGpu::DrawPreference drawPreference = GrGpu::kNoDraw_DrawPreference; |
| + if (applyPremulToSrc && !this->didFailPMUPMConversionTest()) { |
| + drawPreference = GrGpu::kCallerPrefersDraw_DrawPreference; |
| + } |
| + |
| GrGpu::WritePixelTempDrawInfo tempDrawInfo; |
| if (!fGpu->getWritePixelsInfo(surface, width, height, rowBytes, srcConfig, &drawPreference, |
| &tempDrawInfo)) { |
| @@ -476,8 +479,11 @@ bool GrContext::readSurfacePixels(GrSurface* src, |
| return false; |
| } |
| - GrGpu::DrawPreference drawPreference = unpremul ? GrGpu::kCallerPrefersDraw_DrawPreference : |
| - GrGpu::kNoDraw_DrawPreference; |
| + GrGpu::DrawPreference drawPreference = GrGpu::kNoDraw_DrawPreference; |
| + if (unpremul && !this->didFailPMUPMConversionTest()) { |
| + drawPreference = GrGpu::kCallerPrefersDraw_DrawPreference; |
| + } |
| + |
| GrGpu::ReadPixelTempDrawInfo tempDrawInfo; |
| if (!fGpu->getReadPixelsInfo(src, width, height, rowBytes, dstConfig, &drawPreference, |
| &tempDrawInfo)) { |
| @@ -718,6 +724,11 @@ const GrFragmentProcessor* GrContext::createUPMToPMEffect(GrProcessorDataManager |
| } |
| } |
| +bool GrContext::didFailPMUPMConversionTest() const { |
|
robertphillips
2015/07/29 12:35:05
// The PM<->UPM tests fail or succeed together so
bsalomon
2015/07/29 13:01:34
Done.
|
| + return fDidTestPMConversions && |
| + GrConfigConversionEffect::kNone_PMConversion == fPMToUPMConversion; |
| +} |
| + |
| ////////////////////////////////////////////////////////////////////////////// |
| void GrContext::getResourceCacheLimits(int* maxTextures, size_t* maxTextureBytes) const { |