Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/gfx/icc_profile.h" | |
| 6 | |
| 7 namespace gfx { | |
| 8 | |
| 9 namespace { | |
| 10 static const size_t kMinProfileLength = 128; | |
| 11 static const size_t kMaxProfileLength = 4 * 1024 * 1024; | |
| 12 } // namespace | |
| 13 | |
| 14 ICCProfile::ICCProfile() = default; | |
| 15 ICCProfile::ICCProfile(ICCProfile&& other) = default; | |
| 16 ICCProfile::ICCProfile(const ICCProfile& other) = default; | |
| 17 ICCProfile& ICCProfile::operator=(const ICCProfile& other) = default; | |
| 18 ICCProfile::~ICCProfile() = default; | |
| 19 | |
| 20 bool ICCProfile::operator==(const ICCProfile& other) const { | |
| 21 return valid_ == other.valid_ && data_ == other.data_; | |
| 22 } | |
| 23 | |
| 24 // static | |
| 25 ICCProfile ICCProfile::FromData(const std::vector<char>& icc_profile_data) { | |
| 26 ICCProfile icc_profile; | |
| 27 if (IsValidProfileLength(icc_profile_data.size())) { | |
| 28 icc_profile.valid_ = true; | |
| 29 icc_profile.data_ = icc_profile_data; | |
| 30 } | |
| 31 return icc_profile; | |
| 32 } | |
| 33 | |
| 34 #if !defined(OS_WIN) && !defined(OS_MACOSX) | |
| 35 // static | |
| 36 ICCProfile ICCProfile::FromBestMonitor() { | |
| 37 return ICCProfile(); | |
| 38 } | |
| 39 #endif | |
| 40 | |
| 41 // static | |
| 42 ICCProfile ICCProfile::FromColorSpace(const gfx::ColorSpace& color_space) { | |
| 43 // TODO(ccameron): Support constructing ICC profiles from arbitrary ColorSpace | |
|
hubbe
2016/07/21 22:08:54
Why add this function if it's not actually impleme
ccameron
2016/07/22 00:59:17
Good point. I fleshed out this part of the functio
| |
| 44 // objects. | |
| 45 return ICCProfile(); | |
| 46 } | |
| 47 | |
| 48 const std::vector<char>& ICCProfile::GetData() const { | |
| 49 return data_; | |
| 50 } | |
| 51 | |
| 52 ColorSpace ICCProfile::GetColorSpace() const { | |
| 53 // TODO(ccameron): Convert the ICC profile to a ColorSpace object. | |
| 54 return ColorSpace(); | |
| 55 } | |
| 56 | |
| 57 // static | |
| 58 bool ICCProfile::IsValidProfileLength(size_t length) { | |
| 59 return length >= kMinProfileLength && length <= kMaxProfileLength; | |
| 60 } | |
| 61 | |
| 62 } // namespace gfx | |
| OLD | NEW |