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