OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 UI_GFX_BUFFER_FORMAT_UTIL_H_ | 5 #ifndef UI_GFX_BUFFER_FORMAT_UTIL_H_ |
6 #define UI_GFX_BUFFER_FORMAT_UTIL_H_ | 6 #define UI_GFX_BUFFER_FORMAT_UTIL_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "ui/gfx/buffer_types.h" | 11 #include "ui/gfx/buffer_types.h" |
10 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
11 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
12 | 14 |
13 namespace gfx { | 15 namespace gfx { |
14 | 16 |
| 17 // Returns a vector containing all buffer formats. |
| 18 GFX_EXPORT std::vector<BufferFormat> GetBufferFormats(); |
| 19 |
15 // Returns the number of planes for |format|. | 20 // Returns the number of planes for |format|. |
16 GFX_EXPORT size_t NumberOfPlanesForBufferFormat(BufferFormat format); | 21 GFX_EXPORT size_t NumberOfPlanesForBufferFormat(BufferFormat format); |
17 | 22 |
18 // Returns the subsampling factor applied to the given zero-indexed |plane| of | 23 // Returns the subsampling factor applied to the given zero-indexed |plane| of |
19 // |format| both horizontally and vertically. | 24 // |format| both horizontally and vertically. |
20 GFX_EXPORT size_t SubsamplingFactorForBufferFormat( | 25 GFX_EXPORT size_t SubsamplingFactorForBufferFormat( |
21 BufferFormat format, int plane); | 26 BufferFormat format, int plane); |
22 | 27 |
23 // Returns the number of bytes used to store a row of the given zero-indexed | 28 // Returns the number of bytes used to store a row of the given zero-indexed |
24 // |plane| of |format|. | 29 // |plane| of |format|. |
25 GFX_EXPORT size_t RowSizeForBufferFormat( | 30 GFX_EXPORT size_t RowSizeForBufferFormat(size_t width, |
26 size_t width, gfx::BufferFormat format, int plane); | 31 BufferFormat format, |
27 GFX_EXPORT bool RowSizeForBufferFormatChecked( | 32 int plane); |
28 size_t width, gfx::BufferFormat format, int plane, size_t* size_in_bytes) | 33 GFX_EXPORT bool RowSizeForBufferFormatChecked(size_t width, |
| 34 BufferFormat format, |
| 35 int plane, |
| 36 size_t* size_in_bytes) |
29 WARN_UNUSED_RESULT; | 37 WARN_UNUSED_RESULT; |
30 | 38 |
31 // Returns the number of bytes used to store all the planes of a given |format|. | 39 // Returns the number of bytes used to store all the planes of a given |format|. |
32 GFX_EXPORT size_t BufferSizeForBufferFormat( | 40 GFX_EXPORT size_t BufferSizeForBufferFormat(const Size& size, |
33 const Size& size, gfx::BufferFormat format); | 41 BufferFormat format); |
34 GFX_EXPORT bool BufferSizeForBufferFormatChecked( | 42 GFX_EXPORT bool BufferSizeForBufferFormatChecked(const Size& size, |
35 const Size& size, gfx::BufferFormat format, size_t* size_in_bytes) | 43 BufferFormat format, |
| 44 size_t* size_in_bytes) |
36 WARN_UNUSED_RESULT; | 45 WARN_UNUSED_RESULT; |
37 | 46 |
38 } // namespace gfx | 47 } // namespace gfx |
39 | 48 |
40 #endif // UI_GFX_BUFFER_FORMAT_UTIL_H_ | 49 #endif // UI_GFX_BUFFER_FORMAT_UTIL_H_ |
OLD | NEW |