Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkYUVAInfo.cpp File Reference
#include "include/core/SkYUVAInfo.h"
#include "include/core/SkColor.h"
#include "src/base/SkSafeMath.h"
#include "src/core/SkYUVAInfoLocation.h"
#include <algorithm>

Go to the source code of this file.

Functions

static bool is_plane_config_compatible_with_subsampling (SkYUVAInfo::PlaneConfig config, SkYUVAInfo::Subsampling subsampling)
 
static bool channel_index_to_channel (uint32_t channelFlags, int channelIdx, SkColorChannel *channel)
 

Function Documentation

◆ channel_index_to_channel()

static bool channel_index_to_channel ( uint32_t  channelFlags,
int  channelIdx,
SkColorChannel channel 
)
static

Definition at line 144 of file SkYUVAInfo.cpp.

146 {
147 switch (channelFlags) {
148 case kGray_SkColorChannelFlag: // For gray returning any of R, G, or B for index 0 is ok.
150 if (channelIdx == 0) {
151 *channel = SkColorChannel::kR;
152 return true;
153 }
154 return false;
156 switch (channelIdx) {
157 case 0: *channel = SkColorChannel::kR; return true;
158 case 1: *channel = SkColorChannel::kA; return true;
159
160 default: return false;
161 }
163 if (channelIdx == 0) {
164 *channel = SkColorChannel::kA;
165 return true;
166 }
167 return false;
169 if (channelIdx == 0 || channelIdx == 1) {
170 *channel = static_cast<SkColorChannel>(channelIdx);
171 return true;
172 }
173 return false;
175 if (channelIdx >= 0 && channelIdx <= 2) {
176 *channel = static_cast<SkColorChannel>(channelIdx);
177 return true;
178 }
179 return false;
181 if (channelIdx >= 0 && channelIdx <= 3) {
182 *channel = static_cast<SkColorChannel>(channelIdx);
183 return true;
184 }
185 return false;
186 default:
187 return false;
188 }
189}
SkColorChannel
Definition SkColor.h:228
@ kRGB_SkColorChannelFlags
Definition SkColor.h:247
@ kRGBA_SkColorChannelFlags
Definition SkColor.h:248
@ kRed_SkColorChannelFlag
Definition SkColor.h:239
@ kGrayAlpha_SkColorChannelFlags
Definition SkColor.h:245
@ kRG_SkColorChannelFlags
Definition SkColor.h:246
@ kAlpha_SkColorChannelFlag
Definition SkColor.h:242
@ kGray_SkColorChannelFlag
Definition SkColor.h:243

◆ is_plane_config_compatible_with_subsampling()

static bool is_plane_config_compatible_with_subsampling ( SkYUVAInfo::PlaneConfig  config,
SkYUVAInfo::Subsampling  subsampling 
)
static

Definition at line 16 of file SkYUVAInfo.cpp.

17 {
19 subsampling == SkYUVAInfo::Subsampling::kUnknown) {
20 return false;
21 }
22 return subsampling == SkYUVAInfo::Subsampling::k444 ||
27}
@ kYUVA
Plane 0: YUVA.
@ kUYVA
Plane 0: UYVA.
@ k444
No subsampling. UV values for each Y.