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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // TODO(ccameron): Support constructing ICC profiles from arbitrary ColorSpace | 96 // TODO(ccameron): Support constructing ICC profiles from arbitrary ColorSpace |
97 // objects. | 97 // objects. |
98 return ICCProfile(); | 98 return ICCProfile(); |
99 } | 99 } |
100 | 100 |
101 const std::vector<char>& ICCProfile::GetData() const { | 101 const std::vector<char>& ICCProfile::GetData() const { |
102 return data_; | 102 return data_; |
103 } | 103 } |
104 | 104 |
105 ColorSpace ICCProfile::GetColorSpace() const { | 105 ColorSpace ICCProfile::GetColorSpace() const { |
106 ColorSpace color_space; | 106 ColorSpace color_space(ColorSpace::PRI_CUSTOM, ColorSpace::TRC_CUSTOM, |
107 color_space.valid_ = true; | 107 ColorSpace::SPC_RGB, true); |
108 color_space.icc_profile_id_ = id_; | 108 color_space.icc_profile_id_ = id_; |
109 | 109 |
110 // Move this ICC profile to the most recently used end of the cache. | 110 // Move this ICC profile to the most recently used end of the cache. |
111 { | 111 { |
112 Cache& cache = g_cache.Get(); | 112 Cache& cache = g_cache.Get(); |
113 base::AutoLock lock(cache.lock); | 113 base::AutoLock lock(cache.lock); |
114 | 114 |
115 auto found = cache.id_to_icc_profile_mru.Get(id_); | 115 auto found = cache.id_to_icc_profile_mru.Get(id_); |
116 if (found == cache.id_to_icc_profile_mru.end()) | 116 if (found == cache.id_to_icc_profile_mru.end()) |
117 cache.id_to_icc_profile_mru.Put(id_, *this); | 117 cache.id_to_icc_profile_mru.Put(id_, *this); |
118 } | 118 } |
119 return color_space; | 119 return color_space; |
120 } | 120 } |
121 | 121 |
122 // static | 122 // static |
123 bool ICCProfile::IsValidProfileLength(size_t length) { | 123 bool ICCProfile::IsValidProfileLength(size_t length) { |
124 return length >= kMinProfileLength && length <= kMaxProfileLength; | 124 return length >= kMinProfileLength && length <= kMaxProfileLength; |
125 } | 125 } |
126 | 126 |
127 } // namespace gfx | 127 } // namespace gfx |
OLD | NEW |