OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 "build/build_config.h" |
| 6 #include "ui/gfx/color_space.h" |
| 7 |
| 8 namespace gfx { |
| 9 |
| 10 namespace { |
| 11 static const size_t kMinProfileLength = 128; |
| 12 static const size_t kMaxProfileLength = 4 * 1024 * 1024; |
| 13 } |
| 14 |
| 15 ColorSpace::ColorSpace() = default; |
| 16 ColorSpace::ColorSpace(ColorSpace&& other) = default; |
| 17 ColorSpace::ColorSpace(const ColorSpace& other) = default; |
| 18 ColorSpace& ColorSpace::operator=(const ColorSpace& other) = default; |
| 19 ColorSpace::~ColorSpace() = default; |
| 20 |
| 21 bool ColorSpace::operator==(const ColorSpace& other) const { |
| 22 return icc_profile_ == other.icc_profile_; |
| 23 } |
| 24 |
| 25 ColorSpace ColorSpace::FromICCProfile(const std::vector<char>& icc_profile) { |
| 26 ColorSpace color_space; |
| 27 if (IsValidProfileLength(icc_profile.size())) |
| 28 color_space.icc_profile_ = icc_profile; |
| 29 return color_space; |
| 30 } |
| 31 |
| 32 #if !defined(OS_WIN) && !defined(OS_MACOSX) |
| 33 // static |
| 34 ColorSpace ColorSpace::FromBestMonitor() { |
| 35 return ColorSpace(); |
| 36 } |
| 37 #endif |
| 38 |
| 39 // static |
| 40 bool ColorSpace::IsValidProfileLength(size_t length) { |
| 41 return length >= kMinProfileLength && length <= kMaxProfileLength; |
| 42 } |
| 43 |
| 44 } // namespace gfx |
OLD | NEW |