| Index: src/gpu/gl/GrGpuGL.cpp | 
| diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp | 
| index cc9994385a0273f6dd6cdfec8b33f06218c1b01e..5845d7a673ac36c3b267084740ba5505acf8f9e7 100644 | 
| --- a/src/gpu/gl/GrGpuGL.cpp | 
| +++ b/src/gpu/gl/GrGpuGL.cpp | 
| @@ -231,29 +231,32 @@ void GrGpuGL::fillInConfigRenderableTable() { | 
| } | 
| } | 
|  | 
| -namespace { | 
| -GrPixelConfig preferred_pixel_ops_config(GrPixelConfig cpuConfig, GrPixelConfig surfaceConfig) { | 
| -    if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == cpuConfig) { | 
| +GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig, | 
| +                                                 GrPixelConfig surfaceConfig) const { | 
| +    if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig) { | 
| return kBGRA_8888_GrPixelConfig; | 
| -    } else if (GrBytesPerPixel(cpuConfig) == 4 && | 
| -                GrPixelConfigSwapRAndB(cpuConfig) == surfaceConfig) { | 
| +    } else if (fGLContext.info().isMesa() && | 
| +               GrBytesPerPixel(readConfig) == 4 && | 
| +               GrPixelConfigSwapRAndB(readConfig) == surfaceConfig) { | 
| // Mesa 3D takes a slow path on when reading back  BGRA from an RGBA surface and vice-versa. | 
| // Perhaps this should be guarded by some compiletime or runtime check. | 
| return surfaceConfig; | 
| +    } else if (readConfig == kBGRA_8888_GrPixelConfig && | 
| +               !this->glCaps().readPixelsSupported(this->glInterface(), | 
| +                                                   GR_GL_BGRA, GR_GL_UNSIGNED_BYTE)) { | 
| +        return kRGBA_8888_GrPixelConfig; | 
| } else { | 
| -        return cpuConfig; | 
| +        return readConfig; | 
| } | 
| } | 
| -} | 
| - | 
| -GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig, | 
| -                                                 GrPixelConfig surfaceConfig) const { | 
| -    return preferred_pixel_ops_config(readConfig, surfaceConfig); | 
| -} | 
|  | 
| GrPixelConfig GrGpuGL::preferredWritePixelsConfig(GrPixelConfig writeConfig, | 
| GrPixelConfig surfaceConfig) const { | 
| -    return preferred_pixel_ops_config(writeConfig, surfaceConfig); | 
| +    if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == writeConfig) { | 
| +        return kBGRA_8888_GrPixelConfig; | 
| +    } else { | 
| +        return writeConfig; | 
| +    } | 
| } | 
|  | 
| bool GrGpuGL::canWriteTexturePixels(const GrTexture* texture, GrPixelConfig srcConfig) const { | 
|  |