| Index: src/gpu/gl/GrGLGpu.cpp
|
| diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
|
| index 6366b44e245f21550e72119e1763e47274885b59..20669b8e78bfcd7677cce97ff2a8575cb8516622 100644
|
| --- a/src/gpu/gl/GrGLGpu.cpp
|
| +++ b/src/gpu/gl/GrGLGpu.cpp
|
| @@ -270,14 +270,21 @@
|
| ///////////////////////////////////////////////////////////////////////////////
|
| GrPixelConfig GrGLGpu::preferredReadPixelsConfig(GrPixelConfig readConfig,
|
| GrPixelConfig surfaceConfig) const {
|
| - if (kMesa_GrGLDriver == this->glContext().driver() &&
|
| - 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 compile-time or runtime check.
|
| + if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig) {
|
| + return kBGRA_8888_GrPixelConfig;
|
| + } else if (kMesa_GrGLDriver == this->glContext().driver() &&
|
| + 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, surfaceConfig)) {
|
| + } else if (readConfig == kBGRA_8888_GrPixelConfig
|
| + && !this->glCaps().readPixelsSupported(
|
| + this->glInterface(),
|
| + GR_GL_BGRA,
|
| + GR_GL_UNSIGNED_BYTE,
|
| + surfaceConfig
|
| + )) {
|
| return kRGBA_8888_GrPixelConfig;
|
| } else {
|
| return readConfig;
|
| @@ -286,7 +293,11 @@
|
|
|
| GrPixelConfig GrGLGpu::preferredWritePixelsConfig(GrPixelConfig writeConfig,
|
| GrPixelConfig surfaceConfig) const {
|
| - return writeConfig;
|
| + if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == writeConfig) {
|
| + return kBGRA_8888_GrPixelConfig;
|
| + } else {
|
| + return writeConfig;
|
| + }
|
| }
|
|
|
| bool GrGLGpu::canWriteTexturePixels(const GrTexture* texture, GrPixelConfig srcConfig) const {
|
|
|