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