34 const float red[],
const float green[],
const float blue[],
35 bool expectSRGB =
false) {
42 const float* ref[3] = { red, green, blue };
43 for (
int i = 0;
i < 3; ++
i) {
51 const float red[],
const float green[],
const float blue[],
52 bool expectSRGB =
false) {
65 auto colorSpace = codec->getInfo().refColorSpace();
66 test_space(r, colorSpace.get(), red, green, blue, expectSRGB);
69static constexpr float g_sRGB_R[]{ 0.4358f, 0.2224f, 0.0139f };
70static constexpr float g_sRGB_G[]{ 0.3853f, 0.7170f, 0.0971f };
71static constexpr float g_sRGB_B[]{ 0.1430f, 0.0606f, 0.7139f };
80#if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6)
84 const float red[] = { 0.385117f, 0.716904f, 0.0970612f };
85 const float green[] = { 0.143051f, 0.0606079f, 0.713913f };
86 const float blue[] = { 0.436035f, 0.222488f, 0.013916f };
87 test_path(r,
"images/icc-v2-gbr.jpg", red, green, blue);
89 test_path(r,
"images/webp-color-profile-crash.webp",
91 test_path(r,
"images/webp-color-profile-lossless.webp",
93 test_path(r,
"images/webp-color-profile-lossy.webp",
95 test_path(r,
"images/webp-color-profile-lossy-alpha.webp",
107#if defined(SK_DUMP_TO_DISK)
108 static int counter = 0;
143 test(
"icc_profiles/HP_ZR30w.icc");
144 test(
"icc_profiles/HP_Z32x.icc");
209 for (
int r = 0; r < 3; ++r) {
210 for (
int c = 0; c < 3; ++c) {
243 proPhoto.
fRX = 0.7347f;
244 proPhoto.
fRY = 0.2653f;
245 proPhoto.
fGX = 0.1596f;
246 proPhoto.
fGY = 0.8404f;
247 proPhoto.
fBX = 0.0366f;
248 proPhoto.
fBY = 0.0001f;
249 proPhoto.
fWX = 0.34567f;
250 proPhoto.
fWY = 0.35850f;
252 { 0.7976749f, 0.1351917f, 0.0313534f },
253 { 0.2880402f, 0.7118741f, 0.0000857f },
254 { 0.0000000f, 0.0000000f, 0.8252100f },
269 { 0.6343706f, 0.1852204f, 0.1446290f },
270 { 0.3109496f, 0.5915984f, 0.0974520f },
271 { -0.0011817f, 0.0555518f, 0.7708399f }
static void test_space(skiatest::Reporter *r, SkColorSpace *space, const float red[], const float green[], const float blue[], bool expectSRGB=false)
static constexpr float g_sRGB_G[]
static bool matrix_almost_equal(const skcms_Matrix3x3 &a, const skcms_Matrix3x3 &b)
static constexpr float g_sRGB_R[]
static constexpr float g_sRGB_B[]
static void test_path(skiatest::Reporter *r, const char *path, const float red[], const float green[], const float blue[], bool expectSRGB=false)
static bool almost_equal(float a, float b)
DEF_TEST(ColorSpace_sRGB, r)
static void check_primaries(skiatest::Reporter *r, const SkColorSpacePrimaries &primaries, const skcms_Matrix3x3 &reference)
static void test_serialize(skiatest::Reporter *r, const sk_sp< SkColorSpace > &space, bool isNamed)
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static sk_sp< SkColorSpace > rec2020()
std::unique_ptr< SkStreamAsset > GetResourceAsStream(const char *resource, bool useFileStream)
sk_sp< SkData > GetResourceAsData(const char *resource)
SkColorSpace * sk_srgb_singleton()
constexpr float SK_FloatNaN
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
#define REPORTER_ASSERT(r, cond,...)
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, SkSpan< const SkCodecs::Decoder > decoders, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage)
bool gammaCloseToSRGB() const
void toProfile(skcms_ICCProfile *) const
bool toXYZD50(skcms_Matrix3x3 *toXYZD50) const
static bool Equals(const SkColorSpace *, const SkColorSpace *)
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > Deserialize(const void *data, size_t length)
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
uint32_t toXYZD50Hash() const
sk_sp< SkData > serialize() const
static sk_sp< SkColorSpace > MakeSRGBLinear()
static sk_sp< SkData > MakeUninitialized(size_t length)
const void * data() const
bool write(const void *buffer, size_t size) override
static constexpr skcms_Matrix3x3 kSRGB
static constexpr skcms_Matrix3x3 kRec2020
static constexpr skcms_Matrix3x3 kDisplayP3
static constexpr skcms_TransferFunction kSRGB
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
def parse(repo_root, recipes_cfg_path)
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()
static bool skcms_Parse(const void *buf, size_t len, skcms_ICCProfile *profile)
bool toXYZD50(skcms_Matrix3x3 *toXYZD50) const
std::shared_ptr< const fml::Mapping > data