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

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

Issue 2337423002: color: Initialize all members of gfx::ColorSpace (Closed)
Patch Set: don't convert invalid iccs Created 4 years, 3 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/color_space.cc ('k') | no next file » | 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « ui/gfx/color_space.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698