Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: ui/gfx/icc_profile.cc

Issue 2183953002: Add some actual data to gfx::ColorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix LAST Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/icc_profile.h ('k') | ui/gfx/ipc/color/gfx_param_traits.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::PrimaryID::CUSTOM,
107 color_space.valid_ = true; 107 ColorSpace::TransferID::CUSTOM,
108 ColorSpace::MatrixID::RGB, ColorSpace::RangeID::FULL);
108 color_space.icc_profile_id_ = id_; 109 color_space.icc_profile_id_ = id_;
109 110
110 // Move this ICC profile to the most recently used end of the cache. 111 // Move this ICC profile to the most recently used end of the cache.
111 { 112 {
112 Cache& cache = g_cache.Get(); 113 Cache& cache = g_cache.Get();
113 base::AutoLock lock(cache.lock); 114 base::AutoLock lock(cache.lock);
114 115
115 auto found = cache.id_to_icc_profile_mru.Get(id_); 116 auto found = cache.id_to_icc_profile_mru.Get(id_);
116 if (found == cache.id_to_icc_profile_mru.end()) 117 if (found == cache.id_to_icc_profile_mru.end())
117 cache.id_to_icc_profile_mru.Put(id_, *this); 118 cache.id_to_icc_profile_mru.Put(id_, *this);
118 } 119 }
119 return color_space; 120 return color_space;
120 } 121 }
121 122
122 // static 123 // static
123 bool ICCProfile::IsValidProfileLength(size_t length) { 124 bool ICCProfile::IsValidProfileLength(size_t length) {
124 return length >= kMinProfileLength && length <= kMaxProfileLength; 125 return length >= kMinProfileLength && length <= kMaxProfileLength;
125 } 126 }
126 127
127 } // namespace gfx 128 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/icc_profile.h ('k') | ui/gfx/ipc/color/gfx_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698