Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: content/common/gpu/client/gl_helper_readback_support.h

Issue 374633002: SkBitmap::Config is deprecated, use SkColorType instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments from #4 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "content/common/gpu/client/gl_helper.h" 10 #include "content/common/gpu/client/gl_helper.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 class CONTENT_EXPORT GLHelperReadbackSupport { 14 class CONTENT_EXPORT GLHelperReadbackSupport {
15 public: 15 public:
16 GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl); 16 GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl);
17 17
18 ~GLHelperReadbackSupport(); 18 ~GLHelperReadbackSupport();
19 19
20 // Checks whether the readback (Color read format and type) is supported 20 // Checks whether the readback (Color read format and type) is supported
21 // for the requested texture format by the hardware or not. 21 // for the requested texture format by the hardware or not.
22 // For ex: some hardwares have rgb565 readback 22 // For ex: some hardwares have rgb565 readback
23 // support when binded with the frame buffer for others it may fail. 23 // support when binded with the frame buffer for others it may fail.
24 // Here we pass the internal textureformat as skia config. 24 // Here we pass the internal textureformat as skia config.
25 bool IsReadbackConfigSupported(SkBitmap::Config texture_format); 25 bool IsReadbackConfigSupported(SkColorType texture_format);
26 26
27 // Provides the additional readback format/type pairing for a render target 27 // Provides the additional readback format/type pairing for a render target
28 // of a given format/type pairing 28 // of a given format/type pairing
29 void GetAdditionalFormat(GLint format, GLint type, GLint *format_out, 29 void GetAdditionalFormat(GLint format, GLint type, GLint *format_out,
30 GLint *type_out); 30 GLint *type_out);
31 private: 31 private:
32 enum FormatSupport { FORMAT_NOT_SUPPORTED = 0, FORMAT_SUPPORTED, }; 32 enum FormatSupport { FORMAT_NOT_SUPPORTED = 0, FORMAT_SUPPORTED, };
33 33
34 struct FormatCacheEntry { 34 struct FormatCacheEntry {
35 GLint format; 35 GLint format;
36 GLint type; 36 GLint type;
37 GLint read_format; 37 GLint read_format;
38 GLint read_type; 38 GLint read_type;
39 }; 39 };
40 40
41 // This populates the format_support_table with the list of supported 41 // This populates the format_support_table with the list of supported
42 // formats. 42 // formats.
43 void InitializeReadbackSupport(); 43 void InitializeReadbackSupport();
44 44
45 // This api is called once per format and it is done in the 45 // This api is called once per format and it is done in the
46 // InitializeReadbackSupport. We should not use this any where 46 // InitializeReadbackSupport. We should not use this any where
47 // except the InitializeReadbackSupport.Calling this at other places 47 // except the InitializeReadbackSupport.Calling this at other places
48 // can distrub the state of normal gl operations. 48 // can distrub the state of normal gl operations.
49 void CheckForReadbackSupport(SkBitmap::Config texture_format); 49 void CheckForReadbackSupport(SkColorType texture_format);
50 50
51 // Helper functions for checking the supported texture formats. 51 // Helper functions for checking the supported texture formats.
52 // Avoid using this API in between texture operations, as this does some 52 // Avoid using this API in between texture operations, as this does some
53 // teture opertions (bind, attach) internally. 53 // teture opertions (bind, attach) internally.
54 bool SupportsFormat(GLint format, GLint type); 54 bool SupportsFormat(GLint format, GLint type);
55 55
56 FormatSupport format_support_table_[SkBitmap::kConfigCount]; 56 FormatSupport format_support_table_[kLastEnum_SkColorType + 1];
57 57
58 gpu::gles2::GLES2Interface* gl_; 58 gpu::gles2::GLES2Interface* gl_;
59 std::vector<struct FormatCacheEntry> format_cache_; 59 std::vector<struct FormatCacheEntry> format_cache_;
60 }; 60 };
61 61
62 } // namespace content 62 } // namespace content
63 63
64 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_ 64 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698