367 {
368
369#if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6)
370
373
374
375
377
378
379
380 int compression;
381 if (PNG_INFO_iCCP == png_get_iCCP(png_ptr, info_ptr, &
name, &compression, &
profile,
385 }
386
387
388
389
390
391 if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {
392
393
394
395
396
397 return nullptr;
398 }
399
400
402
403 png_fixed_point chrm[8];
404 png_fixed_point gamma;
405 if (png_get_cHRM_fixed(png_ptr, info_ptr, &chrm[0], &chrm[1], &chrm[2], &chrm[3], &chrm[4],
406 &chrm[5], &chrm[6], &chrm[7]))
407 {
408 float rx = png_fixed_point_to_float(chrm[2]);
409 float ry = png_fixed_point_to_float(chrm[3]);
410 float gx = png_fixed_point_to_float(chrm[4]);
411 float gy = png_fixed_point_to_float(chrm[5]);
412 float bx = png_fixed_point_to_float(chrm[6]);
413 float by = png_fixed_point_to_float(chrm[7]);
414 float wx = png_fixed_point_to_float(chrm[0]);
415 float wy = png_fixed_point_to_float(chrm[1]);
416
419 toXYZD50 = tmp;
420 } else {
421
422
423 }
424 }
425
427 if (PNG_INFO_gAMA == png_get_gAMA_fixed(png_ptr, info_ptr, &gamma)) {
429 fn.
b = fn.
c = fn.
d = fn.
e = fn.
f = 0.0f;
430 fn.
g = png_inverted_fixed_point_to_float(gamma);
431 } else {
432
433
434
436 }
437
442
444#else
445 return nullptr;
446#endif
447}
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
static std::unique_ptr< ICCProfile > Make(sk_sp< SkData >)
DEF_SWITCHES_START aot vmservice shared library name
bool skcms_PrimariesToXYZD50(float rx, float ry, float gx, float gy, float bx, float by, float wx, float wy, skcms_Matrix3x3 *toXYZD50)
const skcms_ICCProfile * skcms_sRGB_profile()
const skcms_TransferFunction * skcms_sRGB_TransferFunction()
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)
std::shared_ptr< const fml::Mapping > data