Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkImageInfoPriv.h File Reference
#include "include/core/SkColor.h"
#include "include/core/SkColorType.h"
#include "include/core/SkImageInfo.h"

Go to the source code of this file.

Functions

static uint32_t SkColorTypeChannelFlags (SkColorType ct)
 
static bool SkColorTypeIsAlphaOnly (SkColorType ct)
 
static bool SkAlphaTypeIsValid (unsigned value)
 
static int SkColorTypeShiftPerPixel (SkColorType ct)
 
static size_t SkColorTypeMinRowBytes (SkColorType ct, int width)
 
static bool SkColorTypeIsValid (unsigned value)
 
static size_t SkColorTypeComputeOffset (SkColorType ct, int x, int y, size_t rowBytes)
 
static bool SkColorTypeIsNormalized (SkColorType ct)
 
static int SkColorTypeMaxBitsPerChannel (SkColorType ct)
 
static bool SkColorInfoIsValid (const SkColorInfo &info)
 
static bool SkImageInfoIsValid (const SkImageInfo &info)
 
static bool SkImageInfoValidConversion (const SkImageInfo &dst, const SkImageInfo &src)
 

Function Documentation

◆ SkAlphaTypeIsValid()

static bool SkAlphaTypeIsValid ( unsigned  value)
inlinestatic

Definition at line 51 of file SkImageInfoPriv.h.

51 {
53}
@ kLastEnum_SkAlphaType
last valid value
Definition SkAlphaType.h:31
uint8_t value

◆ SkColorInfoIsValid()

static bool SkColorInfoIsValid ( const SkColorInfo info)
inlinestatic

Returns true if |info| contains a valid colorType and alphaType.

Definition at line 185 of file SkImageInfoPriv.h.

185 {
186 return info.colorType() != kUnknown_SkColorType && info.alphaType() != kUnknown_SkAlphaType;
187}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
@ kUnknown_SkAlphaType
uninitialized
Definition SkAlphaType.h:27
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20

◆ SkColorTypeChannelFlags()

static uint32_t SkColorTypeChannelFlags ( SkColorType  ct)
inlinestatic

Definition at line 15 of file SkImageInfoPriv.h.

15 {
16 switch (ct) {
17 case kUnknown_SkColorType: return 0;
43 }
45}
#define SkUNREACHABLE
Definition SkAssert.h:135
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
Definition SkColorType.h:50
@ kRGBA_10x6_SkColorType
pixel with 10 used bits (most significant) followed by 6 unused
Definition SkColorType.h:33
@ kR8_unorm_SkColorType
Definition SkColorType.h:54
@ kBGR_101010x_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word
Definition SkColorType.h:30
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
Definition SkColorType.h:23
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
Definition SkColorType.h:43
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition SkColorType.h:26
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
Definition SkColorType.h:48
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition SkColorType.h:38
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition SkColorType.h:21
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:29
@ kSRGBA_8888_SkColorType
Definition SkColorType.h:53
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition SkColorType.h:35
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition SkColorType.h:22
@ kBGRA_10101010_XR_SkColorType
pixel with 10 bits each for blue, green, red, alpha; in 64-bit word, extended range
Definition SkColorType.h:32
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition SkColorType.h:24
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:25
@ kBGRA_1010102_SkColorType
10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
Definition SkColorType.h:28
@ kA16_float_SkColorType
pixel with a half float for alpha
Definition SkColorType.h:45
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
Definition SkColorType.h:40
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
Definition SkColorType.h:27
@ kBGR_101010x_XR_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
Definition SkColorType.h:31
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
Definition SkColorType.h:49
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
Definition SkColorType.h:36
@ kR16G16_float_SkColorType
pixel with a half float for red and green
Definition SkColorType.h:46
@ kRGB_SkColorChannelFlags
Definition SkColor.h:247
@ kRGBA_SkColorChannelFlags
Definition SkColor.h:248
@ kRed_SkColorChannelFlag
Definition SkColor.h:239
@ kRG_SkColorChannelFlags
Definition SkColor.h:246
@ kAlpha_SkColorChannelFlag
Definition SkColor.h:242
@ kGray_SkColorChannelFlag
Definition SkColor.h:243

◆ SkColorTypeComputeOffset()

static size_t SkColorTypeComputeOffset ( SkColorType  ct,
int  x,
int  y,
size_t  rowBytes 
)
inlinestatic

Definition at line 95 of file SkImageInfoPriv.h.

95 {
96 if (kUnknown_SkColorType == ct) {
97 return 0;
98 }
99 return (size_t)y * rowBytes + ((size_t)x << SkColorTypeShiftPerPixel(ct));
100}
static int SkColorTypeShiftPerPixel(SkColorType ct)
double y
double x

◆ SkColorTypeIsAlphaOnly()

static bool SkColorTypeIsAlphaOnly ( SkColorType  ct)
inlinestatic

Definition at line 47 of file SkImageInfoPriv.h.

47 {
49}
static uint32_t SkColorTypeChannelFlags(SkColorType ct)

◆ SkColorTypeIsNormalized()

static bool SkColorTypeIsNormalized ( SkColorType  ct)
inlinestatic

Definition at line 102 of file SkImageInfoPriv.h.

◆ SkColorTypeIsValid()

static bool SkColorTypeIsValid ( unsigned  value)
inlinestatic

Definition at line 91 of file SkImageInfoPriv.h.

91 {
93}
@ kLastEnum_SkColorType
last valid value
Definition SkColorType.h:56

◆ SkColorTypeMaxBitsPerChannel()

static int SkColorTypeMaxBitsPerChannel ( SkColorType  ct)
inlinestatic

Definition at line 137 of file SkImageInfoPriv.h.

137 {
138 switch (ct) {
140 return 0;
141
143 return 4;
144
146 return 6;
147
156 return 8;
157
165 return 10;
166
174 return 16;
175
177 return 32;
178 }
180}

◆ SkColorTypeMinRowBytes()

static size_t SkColorTypeMinRowBytes ( SkColorType  ct,
int  width 
)
inlinestatic

Definition at line 87 of file SkImageInfoPriv.h.

87 {
88 return (size_t)(width * SkColorTypeBytesPerPixel(ct));
89}
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
int32_t width

◆ SkColorTypeShiftPerPixel()

static int SkColorTypeShiftPerPixel ( SkColorType  ct)
static

Definition at line 55 of file SkImageInfoPriv.h.

55 {
56 switch (ct) {
57 case kUnknown_SkColorType: return 0;
58 case kAlpha_8_SkColorType: return 0;
59 case kRGB_565_SkColorType: return 1;
60 case kARGB_4444_SkColorType: return 1;
61 case kRGBA_8888_SkColorType: return 2;
62 case kRGB_888x_SkColorType: return 2;
63 case kBGRA_8888_SkColorType: return 2;
64 case kRGBA_1010102_SkColorType: return 2;
65 case kRGB_101010x_SkColorType: return 2;
66 case kBGRA_1010102_SkColorType: return 2;
67 case kBGR_101010x_SkColorType: return 2;
68 case kBGR_101010x_XR_SkColorType: return 2;
69 case kBGRA_10101010_XR_SkColorType: return 3;
70 case kRGBA_10x6_SkColorType: return 3;
71 case kGray_8_SkColorType: return 0;
72 case kRGBA_F16Norm_SkColorType: return 3;
73 case kRGBA_F16_SkColorType: return 3;
74 case kRGBA_F32_SkColorType: return 4;
75 case kR8G8_unorm_SkColorType: return 1;
76 case kA16_unorm_SkColorType: return 1;
77 case kR16G16_unorm_SkColorType: return 2;
78 case kA16_float_SkColorType: return 1;
79 case kR16G16_float_SkColorType: return 2;
81 case kSRGBA_8888_SkColorType: return 2;
82 case kR8_unorm_SkColorType: return 0;
83 }
85}

◆ SkImageInfoIsValid()

static bool SkImageInfoIsValid ( const SkImageInfo info)
inlinestatic

Returns true if |info| contains a valid combination of width, height and colorInfo.

Definition at line 192 of file SkImageInfoPriv.h.

192 {
193 if (info.width() <= 0 || info.height() <= 0) {
194 return false;
195 }
196
197 const int kMaxDimension = SK_MaxS32 >> 2;
198 if (info.width() > kMaxDimension || info.height() > kMaxDimension) {
199 return false;
200 }
201
202 return SkColorInfoIsValid(info.colorInfo());
203}
static bool SkColorInfoIsValid(const SkColorInfo &info)
static constexpr int32_t SK_MaxS32
Definition SkMath.h:21

◆ SkImageInfoValidConversion()

static bool SkImageInfoValidConversion ( const SkImageInfo dst,
const SkImageInfo src 
)
inlinestatic

Returns true if Skia has defined a pixel conversion from the |src| to the |dst|. Returns false otherwise.

Definition at line 209 of file SkImageInfoPriv.h.

209 {
210 return SkImageInfoIsValid(dst) && SkImageInfoIsValid(src);
211}
static bool SkImageInfoIsValid(const SkImageInfo &info)