Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SkYUVAPixmapInfo::SupportedDataTypes Class Reference

#include <SkYUVAPixmaps.h>

Public Member Functions

constexpr SupportedDataTypes ()=default
 
constexpr bool supported (PlaneConfig, DataType) const
 
void enableDataType (DataType, int numChannels)
 

Static Public Member Functions

static constexpr SupportedDataTypes All ()
 

Detailed Description

Definition at line 51 of file SkYUVAPixmaps.h.

Constructor & Destructor Documentation

◆ SupportedDataTypes()

constexpr SkYUVAPixmapInfo::SupportedDataTypes::SupportedDataTypes ( )
constexprdefault

Defaults to nothing supported.

Member Function Documentation

◆ All()

constexpr SkYUVAPixmapInfo::SupportedDataTypes SkYUVAPixmapInfo::SupportedDataTypes::All ( )
staticconstexpr

All legal combinations of PlaneConfig and DataType are supported.

Definition at line 263 of file SkYUVAPixmaps.h.

263 {
264 using ULL = unsigned long long; // bitset cons. takes this.
265 ULL bits = 0;
266 for (ULL c = 1; c <= 4; ++c) {
267 for (ULL dt = 0; dt <= ULL(kDataTypeCnt); ++dt) {
268 if (DefaultColorTypeForDataType(static_cast<DataType>(dt),
269 static_cast<int>(c)) != kUnknown_SkColorType) {
270 bits |= ULL(1) << (dt + static_cast<ULL>(kDataTypeCnt)*(c - 1));
271 }
272 }
273 }
274 SupportedDataTypes combinations;
275 combinations.fDataTypeSupport = bits;
276 return combinations;
277}
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
constexpr SupportedDataTypes()=default
static constexpr int kDataTypeCnt
static constexpr SkColorType DefaultColorTypeForDataType(DataType dataType, int numChannels)

◆ enableDataType()

void SkYUVAPixmapInfo::SupportedDataTypes::enableDataType ( DataType  type,
int  numChannels 
)

Update to add support for pixmaps with numChannel channels where each channel is represented as DataType.

Definition at line 20 of file SkYUVAPixmaps.cpp.

20 {
21 if (numChannels < 1 || numChannels > 4) {
22 return;
23 }
24 fDataTypeSupport[static_cast<size_t>(type) + (numChannels - 1)*kDataTypeCnt] = true;
25}

◆ supported()

constexpr bool SkYUVAPixmapInfo::SupportedDataTypes::supported ( PlaneConfig  config,
DataType  type 
) const
constexpr

Checks whether there is a supported combination of color types for planes structured as indicated by PlaneConfig with channel data types as indicated by DataType.

Definition at line 279 of file SkYUVAPixmaps.h.

280 {
281 int n = SkYUVAInfo::NumPlanes(config);
282 for (int i = 0; i < n; ++i) {
283 auto c = static_cast<size_t>(SkYUVAInfo::NumChannelsInPlane(config, i));
284 SkASSERT(c >= 1 && c <= 4);
285 if (!fDataTypeSupport[static_cast<size_t>(type) +
286 (c - 1)*static_cast<size_t>(kDataTypeCnt)]) {
287 return false;
288 }
289 }
290 return true;
291}
#define SkASSERT(cond)
Definition SkAssert.h:116
static constexpr int NumChannelsInPlane(PlaneConfig, int i)
Definition SkYUVAInfo.h:272
static constexpr int NumPlanes(PlaneConfig)
Definition SkYUVAInfo.h:253

The documentation for this class was generated from the following files: