blob: 519ffb8a35ef6d5db24d457e80a9a896da25c6f7 [file] [log] [blame]
Mike Kleinc9bc8142017-11-27 12:39:30 -05001/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "SkColorSpace.h"
9#include "SkToSRGBColorFilter.h"
10#include "Test.h"
11
12
13DEF_TEST(SkToSRGBColorFilter, r) {
14
15 // sRGB -> sRGB is a no-op.
16 REPORTER_ASSERT(r, nullptr == SkToSRGBColorFilter::Make(SkColorSpace::MakeSRGB()));
17
18 // The transfer function matters just as much as the gamut.
19 REPORTER_ASSERT(r, nullptr != SkToSRGBColorFilter::Make(SkColorSpace::MakeSRGBLinear()));
20
21 // We generally interpret nullptr source spaces as sRGB. See also chromium:787718.
22 REPORTER_ASSERT(r, nullptr == SkToSRGBColorFilter::Make(nullptr));
23
24 // Here's a realistic conversion.
Brian Osman82ebe042019-01-04 17:03:00 -050025 auto dci_p3 = SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear, SkNamedGamut::kDCIP3);
Mike Kleinc9bc8142017-11-27 12:39:30 -050026 REPORTER_ASSERT(r, nullptr != SkToSRGBColorFilter::Make(dci_p3));
27
28}