Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
fl_compositor_opengl.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_OPENGL_H_
6#define FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_OPENGL_H_
7
8#include <gtk/gtk.h>
9
13
14G_BEGIN_DECLS
15
16G_DECLARE_FINAL_TYPE(FlCompositorOpenGL,
17 fl_compositor_opengl,
18 FL,
19 COMPOSITOR_OPENGL,
20 GObject)
21
22/**
23 * FlCompositorOpenGL:
24 *
25 * #FlCompositorOpenGL is class that implements compositing using OpenGL.
26 *
27 * The composited frame is stored in an OpenGL framebuffer (texture).
28 *
29 * A frame may be written by fl_compositor_opengl_composite_layers using one
30 * OpenGL context and read by fl_compositor_opengl_render using another. When
31 * the compositor is created as shareable the two contexts must belong to the
32 * same share group so the frame texture can be accessed from both, and the
33 * writing context issues a glFlush() so the frame is visible to the reading
34 * context. When not shareable the frame is copied to CPU memory by the writing
35 * context and uploaded into a new texture by the reading context.
36 */
37
38/**
39 * fl_compositor_opengl_new:
40 * @opengl_manager: an #FlOpenGLManager
41 * @shareable: %TRUE if the compositor can use a framebuffer that is shared
42 * between contexts.
43 *
44 * Creates a new OpenGL compositor.
45 *
46 * Returns: a new #FlCompositorOpenGL.
47 */
48FlCompositorOpenGL* fl_compositor_opengl_new(FlOpenGLManager* opengl_manager,
49 gboolean shareable);
50
51/**
52 * fl_compositor_opengl_composite_layers:
53 * @compositor: an #FlCompositorOpenGL.
54 * @layers: layers to be composited.
55 * @layers_count: number of layers.
56 *
57 * Composite layers into the stored frame using the current OpenGL context.
58 *
59 * Returns %TRUE if successful.
60 */
61gboolean fl_compositor_opengl_composite_layers(FlCompositorOpenGL* compositor,
62 const FlutterLayer** layers,
63 size_t layers_count);
64
65/**
66 * fl_compositor_opengl_get_frame_size:
67 * @compositor: an #FlCompositorOpenGL.
68 * @width: location to write frame width in pixels.
69 * @height: location to write frame height in pixels.
70 *
71 * Get the size of the layer ready for rendering.
72 */
73void fl_compositor_opengl_get_frame_size(FlCompositorOpenGL* compositor,
74 size_t* width,
75 size_t* height);
76
77/**
78 * fl_compositor_opengl_render:
79 * @compositor: an #FlCompositorOpenGL.
80 * @cr: a Cairo rendering context.
81 * @window: window being rendered into.
82 *
83 * Renders the current frame using the current OpenGL context.
84 *
85 * Returns %TRUE if successful.
86 */
87gboolean fl_compositor_opengl_render(FlCompositorOpenGL* compositor,
88 cairo_t* cr,
89 GdkWindow* window);
90
91G_END_DECLS
92
93#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_OPENGL_H_
GLFWwindow * window
Definition main.cc:60
FlCompositorOpenGL * fl_compositor_opengl_new(FlOpenGLManager *opengl_manager, gboolean shareable)
gboolean fl_compositor_opengl_render(FlCompositorOpenGL *compositor, cairo_t *cr, GdkWindow *window)
G_BEGIN_DECLS gboolean shareable
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlCompositorOpenGL, fl_compositor_opengl, FL, COMPOSITOR_OPENGL, GObject) FlCompositorOpenGL *fl_compositor_opengl_new(FlOpenGLManager *opengl_manager
void fl_compositor_opengl_get_frame_size(FlCompositorOpenGL *compositor, size_t *width, size_t *height)
gboolean fl_compositor_opengl_composite_layers(FlCompositorOpenGL *compositor, const FlutterLayer **layers, size_t layers_count)
const FlutterLayer size_t layers_count
const FlutterLayer ** layers
int32_t height
int32_t width