Flutter Linux Embedder
fl_compositor.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_H_
7 
8 #include <glib-object.h>
9 
10 #include "flutter/shell/platform/embedder/embedder.h"
11 
12 G_BEGIN_DECLS
13 
14 G_DECLARE_DERIVABLE_TYPE(FlCompositor, fl_compositor, FL, COMPOSITOR, GObject)
15 
17  GObjectClass parent_class;
18 
19  gboolean (*create_backing_store)(FlCompositor* compositor,
20  const FlutterBackingStoreConfig* config,
21  FlutterBackingStore* backing_store_out);
22 
23  gboolean (*collect_backing_store)(FlCompositor* compositor,
24  const FlutterBackingStore* backing_store);
25 
26  gboolean (*present_layers)(FlCompositor* compositor,
27  FlutterViewId view_id,
28  const FlutterLayer** layers,
29  size_t layers_count);
30 
31  void (*wait_for_frame)(FlCompositor* compositor,
32  int target_width,
33  int target_height);
34 };
35 
36 /**
37  * FlCompositor:
38  *
39  * #FlCompositor is an abstract class that implements Flutter compositing.
40  */
41 
42 /**
43  * fl_compositor_create_backing_store:
44  * @compositor: an #FlCompositor.
45  * @config: backing store config.
46  * @backing_store_out: saves created backing store.
47  *
48  * Obtain a backing store for a specific #FlutterLayer.
49  *
50  * Returns %TRUE if successful.
51  */
53  FlCompositor* compositor,
54  const FlutterBackingStoreConfig* config,
55  FlutterBackingStore* backing_store_out);
56 
57 /**
58  * fl_compositor_collect_backing_store:
59  * @compositor: an #FlCompositor.
60  * @backing_store: backing store to be released.
61  *
62  * A callback invoked by the engine to release the backing store. The
63  * embedder may collect any resources associated with the backing store.
64  *
65  * Returns %TRUE if successful.
66  */
68  FlCompositor* compositor,
69  const FlutterBackingStore* backing_store);
70 
71 /**
72  * fl_compositor_present_layers:
73  * @compositor: an #FlCompositor.
74  * @view_id: view to present.
75  * @layers: layers to be composited.
76  * @layers_count: number of layers.
77  *
78  * Callback invoked by the engine to composite the contents of each layer
79  * onto the screen.
80  *
81  * Returns %TRUE if successful.
82  */
83 gboolean fl_compositor_present_layers(FlCompositor* compositor,
84  FlutterViewId view_id,
85  const FlutterLayer** layers,
86  size_t layers_count);
87 
88 /**
89  * fl_compositor_wait_for_frame:
90  * @compositor: an #FlCompositor.
91  * @target_width: width of frame being waited for
92  * @target_height: height of frame being waited for
93  *
94  * Holds the thread until frame with requested dimensions is presented.
95  * While waiting for frame Flutter platform and raster tasks are being
96  * processed.
97  */
98 void fl_compositor_wait_for_frame(FlCompositor* compositor,
99  int target_width,
100  int target_height);
101 
102 G_END_DECLS
103 
104 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_H_
G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode, fl_accessible_node, FL, ACCESSIBLE_NODE, AtkObject)
void fl_compositor_wait_for_frame(FlCompositor *compositor, int target_width, int target_height)
gboolean fl_compositor_create_backing_store(FlCompositor *compositor, const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out)
gboolean fl_compositor_present_layers(FlCompositor *compositor, FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count)
gboolean fl_compositor_collect_backing_store(FlCompositor *compositor, const FlutterBackingStore *backing_store)
static gboolean present_layers(FlCompositorOpenGL *self, FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count)
G_BEGIN_DECLS FlutterViewId view_id
GObjectClass parent_class
Definition: fl_compositor.h:17