Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
AHardwareBufferUtils.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
10#if __ANDROID_API__ >= 26
11
13
14namespace AHardwareBufferUtils {
15
16SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat) {
17 switch (bufferFormat) {
18 case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
20 case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM:
22 case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT:
24 case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM:
26 case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
28 case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM:
30#if __ANDROID_API__ >= 33
31 case AHARDWAREBUFFER_FORMAT_R8_UNORM:
33#endif
34 default:
35 // Given that we only use this texture as a source, colorType will not impact how Skia
36 // uses the texture. The only potential affect this is anticipated to have is that for
37 // some format types if we are not bound as an OES texture we may get invalid results
38 // for SKP capture if we read back the texture.
40 }
41}
42
43} // namespace AHardwareBufferUtils
44
45#endif
SkColorType
Definition SkColorType.h:19
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition SkColorType.h:38
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition SkColorType.h:21
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition SkColorType.h:22
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition SkColorType.h:24
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:25
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
Definition SkColorType.h:27