24 : fTransferFn(transferFn)
25 , fToXYZD50(toXYZD50) {
31 for (
int r = 0; r < 3; ++r) {
32 for (
int c = 0; c < 3; ++c) {
95void SkColorSpace::computeLazyDstFields()
const {
96 fLazyDstFieldsOnce([
this] {
125 memcpy(gabcdef, &fTransferFn, 7*
sizeof(
float));
133 this->computeLazyDstFields();
134 *fn = fInvTransferFn;
143 dst->computeLazyDstFields();
213 if (trc[0].table_entries != 0 ||
214 trc[1].table_entries != 0 ||
215 trc[2].table_entries != 0 ||
216 0 != memcmp(&trc[0].parametric, &trc[1].parametric,
sizeof(trc[0].parametric)) ||
217 0 != memcmp(&trc[0].parametric, &trc[2].parametric,
sizeof(trc[0].parametric)))
251 memcpy(memory, &fTransferFn, 7 *
sizeof(
float));
252 memory = SkTAddOffset<void>(memory, 7 *
sizeof(
float));
254 memcpy(memory, &fToXYZD50, 9 *
sizeof(
float));
278 if (
length < 16 *
sizeof(
float)) {
284 data = SkTAddOffset<const void>(
data, 7 *
sizeof(
float));
287 memcpy(&toXYZ,
data, 9 *
sizeof(
float));
300 if (
x->hash() ==
y->hash()) {
301 #if defined(SK_DEBUG)
306 auto equiv = [](
float X,
float Y) {
308 || (std::isnan(
X) && std::isnan(
Y));
311 for (
int i = 0;
i < 7;
i++) {
312 float X = (&
x->fTransferFn.g)[
i],
313 Y = (&
y->fTransferFn.g)[
i];
314 SkASSERTF(equiv(
X,
Y),
"Hash collision at tf[%d], !equiv(%g,%g)\n",
i,
X,
Y);
316 for (
int r = 0; r < 3; r++)
317 for (
int c = 0; c < 3; c++) {
318 float X =
x->fToXYZD50.vals[r][c],
319 Y =
y->fToXYZD50.vals[r][c];
320 SkASSERTF(equiv(
X,
Y),
"Hash collision at toXYZD50[%d][%d], !equiv(%g,%g)\n", r,c,
X,
Y);
static SkM44 inv(const SkM44 &m)
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
#define SkASSERTF(cond, fmt,...)
static bool is_almost_linear(const skcms_TransferFunction &coeffs)
static bool color_space_almost_equal(float a, float b)
static bool is_almost_2dot2(const skcms_TransferFunction &coeffs)
static bool is_almost_srgb(const skcms_TransferFunction &coeffs)
SkColorSpace * sk_srgb_linear_singleton()
SkColorSpace * sk_srgb_singleton()
static bool xyz_almost_equal(const skcms_Matrix3x3 &mA, const skcms_Matrix3x3 &mB)
sk_sp< T > sk_ref_sp(T *obj)
static SkColorSpace * Make(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &to_xyz)
bool gammaIsLinear() const
bool gammaCloseToSRGB() const
void toProfile(skcms_ICCProfile *) const
bool isNumericalTransferFn(skcms_TransferFunction *fn) const
bool toXYZD50(skcms_Matrix3x3 *toXYZD50) const
sk_sp< SkColorSpace > makeSRGBGamma() const
void invTransferFn(skcms_TransferFunction *fn) const
static bool Equals(const SkColorSpace *, const SkColorSpace *)
void gamutTransformTo(const SkColorSpace *dst, skcms_Matrix3x3 *src_to_dst) const
sk_sp< SkColorSpace > makeLinearGamma() const
static sk_sp< SkColorSpace > MakeSRGB()
sk_sp< SkColorSpace > makeColorSpin() const
static sk_sp< SkColorSpace > Deserialize(const void *data, size_t length)
void transferFn(float gabcdef[7]) const
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
static sk_sp< SkColorSpace > Make(const skcms_ICCProfile &)
size_t writeToMemory(void *memory) const
sk_sp< SkData > serialize() const
static sk_sp< SkColorSpace > MakeSRGBLinear()
static sk_sp< SkData > MakeUninitialized(size_t length)
uint32_t Hash32(const void *data, size_t bytes, uint32_t seed)
static constexpr skcms_Matrix3x3 kSRGB
static constexpr skcms_TransferFunction k2Dot2
static constexpr skcms_TransferFunction kSRGB
static constexpr skcms_TransferFunction kLinear
bool skcms_PrimariesToXYZD50(float rx, float ry, float gx, float gy, float bx, float by, float wx, float wy, skcms_Matrix3x3 *toXYZD50)
bool skcms_Matrix3x3_invert(const skcms_Matrix3x3 *src, skcms_Matrix3x3 *dst)
skcms_TFType skcms_TransferFunction_getType(const skcms_TransferFunction *tf)
const skcms_TransferFunction * skcms_sRGB_Inverse_TransferFunction()
bool skcms_TransferFunction_invert(const skcms_TransferFunction *src, skcms_TransferFunction *dst)
const skcms_ICCProfile * skcms_sRGB_profile()
bool skcms_TRCs_AreApproximateInverse(const skcms_ICCProfile *profile, const skcms_TransferFunction *inv_tf)
bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile *A, const skcms_ICCProfile *B)
skcms_Matrix3x3 skcms_Matrix3x3_concat(const skcms_Matrix3x3 *A, const skcms_Matrix3x3 *B)
static void skcms_SetXYZD50(skcms_ICCProfile *p, const skcms_Matrix3x3 *m)
static void skcms_SetTransferFunction(skcms_ICCProfile *p, const skcms_TransferFunction *tf)
static void skcms_Init(skcms_ICCProfile *p)
static const char header[]
bool toXYZD50(skcms_Matrix3x3 *toXYZD50) const
std::shared_ptr< const fml::Mapping > data
static sk_sp< SkColorFilter > spin(sk_sp< SkColorFilter > cf)