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

Unified Diff: ui/gfx/icc_profile.cc

Issue 2161293002: Color: Separate ICCProfile and ColorSpace structures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add parts to resource provider Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/icc_profile.cc
diff --git a/ui/gfx/icc_profile.cc b/ui/gfx/icc_profile.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bd9af71cb80ba74686f7e1da7b150744f59e0efa
--- /dev/null
+++ b/ui/gfx/icc_profile.cc
@@ -0,0 +1,62 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/icc_profile.h"
+
+namespace gfx {
+
+namespace {
+static const size_t kMinProfileLength = 128;
+static const size_t kMaxProfileLength = 4 * 1024 * 1024;
+} // namespace
+
+ICCProfile::ICCProfile() = default;
+ICCProfile::ICCProfile(ICCProfile&& other) = default;
+ICCProfile::ICCProfile(const ICCProfile& other) = default;
+ICCProfile& ICCProfile::operator=(const ICCProfile& other) = default;
+ICCProfile::~ICCProfile() = default;
+
+bool ICCProfile::operator==(const ICCProfile& other) const {
+ return valid_ == other.valid_ && data_ == other.data_;
+}
+
+// static
+ICCProfile ICCProfile::FromData(const std::vector<char>& icc_profile_data) {
+ ICCProfile icc_profile;
+ if (IsValidProfileLength(icc_profile_data.size())) {
+ icc_profile.valid_ = true;
+ icc_profile.data_ = icc_profile_data;
+ }
+ return icc_profile;
+}
+
+#if !defined(OS_WIN) && !defined(OS_MACOSX)
+// static
+ICCProfile ICCProfile::FromBestMonitor() {
+ return ICCProfile();
+}
+#endif
+
+// static
+ICCProfile ICCProfile::FromColorSpace(const gfx::ColorSpace& color_space) {
+ // 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
+ // objects.
+ return ICCProfile();
+}
+
+const std::vector<char>& ICCProfile::GetData() const {
+ return data_;
+}
+
+ColorSpace ICCProfile::GetColorSpace() const {
+ // TODO(ccameron): Convert the ICC profile to a ColorSpace object.
+ return ColorSpace();
+}
+
+// static
+bool ICCProfile::IsValidProfileLength(size_t length) {
+ return length >= kMinProfileLength && length <= kMaxProfileLength;
+}
+
+} // namespace gfx
« ui/gfx/icc_profile.h ('K') | « ui/gfx/icc_profile.h ('k') | ui/gfx/icc_profile_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698