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

Unified Diff: ui/gfx/mojo/icc_profile_struct_traits.cc

Issue 2663453002: Revert of Use SkICC in gfx::ICCProfile and gfx::ColorSpace (Closed)
Patch Set: Created 3 years, 11 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/mojo/icc_profile_struct_traits.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/mojo/icc_profile_struct_traits.cc
diff --git a/ui/gfx/mojo/icc_profile_struct_traits.cc b/ui/gfx/mojo/icc_profile_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e612f362903d499e01068c65b840e17b0bd35ba8
--- /dev/null
+++ b/ui/gfx/mojo/icc_profile_struct_traits.cc
@@ -0,0 +1,30 @@
+// 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/mojo/icc_profile_struct_traits.h"
+
+#include <algorithm>
+
+#include "mojo/public/cpp/bindings/string_data_view.h"
+
+namespace mojo {
+
+using Traits = StructTraits<gfx::mojom::ICCProfileDataView, gfx::ICCProfile>;
+
+// static
+bool Traits::Read(gfx::mojom::ICCProfileDataView data, gfx::ICCProfile* out) {
+ if (!data.ReadType(&out->type_))
+ return false;
+ if (!data.ReadColorSpace(&out->color_space_))
+ return false;
+ out->id_ = data.id();
+
+ mojo::StringDataView view;
+ data.GetDataDataView(&view);
+ out->data_.resize(view.size());
+ std::copy(view.storage(), view.storage() + view.size(), out->data_.begin());
+ return true;
+}
+
+} // namespace mojo
« no previous file with comments | « ui/gfx/mojo/icc_profile_struct_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698