Index: content/common/gpu/client/gl_helper.h |
diff --git a/content/common/gpu/client/gl_helper.h b/content/common/gpu/client/gl_helper.h |
index 46db753207217ae13659920803008f68b739df8c..b885dbfd3c22d657e8b3762c95cecde6aab3a2fe 100644 |
--- a/content/common/gpu/client/gl_helper.h |
+++ b/content/common/gpu/client/gl_helper.h |
@@ -169,6 +169,12 @@ class CONTENT_EXPORT GLHelper { |
SCALER_QUALITY_BEST = 3, |
}; |
+ enum FormatSupport { |
+ FORMAT_NOT_SUPPORTED = 0, |
+ FORMAT_SUPPORTED, |
+ FORMAT_SUPPORT_UNKNOWN, |
+ }; |
+ |
// Copies the block of pixels specified with |src_subrect| from |src_texture|, |
// scales it to |dst_size|, and writes it into |out|. |
// |src_size| is the size of |src_texture|. The result is of format GL_BGRA |
@@ -277,8 +283,12 @@ class CONTENT_EXPORT GLHelper { |
// size of the framebuffer. |
void CopyTextureFullImage(GLuint texture, const gfx::Size& size); |
- // Check whether rgb565 readback is supported or not. |
- bool CanUseRgb565Readback(); |
+ // Checks whether the readback (Color read format and type) is supported |
+ // for the requested texture format by the hardware or not. |
+ // For ex: some hardwares have rgb565 readback |
+ // support when binded with the frame buffer for others it may fail. |
+ |
+ bool IsReadbackConfigSupported(SkBitmap::Config bitmap_format); |
// A scaler will cache all intermediate textures and programs |
// needed to scale from a specified size to a destination size. |
@@ -328,6 +338,18 @@ class CONTENT_EXPORT GLHelper { |
// 0 if GL_EXT_draw_buffers is not available. |
GLint MaxDrawBuffers(); |
+ private: |
+ // IsReadbackConfigSupported does texture bind and attach operations, |
+ // better do it in the constructor, and never do it again. |
+ // This populates the readback support list at a time once. |
+ void InitializeReadbackSupport(); |
+ void CheckForReadbackSupport(SkBitmap::Config bitmap_format); |
+ |
+ // Helper functions for checking the supported texture formats. |
+ // Avoid using this API in between texture operations, as this does some |
+ // teture opertions (bind, attach) internally. |
+ bool SupportsFormat(GLint format, GLint type); |
+ |
protected: |
class CopyTextureToImpl; |
@@ -340,8 +362,7 @@ class CONTENT_EXPORT GLHelper { |
gpu::ContextSupport* context_support_; |
scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; |
scoped_ptr<GLHelperScaling> scaler_impl_; |
- bool initialized_565_format_check_; |
- bool support_565_format_; |
+ FormatSupport format_support_table_[SkBitmap::kConfigCount]; |
DISALLOW_COPY_AND_ASSIGN(GLHelper); |
}; |