OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/gpu/client/gl_helper_readback_support.h" | 5 #include "content/common/gpu/client/gl_helper_readback_support.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #if defined(OS_ANDROID) |
| 8 #include "base/android/sys_utils.h" |
| 9 #endif |
7 | 10 |
8 namespace content { | 11 namespace content { |
9 | 12 |
10 GLHelperReadbackSupport::GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl) | 13 GLHelperReadbackSupport::GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl) |
11 : gl_(gl) { | 14 : gl_(gl) { |
12 InitializeReadbackSupport(); | 15 InitializeReadbackSupport(); |
13 } | 16 } |
14 | 17 |
15 GLHelperReadbackSupport::~GLHelperReadbackSupport() {} | 18 GLHelperReadbackSupport::~GLHelperReadbackSupport() {} |
16 | 19 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 case FORMAT_SUPPORTED: | 86 case FORMAT_SUPPORTED: |
84 return true; | 87 return true; |
85 case FORMAT_NOT_SUPPORTED: | 88 case FORMAT_NOT_SUPPORTED: |
86 return false; | 89 return false; |
87 default: | 90 default: |
88 NOTREACHED(); | 91 NOTREACHED(); |
89 return false; | 92 return false; |
90 } | 93 } |
91 } | 94 } |
92 | 95 |
| 96 SkBitmap::Config GLHelperReadbackSupport::PreferredReadbackFormat() { |
| 97 #if defined(OS_ANDROID) |
| 98 // Define the criteria here. If say the 16 texture readbback is |
| 99 // supported we should go with that (this degrades quality) |
| 100 // or stick back to the default format. |
| 101 if (base::android::SysUtils::IsLowEndDevice()) { |
| 102 if (IsReadbackConfigSupported(SkBitmap::kRGB_565_Config)) |
| 103 return SkBitmap::kRGB_565_Config; |
| 104 } |
| 105 #endif |
| 106 return SkBitmap::kARGB_8888_Config; |
| 107 } |
| 108 |
93 } // namespace content | 109 } // namespace content |
OLD | NEW |