OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ColorBehavior_h | 5 #ifndef ColorBehavior_h |
6 #define ColorBehavior_h | 6 #define ColorBehavior_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "public/platform/WebVector.h" | 9 #include "public/platform/WebVector.h" |
10 #include "third_party/skia/include/core/SkColorSpace.h" | 10 #include "third_party/skia/include/core/SkColorSpace.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 return m_type == Type::TransformTo; | 41 return m_type == Type::TransformTo; |
42 } | 42 } |
43 sk_sp<SkColorSpace> targetColorSpace() const { | 43 sk_sp<SkColorSpace> targetColorSpace() const { |
44 DCHECK(m_type == Type::TransformTo); | 44 DCHECK(m_type == Type::TransformTo); |
45 return m_target; | 45 return m_target; |
46 } | 46 } |
47 | 47 |
48 // Set the target color profile into which all images with embedded color | 48 // Set the target color profile into which all images with embedded color |
49 // profiles should be converted. Note that only the first call to this | 49 // profiles should be converted. Note that only the first call to this |
50 // function in this process has any effect. | 50 // function in this process has any effect. |
51 static void setGlobalTargetColorProfile(const WebVector<char>&); | 51 static void setGlobalTargetColorSpace(const sk_sp<SkColorSpace>&); |
| 52 // This is the same as the above function, but will always take effect. |
52 static void setGlobalTargetColorSpaceForTesting(const sk_sp<SkColorSpace>&); | 53 static void setGlobalTargetColorSpaceForTesting(const sk_sp<SkColorSpace>&); |
53 static sk_sp<SkColorSpace> globalTargetColorSpace(); | 54 static sk_sp<SkColorSpace> globalTargetColorSpace(); |
54 | 55 |
55 // Return the behavior of transforming to the color space specified above, or | 56 // Return the behavior of transforming to the color space specified above, or |
56 // sRGB, if the above has not yet been called. | 57 // sRGB, if the above has not yet been called. |
57 static ColorBehavior transformToGlobalTarget(); | 58 static ColorBehavior transformToGlobalTarget(); |
58 | 59 |
59 // Transform to a target color space to be used by tests. | 60 // Transform to a target color space to be used by tests. |
60 static ColorBehavior transformToTargetForTesting(); | 61 static ColorBehavior transformToTargetForTesting(); |
61 | 62 |
62 bool operator==(const ColorBehavior&) const; | 63 bool operator==(const ColorBehavior&) const; |
63 bool operator!=(const ColorBehavior&) const; | 64 bool operator!=(const ColorBehavior&) const; |
64 | 65 |
65 private: | 66 private: |
66 enum class Type { | 67 enum class Type { |
67 Ignore, | 68 Ignore, |
68 Tag, | 69 Tag, |
69 TransformTo, | 70 TransformTo, |
70 }; | 71 }; |
71 ColorBehavior(Type type, sk_sp<SkColorSpace> target) | 72 ColorBehavior(Type type, sk_sp<SkColorSpace> target) |
72 : m_type(type), m_target(std::move(target)) {} | 73 : m_type(type), m_target(std::move(target)) {} |
73 Type m_type; | 74 Type m_type; |
74 sk_sp<SkColorSpace> m_target; | 75 sk_sp<SkColorSpace> m_target; |
75 }; | 76 }; |
76 | 77 |
77 } // namespace blink | 78 } // namespace blink |
78 | 79 |
79 #endif // ColorBehavior_h | 80 #endif // ColorBehavior_h |
OLD | NEW |