summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-07 19:43:45 +0000
committerBen Murdoch <benm@google.com>2013-08-12 09:13:02 +0100
commit7bd0266473be10b2a09e55f7b1e830a69a83a7fb (patch)
treeb021c18962be6f298ed40ec13069a0357311ada3
parent1470aefc7d554bfad9915ce316678c2f9056da74 (diff)
downloadsrc-7bd0266473be10b2a09e55f7b1e830a69a83a7fb.tar.gz
Fix BGRA readback on Android
R=bsalomon@google.com, robertphillips@google.com Author: snorp@snorp.net Review URL: https://chromiumcodereview.appspot.com/22522002 git-svn-id: http://skia.googlecode.com/svn/trunk/src@10624 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gpu/gl/GrGpuGL.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/gpu/gl/GrGpuGL.cpp b/gpu/gl/GrGpuGL.cpp
index cc999438..5845d7a6 100644
--- a/gpu/gl/GrGpuGL.cpp
+++ b/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 {