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

Unified Diff: ui/gfx/color_space.cc

Issue 2106303002: Color: Rename gfx::ColorProfile to gfx::ColorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ui/gfx/color_space.h ('k') | ui/gfx/color_space_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_space.cc
diff --git a/ui/gfx/color_space.cc b/ui/gfx/color_space.cc
new file mode 100644
index 0000000000000000000000000000000000000000..37cc0e277f7cd98098fab2afd3c0a057313e894c
--- /dev/null
+++ b/ui/gfx/color_space.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 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 "build/build_config.h"
+#include "ui/gfx/color_space.h"
+
+namespace gfx {
+
+namespace {
+static const size_t kMinProfileLength = 128;
+static const size_t kMaxProfileLength = 4 * 1024 * 1024;
+}
+
+ColorSpace::ColorSpace() = default;
+ColorSpace::ColorSpace(ColorSpace&& other) = default;
+ColorSpace::ColorSpace(const ColorSpace& other) = default;
+ColorSpace& ColorSpace::operator=(const ColorSpace& other) = default;
+ColorSpace::~ColorSpace() = default;
+
+bool ColorSpace::operator==(const ColorSpace& other) const {
+ return icc_profile_ == other.icc_profile_;
+}
+
+ColorSpace ColorSpace::FromICCProfile(const std::vector<char>& icc_profile) {
+ ColorSpace color_space;
+ if (IsValidProfileLength(icc_profile.size()))
+ color_space.icc_profile_ = icc_profile;
+ return color_space;
+}
+
+#if !defined(OS_WIN) && !defined(OS_MACOSX)
+// static
+ColorSpace ColorSpace::FromBestMonitor() {
+ return ColorSpace();
+}
+#endif
+
+// static
+bool ColorSpace::IsValidProfileLength(size_t length) {
+ return length >= kMinProfileLength && length <= kMaxProfileLength;
+}
+
+} // namespace gfx
« no previous file with comments | « ui/gfx/color_space.h ('k') | ui/gfx/color_space_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698