OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ui/gfx/color_space.h" | 5 #include "ui/gfx/color_space.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 memcmp(custom_primary_matrix_, other.custom_primary_matrix_, | 147 memcmp(custom_primary_matrix_, other.custom_primary_matrix_, |
148 sizeof(custom_primary_matrix_)); | 148 sizeof(custom_primary_matrix_)); |
149 if (primary_result < 0) | 149 if (primary_result < 0) |
150 return true; | 150 return true; |
151 if (primary_result > 0) | 151 if (primary_result > 0) |
152 return false; | 152 return false; |
153 } | 153 } |
154 return false; | 154 return false; |
155 } | 155 } |
156 | 156 |
157 sk_sp<SkColorSpace> ColorSpace::ToSkColorSpace() const { | |
158 return sk_color_space_; | |
159 } | |
160 | |
161 ColorSpace ColorSpace::FromSkColorSpace( | 157 ColorSpace ColorSpace::FromSkColorSpace( |
162 const sk_sp<SkColorSpace>& sk_color_space) { | 158 const sk_sp<SkColorSpace>& sk_color_space) { |
163 if (!sk_color_space) | 159 if (!sk_color_space) |
164 return gfx::ColorSpace(); | 160 return gfx::ColorSpace(); |
165 if (SkColorSpace::Equals( | 161 if (SkColorSpace::Equals( |
166 sk_color_space.get(), | 162 sk_color_space.get(), |
167 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get())) | 163 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get())) |
168 return gfx::ColorSpace::CreateSRGB(); | 164 return gfx::ColorSpace::CreateSRGB(); |
169 | 165 |
170 // TODO(crbug.com/634102): Add conversion to gfx::ColorSpace for | 166 // TODO(crbug.com/634102): Add conversion to gfx::ColorSpace for |
171 // non-ICC-profile based color spaces. | 167 // non-ICC-profile based color spaces. |
172 ICCProfile icc_profile = ICCProfile::FromSkColorSpace(sk_color_space); | 168 ICCProfile icc_profile = ICCProfile::FromSkColorSpace(sk_color_space); |
173 return icc_profile.GetColorSpace(); | 169 return icc_profile.GetColorSpace(); |
174 } | 170 } |
175 | 171 |
176 } // namespace gfx | 172 } // namespace gfx |
OLD | NEW |