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_OZONE_COMMON_MOJO_DISPLAY_MODE_PARAMS_STRUCT_TRAITS_H_ |
| 6 #define UI_OZONE_COMMON_MOJO_DISPLAY_MODE_PARAMS_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "ui/gfx/geometry/size.h" |
| 9 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
| 10 #include "ui/ozone/common/mojo/display_mode_params.mojom.h" |
| 11 |
| 12 namespace mojo { |
| 13 |
| 14 template <> |
| 15 struct StructTraits<ui::mojom::DisplayModeParamsDataView, |
| 16 ui::DisplayMode_Params> { |
| 17 static const gfx::Size& size(const ui::DisplayMode_Params& display_mode) { |
| 18 return display_mode.size; |
| 19 } |
| 20 |
| 21 static bool is_interlaced(const ui::DisplayMode_Params& display_mode) { |
| 22 return display_mode.is_interlaced; |
| 23 } |
| 24 |
| 25 static float refresh_rate(const ui::DisplayMode_Params& display_mode) { |
| 26 return display_mode.refresh_rate; |
| 27 } |
| 28 |
| 29 static bool Read(ui::mojom::DisplayModeParamsDataView data, |
| 30 ui::DisplayMode_Params* out) { |
| 31 if (!data.ReadSize(&out->size)) |
| 32 return false; |
| 33 |
| 34 out->is_interlaced = data.is_interlaced(); |
| 35 out->refresh_rate = data.refresh_rate(); |
| 36 |
| 37 return true; |
| 38 } |
| 39 }; |
| 40 |
| 41 } // namespace mojo |
| 42 |
| 43 #endif // UI_OZONE_COMMON_MOJO_DISPLAY_MODE_PARAMS_STRUCT_TRAITS_H_ |
OLD | NEW |