| Flutter Windows Embedder |

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_WINDOWS_COMPOSITOR_OPENGL_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_COMPOSITOR_OPENGL_H_
7
8 #include <memory>
9
10 #include "flutter/impeller/renderer/backend/gles/proc_table_gles.h"
11 #include "flutter/shell/platform/embedder/embedder.h"
12 #include "flutter/shell/platform/windows/compositor.h"
13 #include "flutter/shell/platform/windows/flutter_windows_engine.h"
14
15 namespace flutter {
16
17 // Enables the Flutter engine to render content on Windows using OpenGL.
18 class CompositorOpenGL : public Compositor {
19 public:
20 CompositorOpenGL(FlutterWindowsEngine* engine,
21 impeller::ProcTableGLES::Resolver resolver);
22
23 /// |Compositor|
24 bool CreateBackingStore(const FlutterBackingStoreConfig& config,
25 FlutterBackingStore* result) override;
26
27 /// |Compositor|
28 bool CollectBackingStore(const FlutterBackingStore* store) override;
29
30 /// |Compositor|
31 bool Present(FlutterViewId view_id,
32 const FlutterLayer** layers,
33 size_t layers_count) override;
34
35 private:
36 // The Flutter engine that manages the views to render.
37 FlutterWindowsEngine* engine_;
38
39 private:
40 // The compositor initializes itself lazily once |CreateBackingStore| is
41 // called. True if initialization completed successfully.
42 bool is_initialized_ = false;
43
44 // Function used to resolve GLES functions.
45 impeller::ProcTableGLES::Resolver resolver_ = nullptr;
46
47 // Table of resolved GLES functions. Null until the compositor is initialized.
48 std::unique_ptr<impeller::ProcTableGLES> gl_ = nullptr;
49
50 // The OpenGL texture target format for backing stores. Invalid value until
51 // the compositor is initialized.
52 uint32_t format_ = 0;
53
54 // Initialize the compositor. This must run on the raster thread.
55 bool Initialize();
56
57 // Clear the view's surface and removes any previously presented layers.
58 bool Clear(FlutterWindowsView* view);
59 };
60
61 } // namespace flutter
62
63 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_COMPOSITOR_OPENGL_H_
flutter::FlutterWindowsView
Definition: flutter_windows_view.h:34
flutter::CompositorOpenGL::CompositorOpenGL
CompositorOpenGL(FlutterWindowsEngine *engine, impeller::ProcTableGLES::Resolver resolver)
Definition: compositor_opengl.cc:38
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:89
flutter::CompositorOpenGL::CreateBackingStore
bool CreateBackingStore(const FlutterBackingStoreConfig &config, FlutterBackingStore *result) override
|Compositor|
Definition: compositor_opengl.cc:42
flutter::CompositorOpenGL::CollectBackingStore
bool CollectBackingStore(const FlutterBackingStore *store) override
|Compositor|
Definition: compositor_opengl.cc:80
flutter::FlutterViewId
int64_t FlutterViewId
Definition: flutter_view.h:13
flutter::CompositorOpenGL::Present
bool Present(FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count) override
|Compositor|
Definition: compositor_opengl.cc:95
flutter
Definition: accessibility_bridge_windows.cc:11
flutter_windows_engine.h
flutter::CompositorOpenGL
Definition: compositor_opengl.h:18
compositor.h
flutter::Compositor
Definition: compositor.h:20