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 #include "ui/gfx/icc_profile.h" | 5 #include "ui/gfx/icc_profile.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/containers/mru_cache.h" | 9 #include "base/containers/mru_cache.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // TODO(ccameron): Support constructing ICC profiles from arbitrary ColorSpace | 98 // TODO(ccameron): Support constructing ICC profiles from arbitrary ColorSpace |
99 // objects. | 99 // objects. |
100 return ICCProfile(); | 100 return ICCProfile(); |
101 } | 101 } |
102 | 102 |
103 const std::vector<char>& ICCProfile::GetData() const { | 103 const std::vector<char>& ICCProfile::GetData() const { |
104 return data_; | 104 return data_; |
105 } | 105 } |
106 | 106 |
107 ColorSpace ICCProfile::GetColorSpace() const { | 107 ColorSpace ICCProfile::GetColorSpace() const { |
| 108 if (!valid_) |
| 109 return gfx::ColorSpace(); |
| 110 |
108 ColorSpace color_space(ColorSpace::PrimaryID::CUSTOM, | 111 ColorSpace color_space(ColorSpace::PrimaryID::CUSTOM, |
109 ColorSpace::TransferID::CUSTOM, | 112 ColorSpace::TransferID::CUSTOM, |
110 ColorSpace::MatrixID::RGB, ColorSpace::RangeID::FULL); | 113 ColorSpace::MatrixID::RGB, ColorSpace::RangeID::FULL); |
111 color_space.icc_profile_id_ = id_; | 114 color_space.icc_profile_id_ = id_; |
112 | 115 |
113 // Move this ICC profile to the most recently used end of the cache. | 116 // Move this ICC profile to the most recently used end of the cache. |
114 { | 117 { |
115 Cache& cache = g_cache.Get(); | 118 Cache& cache = g_cache.Get(); |
116 base::AutoLock lock(cache.lock); | 119 base::AutoLock lock(cache.lock); |
117 | 120 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 168 |
166 return color_space; | 169 return color_space; |
167 } | 170 } |
168 | 171 |
169 // static | 172 // static |
170 bool ICCProfile::IsValidProfileLength(size_t length) { | 173 bool ICCProfile::IsValidProfileLength(size_t length) { |
171 return length >= kMinProfileLength && length <= kMaxProfileLength; | 174 return length >= kMinProfileLength && length <= kMaxProfileLength; |
172 } | 175 } |
173 | 176 |
174 } // namespace gfx | 177 } // namespace gfx |
OLD | NEW |