OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 #ifndef UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ |
| 6 #define UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "ui/display/types/display_mode.h" |
| 9 #include "ui/display/mojo/display_mode.mojom.h" |
| 10 #include "ui/gfx/geometry/size.h" |
| 11 |
| 12 namespace mojo { |
| 13 |
| 14 template <> |
| 15 struct StructTraits<display::mojom::DisplayModeDataView, display::DisplayMode> { |
| 16 static const gfx::Size& size(const display::DisplayMode& display_mode) { |
| 17 return display_mode.size(); |
| 18 } |
| 19 |
| 20 static bool is_interlaced(const display::DisplayMode& display_mode) { |
| 21 return display_mode.is_interlaced(); |
| 22 } |
| 23 |
| 24 static float refresh_rate(const display::DisplayMode& display_mode) { |
| 25 return display_mode.refresh_rate(); |
| 26 } |
| 27 |
| 28 static bool Read(display::mojom::DisplayModeDataView data, |
| 29 display::DisplayMode* out) { |
| 30 if (!data.ReadSize(&out->size_)) |
| 31 return false; |
| 32 |
| 33 out->is_interlaced_ = data.is_interlaced(); |
| 34 out->refresh_rate_ = data.refresh_rate(); |
| 35 |
| 36 return true; |
| 37 } |
| 38 }; |
| 39 |
| 40 } // namespace mojo |
| 41 |
| 42 #endif // UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ |
OLD | NEW |