Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/InterpolationSpace.h

Issue 2884313002: color: Rename blink::ColorSpace to blink::InterpolationSpace (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef ColorSpace_h 26 #ifndef InterpolationSpace_h
27 #define ColorSpace_h 27 #define InterpolationSpace_h
28 28
29 #include "platform/PlatformExport.h"
30 #include "platform/graphics/Color.h" 29 #include "platform/graphics/Color.h"
31 #include "third_party/skia/include/core/SkRefCnt.h" 30 #include "third_party/skia/include/core/SkRefCnt.h"
32 31
33 class SkColorFilter; 32 class SkColorFilter;
34 class SkColorSpace;
35 33
36 namespace blink { 34 namespace blink {
37 35
38 struct WebScreenInfo; 36 enum InterpolationSpace {
39 37 // Interpolation is performed on (assumed to be sRGB) pixel values directly,
40 enum ColorSpace { kColorSpaceDeviceRGB, kColorSpaceSRGB, kColorSpaceLinearRGB }; 38 // so a halfway interpolation of 0 and 255 is 127.
41 39 kInterpolationSpaceSRGB,
42 enum class ColorSpaceGamut { 40 // Interpolation is performed in linear physical value space, so a halfway
43 // Values synced with 'Gamut' in src/tools/metrics/histograms/histograms.xml 41 // interpolation of 0 and 255 is 188.
44 kUnknown = 0, 42 kInterpolationSpaceLinear
45 kLessThanNTSC = 1,
46 NTSC = 2,
47 SRGB = 3,
48 kAlmostP3 = 4,
49 P3 = 5,
50 kAdobeRGB = 6,
51 kWide = 7,
52 BT2020 = 8,
53 kProPhoto = 9,
54 kUltraWide = 10,
55 kEnd
56 }; 43 };
57 44
58 namespace ColorSpaceUtilities { 45 namespace InterpolationSpaceUtilities {
59 46
60 // Get a pointer to a 8-bit lookup table that will convert color components 47 // Get a pointer to a 8-bit lookup table that will convert color components
61 // in the |srcColorSpace| to the |dstColorSpace|. 48 // in the |srcInterpolationSpace| to the |dstInterpolationSpace|.
fs 2017/05/17 11:54:59 Nit: Since we're changing these, maybe the renamed
ccameron 2017/05/17 19:05:13 Done.
62 // If the conversion cannot be performed, or is a no-op (identity transform), 49 // If the conversion cannot be performed, or is a no-op (identity transform),
63 // then 0 is returned. 50 // then 0 is returned.
64 // (Note that a round-trip - f(B,A)[f(A,B)[x]] - is not lossless in general.) 51 // (Note that a round-trip - f(B,A)[f(A,B)[x]] - is not lossless in general.)
65 const uint8_t* GetConversionLUT( 52 const uint8_t* GetConversionLUT(
66 ColorSpace dst_color_space, 53 InterpolationSpace dst_interpolation_space,
67 ColorSpace src_color_space = kColorSpaceDeviceRGB); 54 InterpolationSpace src_interpolation_space = kInterpolationSpaceSRGB);
68 55
69 // Convert a Color assumed to be in the |srcColorSpace| into the 56 // Convert a Color assumed to be in the |srcInterpolationSpace| into the
fs 2017/05/17 11:54:58 Ditto.
ccameron 2017/05/17 19:05:13 Done.
70 // |dstColorSpace|. 57 // |dstInterpolationSpace|.
71 Color ConvertColor(const Color& src_color, 58 Color ConvertColor(
72 ColorSpace dst_color_space, 59 const Color& src_color,
73 ColorSpace src_color_space = kColorSpaceDeviceRGB); 60 InterpolationSpace dst_interpolation_space,
61 InterpolationSpace src_interpolation_space = kInterpolationSpaceSRGB);
74 62
75 // Create a color filter that will convert from |srcColorSpace| into 63 // Create a color filter that will convert from |srcInterpolationSpace| into
fs 2017/05/17 11:54:58 Ditto.
ccameron 2017/05/17 19:05:13 Done.
76 // |dstColorSpace|. 64 // |dstInterpolationSpace|.
77 sk_sp<SkColorFilter> CreateColorSpaceFilter(ColorSpace src_color_space, 65 sk_sp<SkColorFilter> CreateInterpolationSpaceFilter(
78 ColorSpace dst_color_space); 66 InterpolationSpace src_interpolation_space,
67 InterpolationSpace dst_interpolation_space);
79 68
80 PLATFORM_EXPORT ColorSpaceGamut GetColorSpaceGamut(const WebScreenInfo&); 69 } // namespace InterpolationSpaceUtilities
81 ColorSpaceGamut GetColorSpaceGamut(SkColorSpace*);
82
83 } // namespace ColorSpaceUtilities
84 70
85 } // namespace blink 71 } // namespace blink
86 72
87 #endif // ColorSpace_h 73 #endif // InterpolationSpace_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698