Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / ui / gfx / buffer_format_util.h
blob39df27b763b68a8bd27e20dd9e8a27e0f0ff5842
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
3 // found in the LICENSE file.
5 #ifndef UI_GFX_BUFFER_FORMAT_UTIL_H_
6 #define UI_GFX_BUFFER_FORMAT_UTIL_H_
8 #include "base/basictypes.h"
9 #include "ui/gfx/buffer_types.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/gfx_export.h"
13 namespace gfx {
15 // Returns the number of planes for |format|.
16 GFX_EXPORT size_t NumberOfPlanesForBufferFormat(BufferFormat format);
18 // Returns the subsampling factor applied to the given zero-indexed |plane| of
19 // |format| both horizontally and vertically.
20 GFX_EXPORT size_t SubsamplingFactorForBufferFormat(
21 BufferFormat format, int plane);
23 // Returns the number of bytes used to store a row of the given zero-indexed
24 // |plane| of |format|.
25 GFX_EXPORT size_t RowSizeForBufferFormat(
26 size_t width, gfx::BufferFormat format, int plane);
27 GFX_EXPORT bool RowSizeForBufferFormatChecked(
28 size_t width, gfx::BufferFormat format, int plane, size_t* size_in_bytes)
29 WARN_UNUSED_RESULT;
31 // Returns the number of bytes used to store all the planes of a given |format|.
32 GFX_EXPORT size_t BufferSizeForBufferFormat(
33 const Size& size, gfx::BufferFormat format);
34 GFX_EXPORT bool BufferSizeForBufferFormatChecked(
35 const Size& size, gfx::BufferFormat format, size_t* size_in_bytes)
36 WARN_UNUSED_RESULT;
38 } // namespace gfx
40 #endif // UI_GFX_BUFFER_FORMAT_UTIL_H_