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 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
8 #include "third_party/skia/include/core/SkImageInfo.h" | 8 #include "third_party/skia/include/core/SkImageInfo.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 GLHelperReadbackSupport::GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl) | 12 GLHelperReadbackSupport::GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl) |
13 : gl_(gl) { | 13 : gl_(gl) { |
14 InitializeReadbackSupport(); | 14 InitializeReadbackSupport(); |
15 } | 15 } |
16 | 16 |
17 GLHelperReadbackSupport::~GLHelperReadbackSupport() {} | 17 GLHelperReadbackSupport::~GLHelperReadbackSupport() {} |
18 | 18 |
19 void GLHelperReadbackSupport::InitializeReadbackSupport() { | 19 void GLHelperReadbackSupport::InitializeReadbackSupport() { |
20 // We are concerned about 16, 32-bit formats only. The below are the most | 20 // We are concerned about 16, 32-bit formats only. The below are the most |
21 // used 16, 32-bit formats. In future if any new format support is needed | 21 // used 16, 32-bit formats. In future if any new format support is needed |
22 // that should be added here. Initialize the array with | 22 // that should be added here. Initialize the array with |
23 // GLHelperReadbackSupport::NOT_SUPPORTED as we dont know the supported | 23 // GLHelperReadbackSupport::NOT_SUPPORTED as we dont know the supported |
24 // formats yet. | 24 // formats yet. |
25 for (int i = 0; i <= kLastEnum_SkColorType; ++i) { | 25 for (int i = 0; i <= kLastEnum_SkColorType; ++i) { |
26 format_support_table_[i] = GLHelperReadbackSupport::NOT_SUPPORTED; | 26 format_support_table_[i] = GLHelperReadbackSupport::NOT_SUPPORTED; |
27 } | 27 } |
| 28 // TODO(sikugu): kAlpha_8_SkColorType support check is failing on mesa. |
| 29 // See crbug.com/415667. |
28 CheckForReadbackSupport(kRGB_565_SkColorType); | 30 CheckForReadbackSupport(kRGB_565_SkColorType); |
29 CheckForReadbackSupport(kARGB_4444_SkColorType); | 31 CheckForReadbackSupport(kARGB_4444_SkColorType); |
30 CheckForReadbackSupport(kRGBA_8888_SkColorType); | 32 CheckForReadbackSupport(kRGBA_8888_SkColorType); |
31 CheckForReadbackSupport(kBGRA_8888_SkColorType); | 33 CheckForReadbackSupport(kBGRA_8888_SkColorType); |
32 // Further any formats, support should be checked here. | 34 // Further any formats, support should be checked here. |
33 } | 35 } |
34 | 36 |
35 void GLHelperReadbackSupport::CheckForReadbackSupport( | 37 void GLHelperReadbackSupport::CheckForReadbackSupport( |
36 SkColorType texture_format) { | 38 SkColorType texture_format) { |
37 bool supports_format = false; | 39 bool supports_format = false; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 return GLHelperReadbackSupport::NOT_SUPPORTED; | 172 return GLHelperReadbackSupport::NOT_SUPPORTED; |
171 default: | 173 default: |
172 NOTREACHED(); | 174 NOTREACHED(); |
173 break; | 175 break; |
174 } | 176 } |
175 | 177 |
176 return GLHelperReadbackSupport::NOT_SUPPORTED; | 178 return GLHelperReadbackSupport::NOT_SUPPORTED; |
177 } | 179 } |
178 | 180 |
179 } // namespace content | 181 } // namespace content |
OLD | NEW |