OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gfx/mojo/icc_profile_struct_traits.h" | |
6 | |
7 #include <algorithm> | |
8 | |
9 #include "mojo/public/cpp/bindings/string_data_view.h" | |
10 | |
11 namespace mojo { | |
12 | |
13 using Traits = StructTraits<gfx::mojom::ICCProfileDataView, gfx::ICCProfile>; | |
14 | |
15 // static | |
16 bool Traits::Read(gfx::mojom::ICCProfileDataView data, gfx::ICCProfile* out) { | |
17 if (!data.ReadType(&out->type_)) | |
18 return false; | |
19 if (!data.ReadColorSpace(&out->color_space_)) | |
20 return false; | |
21 out->id_ = data.id(); | |
22 | |
23 mojo::StringDataView view; | |
24 data.GetDataDataView(&view); | |
25 out->data_.resize(view.size()); | |
26 std::copy(view.storage(), view.storage() + view.size(), out->data_.begin()); | |
27 return true; | |
28 } | |
29 | |
30 } // namespace mojo | |
OLD | NEW |