1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34

ash / components / arc / mojom / arc_gfx_mojom_traits.h [blame]

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_COMPONENTS_ARC_MOJOM_ARC_GFX_MOJOM_TRAITS_H_
#define ASH_COMPONENTS_ARC_MOJOM_ARC_GFX_MOJOM_TRAITS_H_

#include "ash/components/arc/mojom/gfx.mojom-shared.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/range/range.h"

namespace mojo {

template <>
struct StructTraits<arc::mojom::RectDataView, gfx::Rect> {
  static int32_t left(const gfx::Rect& r) { return r.x(); }
  static int32_t top(const gfx::Rect& r) { return r.y(); }
  static int32_t right(const gfx::Rect& r) { return r.right(); }
  static int32_t bottom(const gfx::Rect& r) { return r.bottom(); }

  static bool Read(arc::mojom::RectDataView data, gfx::Rect* out);
};

template <>
struct StructTraits<arc::mojom::RangeDataView, gfx::Range> {
  static uint32_t start(const gfx::Range& r) { return r.start(); }
  static uint32_t end(const gfx::Range& r) { return r.end(); }

  static bool Read(arc::mojom::RangeDataView data, gfx::Range* out);
};

}  // namespace mojo

#endif  // ASH_COMPONENTS_ARC_MOJOM_ARC_GFX_MOJOM_TRAITS_H_