| 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 |
| 157 ColorSpace ColorSpace::FromSkColorSpace( | 161 ColorSpace ColorSpace::FromSkColorSpace( |
| 158 const sk_sp<SkColorSpace>& sk_color_space) { | 162 const sk_sp<SkColorSpace>& sk_color_space) { |
| 159 if (!sk_color_space) | 163 if (!sk_color_space) |
| 160 return gfx::ColorSpace(); | 164 return gfx::ColorSpace(); |
| 161 if (SkColorSpace::Equals( | 165 if (SkColorSpace::Equals( |
| 162 sk_color_space.get(), | 166 sk_color_space.get(), |
| 163 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get())) | 167 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get())) |
| 164 return gfx::ColorSpace::CreateSRGB(); | 168 return gfx::ColorSpace::CreateSRGB(); |
| 165 | 169 |
| 166 // TODO(crbug.com/634102): Add conversion to gfx::ColorSpace for | 170 // TODO(crbug.com/634102): Add conversion to gfx::ColorSpace for |
| 167 // non-ICC-profile based color spaces. | 171 // non-ICC-profile based color spaces. |
| 168 ICCProfile icc_profile = ICCProfile::FromSkColorSpace(sk_color_space); | 172 ICCProfile icc_profile = ICCProfile::FromSkColorSpace(sk_color_space); |
| 169 return icc_profile.GetColorSpace(); | 173 return icc_profile.GetColorSpace(); |
| 170 } | 174 } |
| 171 | 175 |
| 172 } // namespace gfx | 176 } // namespace gfx |
| OLD | NEW |