Flutter Engine
The Flutter Engine
|
#include "include/core/SkColor.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkTPin.h"
#include "include/private/base/SkTo.h"
#include <algorithm>
Go to the source code of this file.
Macros | |
#define | SkAlphaMul(value, alpha256) (((value) * (alpha256)) >> 8) |
#define | SK_A32_BITS 8 |
#define | SK_R32_BITS 8 |
#define | SK_G32_BITS 8 |
#define | SK_B32_BITS 8 |
#define | SK_A32_MASK ((1 << SK_A32_BITS) - 1) |
#define | SK_R32_MASK ((1 << SK_R32_BITS) - 1) |
#define | SK_G32_MASK ((1 << SK_G32_BITS) - 1) |
#define | SK_B32_MASK ((1 << SK_B32_BITS) - 1) |
#define | SK_RGBA_R32_SHIFT 0 |
#define | SK_RGBA_G32_SHIFT 8 |
#define | SK_RGBA_B32_SHIFT 16 |
#define | SK_RGBA_A32_SHIFT 24 |
#define | SK_BGRA_B32_SHIFT 0 |
#define | SK_BGRA_G32_SHIFT 8 |
#define | SK_BGRA_R32_SHIFT 16 |
#define | SK_BGRA_A32_SHIFT 24 |
#define | SkGetPackedA32(packed) ((uint32_t)((packed) << (24 - SK_A32_SHIFT)) >> 24) |
#define | SkGetPackedR32(packed) ((uint32_t)((packed) << (24 - SK_R32_SHIFT)) >> 24) |
#define | SkGetPackedG32(packed) ((uint32_t)((packed) << (24 - SK_G32_SHIFT)) >> 24) |
#define | SkGetPackedB32(packed) ((uint32_t)((packed) << (24 - SK_B32_SHIFT)) >> 24) |
#define | SkA32Assert(a) SkASSERT((unsigned)(a) <= SK_A32_MASK) |
#define | SkR32Assert(r) SkASSERT((unsigned)(r) <= SK_R32_MASK) |
#define | SkG32Assert(g) SkASSERT((unsigned)(g) <= SK_G32_MASK) |
#define | SkB32Assert(b) SkASSERT((unsigned)(b) <= SK_B32_MASK) |
Functions | |
static unsigned | SkAlpha255To256 (U8CPU alpha) |
static U8CPU | SkUnitScalarClampToByte (SkScalar x) |
static SkPMColor | SkPackARGB32 (U8CPU a, U8CPU r, U8CPU g, U8CPU b) |
static SkPMColor | SkPackARGB32NoCheck (U8CPU a, U8CPU r, U8CPU g, U8CPU b) |
static SkPMColor | SkPremultiplyARGBInline (U8CPU a, U8CPU r, U8CPU g, U8CPU b) |
static SK_ALWAYS_INLINE uint32_t | SkAlphaMulQ (uint32_t c, unsigned scale) |
static SkPMColor | SkPMSrcOver (SkPMColor src, SkPMColor dst) |
#define SK_A32_BITS 8 |
Definition at line 40 of file SkColorPriv.h.
#define SK_A32_MASK ((1 << SK_A32_BITS) - 1) |
Definition at line 45 of file SkColorPriv.h.
#define SK_B32_BITS 8 |
Definition at line 43 of file SkColorPriv.h.
#define SK_B32_MASK ((1 << SK_B32_BITS) - 1) |
Definition at line 48 of file SkColorPriv.h.
#define SK_BGRA_A32_SHIFT 24 |
Definition at line 70 of file SkColorPriv.h.
#define SK_BGRA_B32_SHIFT 0 |
Definition at line 67 of file SkColorPriv.h.
#define SK_BGRA_G32_SHIFT 8 |
Definition at line 68 of file SkColorPriv.h.
#define SK_BGRA_R32_SHIFT 16 |
Definition at line 69 of file SkColorPriv.h.
#define SK_G32_BITS 8 |
Definition at line 42 of file SkColorPriv.h.
#define SK_G32_MASK ((1 << SK_G32_BITS) - 1) |
Definition at line 47 of file SkColorPriv.h.
#define SK_R32_BITS 8 |
Definition at line 41 of file SkColorPriv.h.
#define SK_R32_MASK ((1 << SK_R32_BITS) - 1) |
Definition at line 46 of file SkColorPriv.h.
#define SK_RGBA_A32_SHIFT 24 |
Definition at line 65 of file SkColorPriv.h.
#define SK_RGBA_B32_SHIFT 16 |
Definition at line 64 of file SkColorPriv.h.
#define SK_RGBA_G32_SHIFT 8 |
Definition at line 63 of file SkColorPriv.h.
#define SK_RGBA_R32_SHIFT 0 |
Definition at line 62 of file SkColorPriv.h.
#define SkA32Assert | ( | a | ) | SkASSERT((unsigned)(a) <= SK_A32_MASK) |
Definition at line 97 of file SkColorPriv.h.
Multiplify value by 0..256, and shift the result down 8 (i.e. return (value * alpha256) >> 8)
Definition at line 34 of file SkColorPriv.h.
#define SkB32Assert | ( | b | ) | SkASSERT((unsigned)(b) <= SK_B32_MASK) |
Definition at line 100 of file SkColorPriv.h.
#define SkG32Assert | ( | g | ) | SkASSERT((unsigned)(g) <= SK_G32_MASK) |
Definition at line 99 of file SkColorPriv.h.
#define SkGetPackedA32 | ( | packed | ) | ((uint32_t)((packed) << (24 - SK_A32_SHIFT)) >> 24) |
Definition at line 92 of file SkColorPriv.h.
#define SkGetPackedB32 | ( | packed | ) | ((uint32_t)((packed) << (24 - SK_B32_SHIFT)) >> 24) |
Definition at line 95 of file SkColorPriv.h.
#define SkGetPackedG32 | ( | packed | ) | ((uint32_t)((packed) << (24 - SK_G32_SHIFT)) >> 24) |
Definition at line 94 of file SkColorPriv.h.
#define SkGetPackedR32 | ( | packed | ) | ((uint32_t)((packed) << (24 - SK_R32_SHIFT)) >> 24) |
Definition at line 93 of file SkColorPriv.h.
#define SkR32Assert | ( | r | ) | SkASSERT((unsigned)(r) <= SK_R32_MASK) |
Definition at line 98 of file SkColorPriv.h.
|
inlinestatic |
Turn 0..255 into 0..256 by adding 1 at the half-way point. Used to turn a byte into a scale value, so that we can say scale * value >> 8 instead of alpha * value / 255.
In debugging, asserts that alpha is 0..255
Definition at line 24 of file SkColorPriv.h.
|
static |
Definition at line 142 of file SkColorPriv.h.
Pack the components into a SkPMColor, checking (in the debug version) that the components are 0..255, and are already premultiplied (i.e. alpha >= color)
Definition at line 106 of file SkColorPriv.h.
Same as SkPackARGB32, but this version guarantees to not check that the values are premultiplied in the debug version.
Definition at line 120 of file SkColorPriv.h.
Definition at line 150 of file SkColorPriv.h.
Definition at line 126 of file SkColorPriv.h.
Definition at line 36 of file SkColorPriv.h.