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 #ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_ |
7 | 7 |
8 #include "content/common/gpu/client/gl_helper.h" | 8 #include "content/common/gpu/client/gl_helper.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 class CONTENT_EXPORT GLHelperReadbackSupport { | 12 class CONTENT_EXPORT GLHelperReadbackSupport { |
13 public: | 13 public: |
14 GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl); | 14 GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl); |
15 | 15 |
16 ~GLHelperReadbackSupport(); | 16 ~GLHelperReadbackSupport(); |
17 | 17 |
18 // Checks whether the readback (Color read format and type) is supported | 18 // Checks whether the readback (Color read format and type) is supported |
19 // for the requested texture format by the hardware or not. | 19 // for the requested texture format by the hardware or not. |
20 // For ex: some hardwares have rgb565 readback | 20 // For ex: some hardwares have rgb565 readback |
21 // support when binded with the frame buffer for others it may fail. | 21 // support when binded with the frame buffer for others it may fail. |
22 // Here we pass the internal textureformat as skia config. | 22 // Here we pass the internal textureformat as skia config. |
23 bool IsReadbackConfigSupported(SkBitmap::Config texture_format); | 23 bool IsReadbackConfigSupported(SkBitmap::Config texture_format); |
24 | 24 |
| 25 SkBitmap::Config PreferredReadbackFormat(); |
| 26 |
25 private: | 27 private: |
26 enum FormatSupport { FORMAT_NOT_SUPPORTED = 0, FORMAT_SUPPORTED, }; | 28 enum FormatSupport { FORMAT_NOT_SUPPORTED = 0, FORMAT_SUPPORTED, }; |
27 | 29 |
28 // This populates the format_support_table with the list of supported | 30 // This populates the format_support_table with the list of supported |
29 // formats. | 31 // formats. |
30 void InitializeReadbackSupport(); | 32 void InitializeReadbackSupport(); |
31 | 33 |
32 // This api is called once per format and it is done in the | 34 // This api is called once per format and it is done in the |
33 // InitializeReadbackSupport. We should not use this any where | 35 // InitializeReadbackSupport. We should not use this any where |
34 // except the InitializeReadbackSupport.Calling this at other places | 36 // except the InitializeReadbackSupport.Calling this at other places |
35 // can distrub the state of normal gl operations. | 37 // can distrub the state of normal gl operations. |
36 void CheckForReadbackSupport(SkBitmap::Config texture_format); | 38 void CheckForReadbackSupport(SkBitmap::Config texture_format); |
37 | 39 |
38 // Helper functions for checking the supported texture formats. | 40 // Helper functions for checking the supported texture formats. |
39 // Avoid using this API in between texture operations, as this does some | 41 // Avoid using this API in between texture operations, as this does some |
40 // teture opertions (bind, attach) internally. | 42 // teture opertions (bind, attach) internally. |
41 bool SupportsFormat(GLint format, GLint type); | 43 bool SupportsFormat(GLint format, GLint type); |
42 | 44 |
43 FormatSupport format_support_table_[SkBitmap::kConfigCount]; | 45 FormatSupport format_support_table_[SkBitmap::kConfigCount]; |
44 | 46 |
45 gpu::gles2::GLES2Interface* gl_; | 47 gpu::gles2::GLES2Interface* gl_; |
46 | 48 |
47 }; | 49 }; |
48 | 50 |
49 } // namespace content | 51 } // namespace content |
50 | 52 |
51 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_ | 53 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_ |
OLD | NEW |