Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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 <cairo.h>
9#include <gdk/gdk.h>
10
12
13G_BEGIN_DECLS
14
15// Maximum time to wait for a frame to be ready before giving up and rendering.
16constexpr gint64 kCompositorRenderTimeoutMicroseconds = 100000; // 100ms
17
18G_DECLARE_DERIVABLE_TYPE(FlCompositor, fl_compositor, FL, COMPOSITOR, GObject)
19
21 GObjectClass parent_class;
22
23 gboolean (*present_layers)(FlCompositor* compositor,
24 const FlutterLayer** layers,
25 size_t layers_count);
26
27 void (*get_frame_size)(FlCompositor* compositor,
28 size_t* width,
29 size_t* height);
30
31 gboolean (*render)(FlCompositor* compositor,
32 cairo_t* cr,
33 GdkWindow* window,
34 gboolean wait_for_frame);
35};
36
37/**
38 * FlCompositor:
39 *
40 * #FlCompositor is an abstract class that implements Flutter compositing.
41 */
42
43/**
44 * fl_compositor_present_layers:
45 * @compositor: an #FlCompositor.
46 * @layers: layers to be composited.
47 * @layers_count: number of layers.
48 *
49 * Composite layers. Called from the Flutter rendering thread.
50 *
51 * Returns %TRUE if successful.
52 */
53gboolean fl_compositor_present_layers(FlCompositor* compositor,
54 const FlutterLayer** layers,
55 size_t layers_count);
56
57/**
58 * fl_compositor_get_frame_size:
59 * @compositor: an #FlCompositor.
60 * @width: location to write frame width in pixels.
61 * @height: location to write frame height in pixels.
62 *
63 * Get the size of the layer ready for rendering.
64 */
65void fl_compositor_get_frame_size(FlCompositor* compositor,
66 size_t* width,
67 size_t* height);
68
69/**
70 * fl_compositor_render:
71 * @compositor: an #FlCompositor.
72 * @cr: a Cairo rendering context.
73 * @window: window being rendered into.
74 * @wait_for_frame: if the available frame is not the size of the window block
75 * until a new frame is received.
76 *
77 * Renders the current frame. Called from the GTK thread.
78 *
79 * Returns %TRUE if successful.
80 */
81gboolean fl_compositor_render(FlCompositor* compositor,
82 cairo_t* cr,
83 GdkWindow* window,
84 gboolean wait_for_frame);
85
86G_END_DECLS
87
88#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_H_
GLFWwindow * window
Definition main.cc:60
G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE(FlAccessibilityHandler, fl_accessibility_handler, FL, ACCESSIBILITY_HANDLER, GObject)
G_BEGIN_DECLS constexpr gint64 kCompositorRenderTimeoutMicroseconds
gboolean fl_compositor_render(FlCompositor *compositor, cairo_t *cr, GdkWindow *window, gboolean wait_for_frame)
void fl_compositor_get_frame_size(FlCompositor *compositor, size_t *width, size_t *height)
gboolean fl_compositor_present_layers(FlCompositor *compositor, const FlutterLayer **layers, size_t layers_count)
const FlutterLayer size_t layers_count
const FlutterLayer ** layers
int32_t height
int32_t width
GObjectClass parent_class