Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Attributes | List of all members
skgpu::graphite::YUVABackendTextures Class Reference

#include <YUVABackendTextures.h>

Public Member Functions

 YUVABackendTextures ()=default
 
 YUVABackendTextures (const YUVABackendTextures &)=delete
 
YUVABackendTexturesoperator= (const YUVABackendTextures &)=delete
 
 YUVABackendTextures (const Recorder *, const SkYUVAInfo &, SkSpan< const BackendTexture >)
 
SkSpan< const BackendTextureplaneTextures () const
 
BackendTexture planeTexture (int i) const
 
const SkYUVAInfoyuvaInfo () const
 
SkYUVColorSpace yuvColorSpace () const
 
int numPlanes () const
 
bool isValid () const
 
SkYUVAInfo::YUVALocations toYUVALocations () const
 

Static Public Attributes

static constexpr auto kMaxPlanes = SkYUVAInfo::kMaxPlanes
 

Detailed Description

A set of BackendTextures that hold the planar data for an image described a SkYUVAInfo.

Definition at line 85 of file YUVABackendTextures.h.

Constructor & Destructor Documentation

◆ YUVABackendTextures() [1/3]

skgpu::graphite::YUVABackendTextures::YUVABackendTextures ( )
default

◆ YUVABackendTextures() [2/3]

skgpu::graphite::YUVABackendTextures::YUVABackendTextures ( const YUVABackendTextures )
delete

◆ YUVABackendTextures() [3/3]

skgpu::graphite::YUVABackendTextures::YUVABackendTextures ( const Recorder recorder,
const SkYUVAInfo yuvaInfo,
SkSpan< const BackendTexture textures 
)

Initializes a YUVABackendTextures object from a set of textures that store the planes indicated by the SkYUVAInfo. This will produce an invalid result (return false from isValid()) if the passed texture formats' channels don't agree with SkYUVAInfo.

Definition at line 80 of file YUVABackendTextures.cpp.

83 : fYUVAInfo(yuvaInfo) {
84 if (!yuvaInfo.isValid()) {
85 SkASSERT(!this->isValid());
86 return;
87 }
88 SkISize planeDimensions[kMaxPlanes];
89 int numPlanes = yuvaInfo.planeDimensions(planeDimensions);
90 if (numPlanes == 0 || (size_t)numPlanes > textures.size()) {
91 fYUVAInfo = {};
92 SkASSERT(!this->isValid());
93 return;
94 }
95 for (int i = 0; i < numPlanes; ++i) {
96 int numRequiredChannels = yuvaInfo.numChannelsInPlane(i);
97 SkASSERT(numRequiredChannels > 0);
98 fPlaneChannelMasks[i] = recorder->priv().caps()->channelMask(textures[i].info());
99 if (!textures[i].isValid() ||
100 textures[i].dimensions() != planeDimensions[i] ||
101 textures[i].backend() != textures[0].backend() ||
102 num_channels(fPlaneChannelMasks[i]) < numRequiredChannels) {
103 SkASSERT(!this->isValid());
104 return;
105 }
106 fPlaneTextures[i] = textures[i];
107 }
108 SkASSERT(this->isValid());
109}
const char * backend
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static int num_channels(const GrBackendFormat &format)
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr size_t size() const
Definition: SkSpan_impl.h:95
int planeDimensions(SkISize planeDimensions[kMaxPlanes]) const
Definition: SkYUVAInfo.h:192
bool isValid() const
Definition: SkYUVAInfo.h:233
int numChannelsInPlane(int i) const
Definition: SkYUVAInfo.h:206
virtual uint32_t channelMask(const TextureInfo &) const =0
const Caps * caps() const
Definition: RecorderPriv.h:31
Definition: SkSize.h:16

Member Function Documentation

◆ isValid()

bool skgpu::graphite::YUVABackendTextures::isValid ( ) const
inline

Returns true if this has been configured with a valid SkYUVAInfo with compatible texture formats.

Definition at line 123 of file YUVABackendTextures.h.

123{ return fYUVAInfo.isValid(); }

◆ numPlanes()

int skgpu::graphite::YUVABackendTextures::numPlanes ( ) const
inline

The number of planes, 0 if this YUVABackendTextureInfo is invalid.

Definition at line 117 of file YUVABackendTextures.h.

117{ return fYUVAInfo.numPlanes(); }
int numPlanes() const
Definition: SkYUVAInfo.h:204

◆ operator=()

YUVABackendTextures & skgpu::graphite::YUVABackendTextures::operator= ( const YUVABackendTextures )
delete

◆ planeTexture()

BackendTexture skgpu::graphite::YUVABackendTextures::planeTexture ( int  i) const
inline

BackendTexture for the ith plane, or invalid if i >= numPlanes()

Definition at line 107 of file YUVABackendTextures.h.

107 {
108 SkASSERT(i >= 0);
109 return fPlaneTextures[static_cast<size_t>(i)];
110 }

◆ planeTextures()

SkSpan< const BackendTexture > skgpu::graphite::YUVABackendTextures::planeTextures ( ) const
inline

Definition at line 102 of file YUVABackendTextures.h.

102 {
103 return SkSpan<const BackendTexture>(fPlaneTextures);
104 }

◆ toYUVALocations()

SkYUVAInfo::YUVALocations skgpu::graphite::YUVABackendTextures::toYUVALocations ( ) const

Computes a YUVALocations representation of the planar layout. The result is guaranteed to be valid if this->isValid().

Definition at line 111 of file YUVABackendTextures.cpp.

111 {
112 auto result = fYUVAInfo.toYUVALocations(fPlaneChannelMasks.data());
115 SkASSERT(numPlanes == this->numPlanes());
116 return result;
117}
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
YUVALocations toYUVALocations(const uint32_t *channelFlags) const
Definition: SkYUVAInfo.cpp:358
GAsyncResult * result
static bool AreValidLocations(const SkYUVAInfo::YUVALocations &locations, int *numPlanes=nullptr)

◆ yuvaInfo()

const SkYUVAInfo & skgpu::graphite::YUVABackendTextures::yuvaInfo ( ) const
inline

Definition at line 112 of file YUVABackendTextures.h.

112{ return fYUVAInfo; }

◆ yuvColorSpace()

SkYUVColorSpace skgpu::graphite::YUVABackendTextures::yuvColorSpace ( ) const
inline

Definition at line 114 of file YUVABackendTextures.h.

114{ return fYUVAInfo.yuvColorSpace(); }
SkYUVColorSpace yuvColorSpace() const
Definition: SkYUVAInfo.h:175

Member Data Documentation

◆ kMaxPlanes

constexpr auto skgpu::graphite::YUVABackendTextures::kMaxPlanes = SkYUVAInfo::kMaxPlanes
staticconstexpr

Definition at line 87 of file YUVABackendTextures.h.


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