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

#include <YUVABackendTextures.h>

Public Member Functions

 YUVABackendTextureInfo ()=default
 
 YUVABackendTextureInfo (const YUVABackendTextureInfo &)=default
 
YUVABackendTextureInfooperator= (const YUVABackendTextureInfo &)=default
 
 YUVABackendTextureInfo (const Recorder *, const SkYUVAInfo &, SkSpan< const TextureInfo >, Mipmapped)
 
bool operator== (const YUVABackendTextureInfo &) const
 
bool operator!= (const YUVABackendTextureInfo &that) const
 
const TextureInfoplaneTextureInfo (int i) const
 
const SkYUVAInfoyuvaInfo () const
 
SkYUVColorSpace yuvColorSpace () const
 
Mipmapped mipmapped () const
 
int numPlanes () const
 
bool isValid () const
 
SkYUVAInfo::YUVALocations toYUVALocations () const
 

Static Public Attributes

static constexpr auto kMaxPlanes = SkYUVAInfo::kMaxPlanes
 

Detailed Description

A description of a set of BackendTextures that hold the planar data described by a SkYUVAInfo.

Definition at line 23 of file YUVABackendTextures.h.

Constructor & Destructor Documentation

◆ YUVABackendTextureInfo() [1/3]

skgpu::graphite::YUVABackendTextureInfo::YUVABackendTextureInfo ( )
default

Default YUVABackendTextureInfo is invalid.

◆ YUVABackendTextureInfo() [2/3]

skgpu::graphite::YUVABackendTextureInfo::YUVABackendTextureInfo ( const YUVABackendTextureInfo )
default

◆ YUVABackendTextureInfo() [3/3]

skgpu::graphite::YUVABackendTextureInfo::YUVABackendTextureInfo ( const Recorder recorder,
const SkYUVAInfo yuvaInfo,
SkSpan< const TextureInfo textureInfo,
Mipmapped  mipmapped 
)

Initializes a YUVABackendTextureInfo to describe a set of textures that can store the planes indicated by the SkYUVAInfo. The texture dimensions are taken from the SkYUVAInfo's plane dimensions. All the described textures share a common origin. The planar image this describes will be mip mapped if all the textures are individually mip mapped as indicated by Mipmapped. This will produce an invalid result (return false from isValid()) if the passed formats' channels don't agree with SkYUVAInfo.

Definition at line 33 of file YUVABackendTextures.cpp.

37 : fYUVAInfo(yuvaInfo)
38 , fMipmapped(mipmapped) {
40 if (!yuvaInfo.isValid() ||
41 numPlanes == 0 ||
42 (size_t)numPlanes > textureInfo.size()) {
43 *this = {};
44 SkASSERT(!this->isValid());
45 return;
46 }
47 for (int i = 0; i < numPlanes; ++i) {
48 int numRequiredChannels = yuvaInfo.numChannelsInPlane(i);
49 SkASSERT(numRequiredChannels > 0);
50 fPlaneChannelMasks[i] = recorder->priv().caps()->channelMask(textureInfo[i]);
51 if (!textureInfo[i].isValid() ||
52 textureInfo[i].backend() != textureInfo[0].backend() ||
53 num_channels(fPlaneChannelMasks[i]) < numRequiredChannels) {
54 *this = {};
55 SkASSERT(!this->isValid());
56 return;
57 }
58 fPlaneTextureInfos[i] = textureInfo[i];
59 }
60 SkASSERT(this->isValid());
61}
const char * backend
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 numPlanes() const
Definition: SkYUVAInfo.h:204
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

Member Function Documentation

◆ isValid()

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

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

Definition at line 67 of file YUVABackendTextures.h.

67{ return fYUVAInfo.isValid(); }

◆ mipmapped()

Mipmapped skgpu::graphite::YUVABackendTextureInfo::mipmapped ( ) const
inline

Definition at line 58 of file YUVABackendTextures.h.

58{ return fMipmapped; }

◆ numPlanes()

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

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

Definition at line 61 of file YUVABackendTextures.h.

61{ return fYUVAInfo.numPlanes(); }

◆ operator!=()

bool skgpu::graphite::YUVABackendTextureInfo::operator!= ( const YUVABackendTextureInfo that) const
inline

Definition at line 46 of file YUVABackendTextures.h.

46{ return !(*this == that); }

◆ operator=()

YUVABackendTextureInfo & skgpu::graphite::YUVABackendTextureInfo::operator= ( const YUVABackendTextureInfo )
default

◆ operator==()

bool skgpu::graphite::YUVABackendTextureInfo::operator== ( const YUVABackendTextureInfo that) const

Definition at line 63 of file YUVABackendTextures.cpp.

63 {
64 if (fYUVAInfo != that.fYUVAInfo || fMipmapped != that.fMipmapped) {
65 return false;
66 }
67 return fPlaneTextureInfos == that.fPlaneTextureInfos;
68}

◆ planeTextureInfo()

const TextureInfo & skgpu::graphite::YUVABackendTextureInfo::planeTextureInfo ( int  i) const
inline

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

Definition at line 49 of file YUVABackendTextures.h.

49 {
50 SkASSERT(i >= 0);
51 return fPlaneTextureInfos[static_cast<size_t>(i)];
52 }

◆ toYUVALocations()

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

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

Definition at line 70 of file YUVABackendTextures.cpp.

70 {
71 auto result = fYUVAInfo.toYUVALocations(fPlaneChannelMasks.data());
74 SkASSERT(numPlanes == this->numPlanes());
75 return result;
76}
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::YUVABackendTextureInfo::yuvaInfo ( ) const
inline

Definition at line 54 of file YUVABackendTextures.h.

54{ return fYUVAInfo; }

◆ yuvColorSpace()

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

Definition at line 56 of file YUVABackendTextures.h.

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

Member Data Documentation

◆ kMaxPlanes

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

Definition at line 25 of file YUVABackendTextures.h.


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