| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 case Type::INVALID: | 49 case Type::INVALID: |
| 50 return true; | 50 return true; |
| 51 case Type::FROM_COLOR_SPACE: | 51 case Type::FROM_COLOR_SPACE: |
| 52 return color_space_ == other.color_space_; | 52 return color_space_ == other.color_space_; |
| 53 case Type::FROM_DATA: | 53 case Type::FROM_DATA: |
| 54 return data_ == other.data_; | 54 return data_ == other.data_; |
| 55 } | 55 } |
| 56 return false; | 56 return false; |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool ICCProfile::operator!=(const ICCProfile& other) const { |
| 60 return !(*this == other); |
| 61 } |
| 62 |
| 59 // static | 63 // static |
| 60 ICCProfile ICCProfile::FromData(const char* data, size_t size) { | 64 ICCProfile ICCProfile::FromData(const char* data, size_t size) { |
| 61 ICCProfile icc_profile; | 65 ICCProfile icc_profile; |
| 62 if (IsValidProfileLength(size)) { | 66 if (IsValidProfileLength(size)) { |
| 63 icc_profile.type_ = Type::FROM_DATA; | 67 icc_profile.type_ = Type::FROM_DATA; |
| 64 icc_profile.data_.insert(icc_profile.data_.begin(), data, data + size); | 68 icc_profile.data_.insert(icc_profile.data_.begin(), data, data + size); |
| 65 } else { | 69 } else { |
| 66 return ICCProfile(); | 70 return ICCProfile(); |
| 67 } | 71 } |
| 68 | 72 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 218 |
| 215 return color_space; | 219 return color_space; |
| 216 } | 220 } |
| 217 | 221 |
| 218 // static | 222 // static |
| 219 bool ICCProfile::IsValidProfileLength(size_t length) { | 223 bool ICCProfile::IsValidProfileLength(size_t length) { |
| 220 return length >= kMinProfileLength && length <= kMaxProfileLength; | 224 return length >= kMinProfileLength && length <= kMaxProfileLength; |
| 221 } | 225 } |
| 222 | 226 |
| 223 } // namespace gfx | 227 } // namespace gfx |
| OLD | NEW |