Flutter Engine
The Flutter Engine
Macros | Typedefs | Functions | Variables
SkColorData.h File Reference
#include "include/core/SkColor.h"
#include "include/core/SkColorPriv.h"
#include "include/private/base/SkTo.h"

Go to the source code of this file.

Macros

#define SK_R16_BITS   5
 
#define SK_G16_BITS   6
 
#define SK_B16_BITS   5
 
#define SK_R16_SHIFT   (SK_B16_BITS + SK_G16_BITS)
 
#define SK_G16_SHIFT   (SK_B16_BITS)
 
#define SK_B16_SHIFT   0
 
#define SK_R16_MASK   ((1 << SK_R16_BITS) - 1)
 
#define SK_G16_MASK   ((1 << SK_G16_BITS) - 1)
 
#define SK_B16_MASK   ((1 << SK_B16_BITS) - 1)
 
#define SkGetPackedR16(color)   (((unsigned)(color) >> SK_R16_SHIFT) & SK_R16_MASK)
 
#define SkGetPackedG16(color)   (((unsigned)(color) >> SK_G16_SHIFT) & SK_G16_MASK)
 
#define SkGetPackedB16(color)   (((unsigned)(color) >> SK_B16_SHIFT) & SK_B16_MASK)
 
#define SkPacked16ToR32(c)   SkR16ToR32(SkGetPackedR16(c))
 
#define SkPacked16ToG32(c)   SkG16ToG32(SkGetPackedG16(c))
 
#define SkPacked16ToB32(c)   SkB16ToB32(SkGetPackedB16(c))
 
#define SkASSERT_IS_BYTE(x)   SkASSERT(0 == ((x) & ~0xFFu))
 
#define SK_R16_MASK_IN_PLACE   (SK_R16_MASK << SK_R16_SHIFT)
 
#define SK_G16_MASK_IN_PLACE   (SK_G16_MASK << SK_G16_SHIFT)
 
#define SK_B16_MASK_IN_PLACE   (SK_B16_MASK << SK_B16_SHIFT)
 
#define SkR32ToR16_MACRO(r)   ((unsigned)(r) >> (SK_R32_BITS - SK_R16_BITS))
 
#define SkG32ToG16_MACRO(g)   ((unsigned)(g) >> (SK_G32_BITS - SK_G16_BITS))
 
#define SkB32ToB16_MACRO(b)   ((unsigned)(b) >> (SK_B32_BITS - SK_B16_BITS))
 
#define SkR32ToR16(r)   SkR32ToR16_MACRO(r)
 
#define SkG32ToG16(g)   SkG32ToG16_MACRO(g)
 
#define SkB32ToB16(b)   SkB32ToB16_MACRO(b)
 
#define SK_A4444_SHIFT   0
 
#define SK_R4444_SHIFT   12
 
#define SK_G4444_SHIFT   8
 
#define SK_B4444_SHIFT   4
 
#define SkGetPackedA4444(c)   (((unsigned)(c) >> SK_A4444_SHIFT) & 0xF)
 
#define SkGetPackedR4444(c)   (((unsigned)(c) >> SK_R4444_SHIFT) & 0xF)
 
#define SkGetPackedG4444(c)   (((unsigned)(c) >> SK_G4444_SHIFT) & 0xF)
 
#define SkGetPackedB4444(c)   (((unsigned)(c) >> SK_B4444_SHIFT) & 0xF)
 
#define SkPacked4444ToA32(c)   SkReplicateNibble(SkGetPackedA4444(c))
 
#define SK_ITU_BT709_LUM_COEFF_R   (0.2126f)
 
#define SK_ITU_BT709_LUM_COEFF_G   (0.7152f)
 
#define SK_ITU_BT709_LUM_COEFF_B   (0.0722f)
 
#define SK_LUM_COEFF_R   SK_ITU_BT709_LUM_COEFF_R
 
#define SK_LUM_COEFF_G   SK_ITU_BT709_LUM_COEFF_G
 
#define SK_LUM_COEFF_B   SK_ITU_BT709_LUM_COEFF_B
 

Typedefs

typedef uint16_t SkPMColor16
 
using SkPMColor4f = SkRGBA4f< kPremul_SkAlphaType >
 

Functions

static unsigned SkR16ToR32 (unsigned r)
 
static unsigned SkG16ToG32 (unsigned g)
 
static unsigned SkB16ToB32 (unsigned b)
 
static uint32_t SkSwizzle_RB (uint32_t c)
 
static uint32_t SkPackARGB_as_RGBA (U8CPU a, U8CPU r, U8CPU g, U8CPU b)
 
static uint32_t SkPackARGB_as_BGRA (U8CPU a, U8CPU r, U8CPU g, U8CPU b)
 
static SkPMColor SkSwizzle_RGBA_to_PMColor (uint32_t c)
 
static SkPMColor SkSwizzle_BGRA_to_PMColor (uint32_t c)
 
static U8CPU SkComputeLuminance (U8CPU r, U8CPU g, U8CPU b)
 
static U16CPU SkAlphaMulInv256 (U16CPU value, U16CPU alpha256)
 
static int SkAlphaBlend (int src, int dst, int scale256)
 
static uint16_t SkPackRGB16 (unsigned r, unsigned g, unsigned b)
 
static SkPMColor SkFourByteInterp256 (SkPMColor src, SkPMColor dst, int scale)
 
static SkPMColor SkFourByteInterp (SkPMColor src, SkPMColor dst, U8CPU srcWeight)
 
static void SkSplay (uint32_t color, uint32_t *ag, uint32_t *rb)
 
static uint64_t SkSplay (uint32_t color)
 
static uint32_t SkUnsplay (uint32_t ag, uint32_t rb)
 
static uint32_t SkUnsplay (uint64_t agrb)
 
static SkPMColor SkFastFourByteInterp256_32 (SkPMColor src, SkPMColor dst, unsigned scale)
 
static SkPMColor SkFastFourByteInterp256_64 (SkPMColor src, SkPMColor dst, unsigned scale)
 
static SkPMColor SkFastFourByteInterp256 (SkPMColor src, SkPMColor dst, unsigned scale)
 
static SkPMColor SkFastFourByteInterp (SkPMColor src, SkPMColor dst, U8CPU srcWeight)
 
static SkPMColor SkPMLerp (SkPMColor src, SkPMColor dst, unsigned scale)
 
static SkPMColor SkBlendARGB32 (SkPMColor src, SkPMColor dst, U8CPU aa)
 
static U16CPU SkPixel32ToPixel16 (SkPMColor c)
 
static U16CPU SkPack888ToRGB16 (U8CPU r, U8CPU g, U8CPU b)
 
static SkColor SkPixel16ToColor (U16CPU src)
 
static U8CPU SkReplicateNibble (unsigned nib)
 
static SkPMColor SkPixel4444ToPixel32 (U16CPU c)
 

Variables

constexpr SkPMColor4f SK_PMColor4fTRANSPARENT = { 0, 0, 0, 0 }
 
constexpr SkPMColor4f SK_PMColor4fBLACK = { 0, 0, 0, 1 }
 
constexpr SkPMColor4f SK_PMColor4fWHITE = { 1, 1, 1, 1 }
 
constexpr SkPMColor4f SK_PMColor4fILLEGAL
 

Macro Definition Documentation

◆ SK_A4444_SHIFT

#define SK_A4444_SHIFT   0

Definition at line 351 of file SkColorData.h.

◆ SK_B16_BITS

#define SK_B16_BITS   5

Definition at line 20 of file SkColorData.h.

◆ SK_B16_MASK

#define SK_B16_MASK   ((1 << SK_B16_BITS) - 1)

Definition at line 28 of file SkColorData.h.

◆ SK_B16_MASK_IN_PLACE

#define SK_B16_MASK_IN_PLACE   (SK_B16_MASK << SK_B16_SHIFT)

Definition at line 151 of file SkColorData.h.

◆ SK_B16_SHIFT

#define SK_B16_SHIFT   0

Definition at line 24 of file SkColorData.h.

◆ SK_B4444_SHIFT

#define SK_B4444_SHIFT   4

Definition at line 354 of file SkColorData.h.

◆ SK_G16_BITS

#define SK_G16_BITS   6

Definition at line 19 of file SkColorData.h.

◆ SK_G16_MASK

#define SK_G16_MASK   ((1 << SK_G16_BITS) - 1)

Definition at line 27 of file SkColorData.h.

◆ SK_G16_MASK_IN_PLACE

#define SK_G16_MASK_IN_PLACE   (SK_G16_MASK << SK_G16_SHIFT)

Definition at line 150 of file SkColorData.h.

◆ SK_G16_SHIFT

#define SK_G16_SHIFT   (SK_B16_BITS)

Definition at line 23 of file SkColorData.h.

◆ SK_G4444_SHIFT

#define SK_G4444_SHIFT   8

Definition at line 353 of file SkColorData.h.

◆ SK_ITU_BT709_LUM_COEFF_B

#define SK_ITU_BT709_LUM_COEFF_B   (0.0722f)

Definition at line 105 of file SkColorData.h.

◆ SK_ITU_BT709_LUM_COEFF_G

#define SK_ITU_BT709_LUM_COEFF_G   (0.7152f)

Definition at line 104 of file SkColorData.h.

◆ SK_ITU_BT709_LUM_COEFF_R

#define SK_ITU_BT709_LUM_COEFF_R   (0.2126f)

See ITU-R Recommendation BT.709 at http://www.itu.int/rec/R-REC-BT.709/ .

Definition at line 103 of file SkColorData.h.

◆ SK_LUM_COEFF_B

#define SK_LUM_COEFF_B   SK_ITU_BT709_LUM_COEFF_B

Definition at line 112 of file SkColorData.h.

◆ SK_LUM_COEFF_G

#define SK_LUM_COEFF_G   SK_ITU_BT709_LUM_COEFF_G

Definition at line 111 of file SkColorData.h.

◆ SK_LUM_COEFF_R

#define SK_LUM_COEFF_R   SK_ITU_BT709_LUM_COEFF_R

A float value which specifies this channel's contribution to luminance.

Definition at line 110 of file SkColorData.h.

◆ SK_R16_BITS

#define SK_R16_BITS   5

Definition at line 18 of file SkColorData.h.

◆ SK_R16_MASK

#define SK_R16_MASK   ((1 << SK_R16_BITS) - 1)

Definition at line 26 of file SkColorData.h.

◆ SK_R16_MASK_IN_PLACE

#define SK_R16_MASK_IN_PLACE   (SK_R16_MASK << SK_R16_SHIFT)

Definition at line 149 of file SkColorData.h.

◆ SK_R16_SHIFT

#define SK_R16_SHIFT   (SK_B16_BITS + SK_G16_BITS)

Definition at line 22 of file SkColorData.h.

◆ SK_R4444_SHIFT

#define SK_R4444_SHIFT   12

Definition at line 352 of file SkColorData.h.

◆ SkASSERT_IS_BYTE

#define SkASSERT_IS_BYTE (   x)    SkASSERT(0 == ((x) & ~0xFFu))

Definition at line 52 of file SkColorData.h.

◆ SkB32ToB16

#define SkB32ToB16 (   b)    SkB32ToB16_MACRO(b)

Definition at line 314 of file SkColorData.h.

◆ SkB32ToB16_MACRO

#define SkB32ToB16_MACRO (   b)    ((unsigned)(b) >> (SK_B32_BITS - SK_B16_BITS))

Definition at line 296 of file SkColorData.h.

◆ SkG32ToG16

#define SkG32ToG16 (   g)    SkG32ToG16_MACRO(g)

Definition at line 313 of file SkColorData.h.

◆ SkG32ToG16_MACRO

#define SkG32ToG16_MACRO (   g)    ((unsigned)(g) >> (SK_G32_BITS - SK_G16_BITS))

Definition at line 295 of file SkColorData.h.

◆ SkGetPackedA4444

#define SkGetPackedA4444 (   c)    (((unsigned)(c) >> SK_A4444_SHIFT) & 0xF)

Definition at line 361 of file SkColorData.h.

◆ SkGetPackedB16

#define SkGetPackedB16 (   color)    (((unsigned)(color) >> SK_B16_SHIFT) & SK_B16_MASK)

Definition at line 32 of file SkColorData.h.

◆ SkGetPackedB4444

#define SkGetPackedB4444 (   c)    (((unsigned)(c) >> SK_B4444_SHIFT) & 0xF)

Definition at line 364 of file SkColorData.h.

◆ SkGetPackedG16

#define SkGetPackedG16 (   color)    (((unsigned)(color) >> SK_G16_SHIFT) & SK_G16_MASK)

Definition at line 31 of file SkColorData.h.

◆ SkGetPackedG4444

#define SkGetPackedG4444 (   c)    (((unsigned)(c) >> SK_G4444_SHIFT) & 0xF)

Definition at line 363 of file SkColorData.h.

◆ SkGetPackedR16

#define SkGetPackedR16 (   color)    (((unsigned)(color) >> SK_R16_SHIFT) & SK_R16_MASK)

Definition at line 30 of file SkColorData.h.

◆ SkGetPackedR4444

#define SkGetPackedR4444 (   c)    (((unsigned)(c) >> SK_R4444_SHIFT) & 0xF)

Definition at line 362 of file SkColorData.h.

◆ SkPacked16ToB32

#define SkPacked16ToB32 (   c)    SkB16ToB32(SkGetPackedB16(c))

Definition at line 48 of file SkColorData.h.

◆ SkPacked16ToG32

#define SkPacked16ToG32 (   c)    SkG16ToG32(SkGetPackedG16(c))

Definition at line 47 of file SkColorData.h.

◆ SkPacked16ToR32

#define SkPacked16ToR32 (   c)    SkR16ToR32(SkGetPackedR16(c))

Definition at line 46 of file SkColorData.h.

◆ SkPacked4444ToA32

#define SkPacked4444ToA32 (   c)    SkReplicateNibble(SkGetPackedA4444(c))

Definition at line 366 of file SkColorData.h.

◆ SkR32ToR16

#define SkR32ToR16 (   r)    SkR32ToR16_MACRO(r)

Definition at line 312 of file SkColorData.h.

◆ SkR32ToR16_MACRO

#define SkR32ToR16_MACRO (   r)    ((unsigned)(r) >> (SK_R32_BITS - SK_R16_BITS))

Definition at line 294 of file SkColorData.h.

Typedef Documentation

◆ SkPMColor16

typedef uint16_t SkPMColor16

Definition at line 348 of file SkColorData.h.

◆ SkPMColor4f

Definition at line 376 of file SkColorData.h.

Function Documentation

◆ SkAlphaBlend()

static int SkAlphaBlend ( int  src,
int  dst,
int  scale256 
)
inlinestatic

Definition at line 136 of file SkColorData.h.

136 {
137 SkASSERT((unsigned)scale256 <= 256);
138 return dst + SkAlphaMul(src - dst, scale256);
139}
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkAlphaMul(value, alpha256)
Definition: SkColorPriv.h:34
dst
Definition: cp.py:12

◆ SkAlphaMulInv256()

static U16CPU SkAlphaMulInv256 ( U16CPU  value,
U16CPU  alpha256 
)
inlinestatic

Calculates 256 - (value * alpha256) / 255 in range [0,256], for [0,255] value and [0,256] alpha256.

Definition at line 128 of file SkColorData.h.

128 {
129 unsigned prod = 0xFFFF - value * alpha256;
130 return (prod + (prod >> 8)) >> 8;
131}
uint8_t value

◆ SkB16ToB32()

static unsigned SkB16ToB32 ( unsigned  b)
inlinestatic

Definition at line 42 of file SkColorData.h.

42 {
43 return (b << (8 - SK_B16_BITS)) | (b >> (2 * SK_B16_BITS - 8));
44}
#define SK_B16_BITS
Definition: SkColorData.h:20
static bool b

◆ SkBlendARGB32()

static SkPMColor SkBlendARGB32 ( SkPMColor  src,
SkPMColor  dst,
U8CPU  aa 
)
inlinestatic

Definition at line 274 of file SkColorData.h.

274 {
275 SkASSERT((unsigned)aa <= 255);
276
277 unsigned src_scale = SkAlpha255To256(aa);
278 unsigned dst_scale = SkAlphaMulInv256(SkGetPackedA32(src), src_scale);
279
280 const uint32_t mask = 0xFF00FF;
281
282 uint32_t src_rb = (src & mask) * src_scale;
283 uint32_t src_ag = ((src >> 8) & mask) * src_scale;
284
285 uint32_t dst_rb = (dst & mask) * dst_scale;
286 uint32_t dst_ag = ((dst >> 8) & mask) * dst_scale;
287
288 return (((src_rb + dst_rb) >> 8) & mask) | ((src_ag + dst_ag) & ~mask);
289}
static U16CPU SkAlphaMulInv256(U16CPU value, U16CPU alpha256)
Definition: SkColorData.h:128
#define SkGetPackedA32(packed)
Definition: SkColorPriv.h:92
static unsigned SkAlpha255To256(U8CPU alpha)
Definition: SkColorPriv.h:24

◆ SkComputeLuminance()

static U8CPU SkComputeLuminance ( U8CPU  r,
U8CPU  g,
U8CPU  b 
)
inlinestatic

Computes the luminance from the given r, g, and b in accordance with SK_LUM_COEFF_X. For correct results, r, g, and b should be in linear space.

Definition at line 118 of file SkColorData.h.

118 {
119 //The following is
120 //r * SK_LUM_COEFF_R + g * SK_LUM_COEFF_G + b * SK_LUM_COEFF_B
121 //with SK_LUM_COEFF_X in 1.8 fixed point (rounding adjusted to sum to 256).
122 return (r * 54 + g * 183 + b * 19) >> 8;
123}

◆ SkFastFourByteInterp()

static SkPMColor SkFastFourByteInterp ( SkPMColor  src,
SkPMColor  dst,
U8CPU  srcWeight 
)
inlinestatic

Nearly the same as SkFourByteInterp, but faster and a touch more accurate, due to better srcWeight scaling to [0, 256].

Definition at line 260 of file SkColorData.h.

260 {
261 SkASSERT(srcWeight <= 255);
262 // scale = srcWeight + (srcWeight >> 7) is more accurate than
263 // scale = srcWeight + 1, but 7% slower
264 return SkFastFourByteInterp256(src, dst, srcWeight + (srcWeight >> 7));
265}
static SkPMColor SkFastFourByteInterp256(SkPMColor src, SkPMColor dst, unsigned scale)
Definition: SkColorData.h:247

◆ SkFastFourByteInterp256()

static SkPMColor SkFastFourByteInterp256 ( SkPMColor  src,
SkPMColor  dst,
unsigned  scale 
)
inlinestatic

Same as SkFourByteInterp256, but faster.

Definition at line 247 of file SkColorData.h.

247 {
248 // On a 64-bit machine, _64 is about 10% faster than _32, but ~40% slower on a 32-bit machine.
249 if (sizeof(void*) == 4) {
251 } else {
253 }
254}
static SkPMColor SkFastFourByteInterp256_64(SkPMColor src, SkPMColor dst, unsigned scale)
Definition: SkColorData.h:236
static SkPMColor SkFastFourByteInterp256_32(SkPMColor src, SkPMColor dst, unsigned scale)
Definition: SkColorData.h:222
const Scalar scale

◆ SkFastFourByteInterp256_32()

static SkPMColor SkFastFourByteInterp256_32 ( SkPMColor  src,
SkPMColor  dst,
unsigned  scale 
)
inlinestatic

Definition at line 222 of file SkColorData.h.

222 {
223 SkASSERT(scale <= 256);
224
225 // Two 8-bit blends per two 32-bit registers, with space to make sure the math doesn't collide.
226 uint32_t src_ag, src_rb, dst_ag, dst_rb;
227 SkSplay(src, &src_ag, &src_rb);
228 SkSplay(dst, &dst_ag, &dst_rb);
229
230 const uint32_t ret_ag = src_ag * scale + (256 - scale) * dst_ag;
231 const uint32_t ret_rb = src_rb * scale + (256 - scale) * dst_rb;
232
233 return SkUnsplay(ret_ag, ret_rb);
234}
static void SkSplay(uint32_t color, uint32_t *ag, uint32_t *rb)
Definition: SkColorData.h:185
static uint32_t SkUnsplay(uint32_t ag, uint32_t rb)
Definition: SkColorData.h:206

◆ SkFastFourByteInterp256_64()

static SkPMColor SkFastFourByteInterp256_64 ( SkPMColor  src,
SkPMColor  dst,
unsigned  scale 
)
inlinestatic

Definition at line 236 of file SkColorData.h.

236 {
237 SkASSERT(scale <= 256);
238 // Four 8-bit blends in one 64-bit register, with space to make sure the math doesn't collide.
239 return SkUnsplay(SkSplay(src) * scale + (256-scale) * SkSplay(dst));
240}

◆ SkFourByteInterp()

static SkPMColor SkFourByteInterp ( SkPMColor  src,
SkPMColor  dst,
U8CPU  srcWeight 
)
inlinestatic

Abstract 4-byte interpolation, implemented on top of SkPMColor utility functions. Third parameter controls blending of the first two: (src, dst, 0) returns dst (src, dst, 0xFF) returns src

Definition at line 177 of file SkColorData.h.

177 {
178 int scale = (int)SkAlpha255To256(srcWeight);
180}
static SkPMColor SkFourByteInterp256(SkPMColor src, SkPMColor dst, int scale)
Definition: SkColorData.h:162

◆ SkFourByteInterp256()

static SkPMColor SkFourByteInterp256 ( SkPMColor  src,
SkPMColor  dst,
int  scale 
)
inlinestatic

Abstract 4-byte interpolation, implemented on top of SkPMColor utility functions. Third parameter controls blending of the first two: (src, dst, 0) returns dst (src, dst, 0xFF) returns src scale is [0..256], unlike SkFourByteInterp which takes [0..255]

Definition at line 162 of file SkColorData.h.

162 {
163 unsigned a = SkTo<uint8_t>(SkAlphaBlend(SkGetPackedA32(src), SkGetPackedA32(dst), scale));
164 unsigned r = SkTo<uint8_t>(SkAlphaBlend(SkGetPackedR32(src), SkGetPackedR32(dst), scale));
165 unsigned g = SkTo<uint8_t>(SkAlphaBlend(SkGetPackedG32(src), SkGetPackedG32(dst), scale));
166 unsigned b = SkTo<uint8_t>(SkAlphaBlend(SkGetPackedB32(src), SkGetPackedB32(dst), scale));
167
168 return SkPackARGB32(a, r, g, b);
169}
static int SkAlphaBlend(int src, int dst, int scale256)
Definition: SkColorData.h:136
#define SkGetPackedB32(packed)
Definition: SkColorPriv.h:95
#define SkGetPackedR32(packed)
Definition: SkColorPriv.h:93
#define SkGetPackedG32(packed)
Definition: SkColorPriv.h:94
static SkPMColor SkPackARGB32(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition: SkColorPriv.h:106
struct MyStruct a[10]

◆ SkG16ToG32()

static unsigned SkG16ToG32 ( unsigned  g)
inlinestatic

Definition at line 38 of file SkColorData.h.

38 {
39 return (g << (8 - SK_G16_BITS)) | (g >> (2 * SK_G16_BITS - 8));
40}
#define SK_G16_BITS
Definition: SkColorData.h:19

◆ SkPack888ToRGB16()

static U16CPU SkPack888ToRGB16 ( U8CPU  r,
U8CPU  g,
U8CPU  b 
)
inlinestatic

Definition at line 324 of file SkColorData.h.

324 {
325 return (SkR32ToR16(r) << SK_R16_SHIFT) |
326 (SkG32ToG16(g) << SK_G16_SHIFT) |
328}
#define SkG32ToG16(g)
Definition: SkColorData.h:313
#define SK_G16_SHIFT
Definition: SkColorData.h:23
#define SkB32ToB16(b)
Definition: SkColorData.h:314
#define SK_R16_SHIFT
Definition: SkColorData.h:22
#define SK_B16_SHIFT
Definition: SkColorData.h:24
#define SkR32ToR16(r)
Definition: SkColorData.h:312

◆ SkPackARGB_as_BGRA()

static uint32_t SkPackARGB_as_BGRA ( U8CPU  a,
U8CPU  r,
U8CPU  g,
U8CPU  b 
)
inlinestatic

Definition at line 74 of file SkColorData.h.

74 {
79 return (a << SK_BGRA_A32_SHIFT) | (r << SK_BGRA_R32_SHIFT) |
81}
#define SkASSERT_IS_BYTE(x)
Definition: SkColorData.h:52
#define SK_BGRA_R32_SHIFT
Definition: SkColorPriv.h:69
#define SK_BGRA_B32_SHIFT
Definition: SkColorPriv.h:67
#define SK_BGRA_G32_SHIFT
Definition: SkColorPriv.h:68
#define SK_BGRA_A32_SHIFT
Definition: SkColorPriv.h:70

◆ SkPackARGB_as_RGBA()

static uint32_t SkPackARGB_as_RGBA ( U8CPU  a,
U8CPU  r,
U8CPU  g,
U8CPU  b 
)
inlinestatic

Definition at line 65 of file SkColorData.h.

65 {
70 return (a << SK_RGBA_A32_SHIFT) | (r << SK_RGBA_R32_SHIFT) |
72}
#define SK_RGBA_A32_SHIFT
Definition: SkColorPriv.h:65
#define SK_RGBA_G32_SHIFT
Definition: SkColorPriv.h:63
#define SK_RGBA_B32_SHIFT
Definition: SkColorPriv.h:64
#define SK_RGBA_R32_SHIFT
Definition: SkColorPriv.h:62

◆ SkPackRGB16()

static uint16_t SkPackRGB16 ( unsigned  r,
unsigned  g,
unsigned  b 
)
inlinestatic

Definition at line 141 of file SkColorData.h.

141 {
142 SkASSERT(r <= SK_R16_MASK);
143 SkASSERT(g <= SK_G16_MASK);
145
146 return SkToU16((r << SK_R16_SHIFT) | (g << SK_G16_SHIFT) | (b << SK_B16_SHIFT));
147}
#define SK_R16_MASK
Definition: SkColorData.h:26
#define SK_G16_MASK
Definition: SkColorData.h:27
#define SK_B16_MASK
Definition: SkColorData.h:28
constexpr uint16_t SkToU16(S x)
Definition: SkTo.h:24

◆ SkPixel16ToColor()

static SkColor SkPixel16ToColor ( U16CPU  src)
inlinestatic

Definition at line 332 of file SkColorData.h.

332 {
333 SkASSERT(src == SkToU16(src));
334
335 unsigned r = SkPacked16ToR32(src);
336 unsigned g = SkPacked16ToG32(src);
337 unsigned b = SkPacked16ToB32(src);
338
339 SkASSERT((r >> (8 - SK_R16_BITS)) == SkGetPackedR16(src));
340 SkASSERT((g >> (8 - SK_G16_BITS)) == SkGetPackedG16(src));
341 SkASSERT((b >> (8 - SK_B16_BITS)) == SkGetPackedB16(src));
342
343 return SkColorSetRGB(r, g, b);
344}
#define SkGetPackedB16(color)
Definition: SkColorData.h:32
#define SkGetPackedG16(color)
Definition: SkColorData.h:31
#define SkPacked16ToG32(c)
Definition: SkColorData.h:47
#define SkGetPackedR16(color)
Definition: SkColorData.h:30
#define SK_R16_BITS
Definition: SkColorData.h:18
#define SkPacked16ToR32(c)
Definition: SkColorData.h:46
#define SkPacked16ToB32(c)
Definition: SkColorData.h:48
#define SkColorSetRGB(r, g, b)
Definition: SkColor.h:57

◆ SkPixel32ToPixel16()

static U16CPU SkPixel32ToPixel16 ( SkPMColor  c)
inlinestatic

Definition at line 317 of file SkColorData.h.

317 {
318 unsigned r = ((c >> (SK_R32_SHIFT + (8 - SK_R16_BITS))) & SK_R16_MASK) << SK_R16_SHIFT;
319 unsigned g = ((c >> (SK_G32_SHIFT + (8 - SK_G16_BITS))) & SK_G16_MASK) << SK_G16_SHIFT;
320 unsigned b = ((c >> (SK_B32_SHIFT + (8 - SK_B16_BITS))) & SK_B16_MASK) << SK_B16_SHIFT;
321 return r | g | b;
322}
#define SK_R32_SHIFT
Definition: SkTypes.h:44
#define SK_B32_SHIFT
Definition: SkTypes.h:50
#define SK_G32_SHIFT
Definition: SkTypes.h:53

◆ SkPixel4444ToPixel32()

static SkPMColor SkPixel4444ToPixel32 ( U16CPU  c)
inlinestatic

Definition at line 368 of file SkColorData.h.

368 {
369 uint32_t d = (SkGetPackedA4444(c) << SK_A32_SHIFT) |
373 return d | (d << 4);
374}
#define SkGetPackedR4444(c)
Definition: SkColorData.h:362
#define SkGetPackedB4444(c)
Definition: SkColorData.h:364
#define SkGetPackedG4444(c)
Definition: SkColorData.h:363
#define SkGetPackedA4444(c)
Definition: SkColorData.h:361
#define SK_A32_SHIFT
Definition: SkTypes.h:54
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19

◆ SkPMLerp()

static SkPMColor SkPMLerp ( SkPMColor  src,
SkPMColor  dst,
unsigned  scale 
)
inlinestatic

Interpolates between colors src and dst using [0,256] scale.

Definition at line 270 of file SkColorData.h.

270 {
272}

◆ SkR16ToR32()

static unsigned SkR16ToR32 ( unsigned  r)
inlinestatic

Definition at line 34 of file SkColorData.h.

34 {
35 return (r << (8 - SK_R16_BITS)) | (r >> (2 * SK_R16_BITS - 8));
36}

◆ SkReplicateNibble()

static U8CPU SkReplicateNibble ( unsigned  nib)
inlinestatic

Definition at line 356 of file SkColorData.h.

356 {
357 SkASSERT(nib <= 0xF);
358 return (nib << 4) | nib;
359}

◆ SkSplay() [1/2]

static uint64_t SkSplay ( uint32_t  color)
inlinestatic

0xAARRGGBB -> 0x00AA00GG00RR00BB (note, ARGB -> AGRB)

Definition at line 195 of file SkColorData.h.

195 {
196 const uint32_t mask = 0x00FF00FF;
197 uint64_t agrb = (color >> 8) & mask; // 0x0000000000AA00GG
198 agrb <<= 32; // 0x00AA00GG00000000
199 agrb |= color & mask; // 0x00AA00GG00RR00BB
200 return agrb;
201}
DlColor color

◆ SkSplay() [2/2]

static void SkSplay ( uint32_t  color,
uint32_t *  ag,
uint32_t *  rb 
)
inlinestatic

0xAARRGGBB -> 0x00AA00GG, 0x00RR00BB

Definition at line 185 of file SkColorData.h.

185 {
186 const uint32_t mask = 0x00FF00FF;
187 *ag = (color >> 8) & mask;
188 *rb = color & mask;
189}

◆ SkSwizzle_BGRA_to_PMColor()

static SkPMColor SkSwizzle_BGRA_to_PMColor ( uint32_t  c)
inlinestatic

Definition at line 91 of file SkColorData.h.

91 {
92#ifdef SK_PMCOLOR_IS_BGRA
93 return c;
94#else
95 return SkSwizzle_RB(c);
96#endif
97}
static uint32_t SkSwizzle_RB(uint32_t c)
Definition: SkColorData.h:57

◆ SkSwizzle_RB()

static uint32_t SkSwizzle_RB ( uint32_t  c)
inlinestatic

Definition at line 57 of file SkColorData.h.

57 {
58 static const uint32_t kRBMask = (0xFF << SK_R32_SHIFT) | (0xFF << SK_B32_SHIFT);
59
60 unsigned c0 = (c >> SK_R32_SHIFT) & 0xFF;
61 unsigned c1 = (c >> SK_B32_SHIFT) & 0xFF;
62 return (c & ~kRBMask) | (c0 << SK_B32_SHIFT) | (c1 << SK_R32_SHIFT);
63}

◆ SkSwizzle_RGBA_to_PMColor()

static SkPMColor SkSwizzle_RGBA_to_PMColor ( uint32_t  c)
inlinestatic

Definition at line 83 of file SkColorData.h.

83 {
84#ifdef SK_PMCOLOR_IS_RGBA
85 return c;
86#else
87 return SkSwizzle_RB(c);
88#endif
89}

◆ SkUnsplay() [1/2]

static uint32_t SkUnsplay ( uint32_t  ag,
uint32_t  rb 
)
inlinestatic

0xAAxxGGxx, 0xRRxxBBxx-> 0xAARRGGBB

Definition at line 206 of file SkColorData.h.

206 {
207 const uint32_t mask = 0xFF00FF00;
208 return (ag & mask) | ((rb & mask) >> 8);
209}

◆ SkUnsplay() [2/2]

static uint32_t SkUnsplay ( uint64_t  agrb)
inlinestatic

0xAAxxGGxxRRxxBBxx -> 0xAARRGGBB (note, AGRB -> ARGB)

Definition at line 215 of file SkColorData.h.

215 {
216 const uint32_t mask = 0xFF00FF00;
217 return SkPMColor(
218 ((agrb & mask) >> 8) | // 0x00RR00BB
219 ((agrb >> 32) & mask)); // 0xAARRGGBB
220}
uint32_t SkPMColor
Definition: SkColor.h:205

Variable Documentation

◆ SK_PMColor4fBLACK

constexpr SkPMColor4f SK_PMColor4fBLACK = { 0, 0, 0, 1 }
constexpr

Definition at line 379 of file SkColorData.h.

◆ SK_PMColor4fILLEGAL

constexpr SkPMColor4f SK_PMColor4fILLEGAL
constexpr
Initial value:

Definition at line 381 of file SkColorData.h.

◆ SK_PMColor4fTRANSPARENT

constexpr SkPMColor4f SK_PMColor4fTRANSPARENT = { 0, 0, 0, 0 }
constexpr

Definition at line 378 of file SkColorData.h.

◆ SK_PMColor4fWHITE

constexpr SkPMColor4f SK_PMColor4fWHITE = { 1, 1, 1, 1 }
constexpr

Definition at line 380 of file SkColorData.h.