1 // Copyright 2015 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 CONTENT_COMMON_SYNC_COMPOSITOR_MESSAGES_H_
6 #define CONTENT_COMMON_SYNC_COMPOSITOR_MESSAGES_H_
7 
8 #include <stddef.h>
9 
10 #include "content/common/content_export.h"
11 #include "content/common/content_param_traits.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ui/gfx/geometry/point.h"
14 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/geometry/scroll_offset.h"
16 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/geometry/size_f.h"
18 #include "ui/gfx/transform.h"
19 
20 #ifndef INTERNAL_CONTENT_COMMON_SYNC_COMPOSITOR_MESSAGES_H_
21 #define INTERNAL_CONTENT_COMMON_SYNC_COMPOSITOR_MESSAGES_H_
22 
23 namespace content {
24 
25 struct SyncCompositorDemandDrawHwParams {
26   SyncCompositorDemandDrawHwParams();
27   SyncCompositorDemandDrawHwParams(
28       const gfx::Size& viewport_size,
29       const gfx::Rect& viewport_rect_for_tile_priority,
30       const gfx::Transform& transform_for_tile_priority);
31   ~SyncCompositorDemandDrawHwParams();
32 
33   gfx::Size viewport_size;
34   gfx::Rect viewport_rect_for_tile_priority;
35   gfx::Transform transform_for_tile_priority;
36 };
37 
38 struct SyncCompositorDemandDrawSwParams {
39   SyncCompositorDemandDrawSwParams();
40   ~SyncCompositorDemandDrawSwParams();
41 
42   gfx::Size size;
43   gfx::Rect clip;
44   gfx::Transform transform;
45 };
46 
47 struct SyncCompositorCommonRendererParams {
48   SyncCompositorCommonRendererParams();
49   ~SyncCompositorCommonRendererParams();
50 
51   // Allow copy.
52   SyncCompositorCommonRendererParams(
53       const SyncCompositorCommonRendererParams& other);
54   SyncCompositorCommonRendererParams& operator=(
55       const SyncCompositorCommonRendererParams& other);
56 
57   unsigned int version = 0u;
58   gfx::ScrollOffset total_scroll_offset;
59   gfx::ScrollOffset max_scroll_offset;
60   gfx::SizeF scrollable_size;
61   float page_scale_factor = 0.f;
62   float min_page_scale_factor = 0.f;
63   float max_page_scale_factor = 0.f;
64   uint32_t need_invalidate_count = 0u;
65   bool invalidate_needs_draw = true;
66   uint32_t did_activate_pending_tree_count = 0u;
67 };
68 
69 }  // namespace content
70 
71 #endif  // INTERNAL_CONTENT_COMMON_SYNC_COMPOSITOR_MESSAGES_H_
72 
73 IPC_STRUCT_TRAITS_BEGIN(content::SyncCompositorDemandDrawHwParams)
74   IPC_STRUCT_TRAITS_MEMBER(viewport_size)
75   IPC_STRUCT_TRAITS_MEMBER(viewport_rect_for_tile_priority)
76   IPC_STRUCT_TRAITS_MEMBER(transform_for_tile_priority)
77 IPC_STRUCT_TRAITS_END()
78 
79 IPC_STRUCT_TRAITS_BEGIN(content::SyncCompositorDemandDrawSwParams)
80   IPC_STRUCT_TRAITS_MEMBER(size)
81   IPC_STRUCT_TRAITS_MEMBER(clip)
82   IPC_STRUCT_TRAITS_MEMBER(transform)
83 IPC_STRUCT_TRAITS_END()
84 
85 IPC_STRUCT_TRAITS_BEGIN(content::SyncCompositorCommonRendererParams)
86   IPC_STRUCT_TRAITS_MEMBER(version)
87   IPC_STRUCT_TRAITS_MEMBER(total_scroll_offset)
88   IPC_STRUCT_TRAITS_MEMBER(max_scroll_offset)
89   IPC_STRUCT_TRAITS_MEMBER(scrollable_size)
90   IPC_STRUCT_TRAITS_MEMBER(page_scale_factor)
91   IPC_STRUCT_TRAITS_MEMBER(min_page_scale_factor)
92   IPC_STRUCT_TRAITS_MEMBER(max_page_scale_factor)
93   IPC_STRUCT_TRAITS_MEMBER(need_invalidate_count)
94   IPC_STRUCT_TRAITS_MEMBER(invalidate_needs_draw)
95   IPC_STRUCT_TRAITS_MEMBER(did_activate_pending_tree_count)
96 IPC_STRUCT_TRAITS_END()
97 
98 #endif  // CONTENT_COMMON_SYNC_COMPOSITOR_MESSAGES_H_
99