forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuffer_format_util.h
40 lines (31 loc) · 1.42 KB
/
buffer_format_util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_GFX_BUFFER_FORMAT_UTIL_H_
#define UI_GFX_BUFFER_FORMAT_UTIL_H_
#include "base/basictypes.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gfx_export.h"
namespace gfx {
// Returns the number of planes for |format|.
GFX_EXPORT size_t NumberOfPlanesForBufferFormat(BufferFormat format);
// Returns the subsampling factor applied to the given zero-indexed |plane| of
// |format| both horizontally and vertically.
GFX_EXPORT size_t SubsamplingFactorForBufferFormat(
BufferFormat format, int plane);
// Returns the number of bytes used to store a row of the given zero-indexed
// |plane| of |format|.
GFX_EXPORT size_t RowSizeForBufferFormat(
size_t width, gfx::BufferFormat format, int plane);
GFX_EXPORT bool RowSizeForBufferFormatChecked(
size_t width, gfx::BufferFormat format, int plane, size_t* size_in_bytes)
WARN_UNUSED_RESULT;
// Returns the number of bytes used to store all the planes of a given |format|.
GFX_EXPORT size_t BufferSizeForBufferFormat(
const Size& size, gfx::BufferFormat format);
GFX_EXPORT bool BufferSizeForBufferFormatChecked(
const Size& size, gfx::BufferFormat format, size_t* size_in_bytes)
WARN_UNUSED_RESULT;
} // namespace gfx
#endif // UI_GFX_BUFFER_FORMAT_UTIL_H_