8#ifndef SkYUVAPixmaps_DEFINED
9#define SkYUVAPixmaps_DEFINED
47 kLast = kUnorm10_Unorm2
49 static constexpr int kDataTypeCnt =
static_cast<int>(DataType::kLast) + 1;
69 void enableDataType(
DataType,
int numChannels);
73 std::bitset<kDataTypeCnt*4> fDataTypeSupport = {};
80 static constexpr SkColorType DefaultColorTypeForDataType(
DataType dataType,
int numChannels);
88 static std::tuple<int, DataType> NumChannelsAndDataType(
SkColorType);
104 const size_t rowBytes[kMaxPlanes]);
132 size_t rowBytes(
int i)
const {
return fRowBytes[
static_cast<size_t>(
i)]; }
142 size_t computeTotalBytes(
size_t planeSizes[kMaxPlanes] =
nullptr)
const;
149 bool initPixmapsFromSingleAllocation(
void* memory,
SkPixmap pixmaps[kMaxPlanes])
const;
155 bool isValid()
const {
return fYUVAInfo.isValid(); }
158 bool isSupported(
const SupportedDataTypes&)
const;
162 std::array<SkImageInfo, kMaxPlanes> fPlaneInfos = {};
163 std::array<size_t, kMaxPlanes> fRowBytes = {};
164 DataType fDataType = DataType::kUnorm8;
219 bool isValid()
const {
return !fYUVAInfo.dimensions().isEmpty(); }
228 int numPlanes()
const {
return this->isValid() ? fYUVAInfo.numPlanes() : 0; }
234 const std::array<SkPixmap, kMaxPlanes>&
planes()
const {
return fPlanes; }
255 std::array<SkPixmap, kMaxPlanes> fPlanes = {};
264 using ULL =
unsigned long long;
266 for (ULL c = 1; c <= 4; ++c) {
275 combinations.fDataTypeSupport =
bits;
282 for (
int i = 0;
i < n; ++
i) {
285 if (!fDataTypeSupport[
static_cast<size_t>(
type) +
295 switch (numChannels) {
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kA16_float_SkColorType
pixel with a half float for alpha
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
@ kUnknown_SkColorType
uninitialized
@ kR16G16_float_SkColorType
pixel with a half float for red and green
constexpr size_t SkToSizeT(S x)
static constexpr bool SkToBool(const T &x)
static constexpr int kMaxPlanes
static constexpr int NumChannelsInPlane(PlaneConfig, int i)
static constexpr int NumPlanes(PlaneConfig)
std::array< YUVALocation, kYUVAChannelCount > YUVALocations
constexpr bool supported(PlaneConfig, DataType) const
constexpr SupportedDataTypes()=default
static constexpr SupportedDataTypes All()
size_t rowBytes(int i) const
SkYUVColorSpace yuvColorSpace() const
SkYUVAPixmapInfo(const SkYUVAPixmapInfo &)=default
const SkYUVAInfo & yuvaInfo() const
SkYUVAPixmapInfo()=default
SkYUVAPixmapInfo & operator=(const SkYUVAPixmapInfo &)=default
@ kUnorm10_Unorm2
10 bit unorm for Y, U, and V. 2 bit unorm for alpha (if present).
@ kUnorm8
8 bit unsigned normalized
@ kUnorm16
16 bit unsigned normalized
@ kFloat16
16 bit (half) floating point
bool operator!=(const SkYUVAPixmapInfo &that) const
DataType dataType() const
static constexpr int kDataTypeCnt
const SkImageInfo & planeInfo(int i) const
static constexpr auto kMaxPlanes
static constexpr SkColorType DefaultColorTypeForDataType(DataType dataType, int numChannels)
SkYUVAPixmaps & operator=(SkYUVAPixmaps &&that)=default
DataType dataType() const
SkYUVAPixmaps(const SkYUVAPixmaps &)=default
const SkYUVAInfo & yuvaInfo() const
const std::array< SkPixmap, kMaxPlanes > & planes() const
const SkPixmap & plane(int i) const
SkYUVAPixmaps(SkYUVAPixmaps &&that)=default
SkYUVAPixmaps & operator=(const SkYUVAPixmaps &that)=default
static void * Allocate(uword size, Zone *zone)
bool operator==(C p1, const scoped_nsprotocol< C > &p2)
SkYUVAPixmapInfo::DataType DataType