Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
embedder_test_context_gl.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_EMBEDDER_TESTS_EMBEDDER_TEST_CONTEXT_GL_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_CONTEXT_GL_H_
7
8#include "flutter/shell/platform/embedder/tests/embedder_test_context.h"
9#include "flutter/testing/test_gl_surface.h"
10
11namespace flutter {
12namespace testing {
13
15 public:
16 using GLGetFBOCallback = std::function<void(FlutterFrameInfo frame_info)>;
18 std::function<void(intptr_t id, FlutterDamage* existing_damage)>;
20 std::function<void(FlutterPresentInfo present_info)>;
21
22 explicit EmbedderTestContextGL(std::string assets_path = "");
23
24 ~EmbedderTestContextGL() override;
25
26 size_t GetSurfacePresentCount() const override;
27
28 // |EmbedderTestContext|
30
31 //----------------------------------------------------------------------------
32 /// @brief Sets a callback that will be invoked (on the raster task
33 /// runner) when the engine asks the embedder for a new FBO ID at
34 /// the updated size.
35 ///
36 /// @attention The callback will be invoked on the raster task runner. The
37 /// callback can be set on the tests host thread.
38 ///
39 /// @param[in] callback The callback to set. The previous callback will be
40 /// un-registered.
41 ///
43
46
47 uint32_t GetWindowFBOId() const;
48
49 //----------------------------------------------------------------------------
50 /// @brief Sets a callback that will be invoked (on the raster task
51 /// runner) when the engine presents an fbo that was given by the
52 /// embedder.
53 ///
54 /// @attention The callback will be invoked on the raster task runner. The
55 /// callback can be set on the tests host thread.
56 ///
57 /// @param[in] callback The callback to set. The previous callback will be
58 /// un-registered.
59 ///
61
62 void GLPopulateExistingDamage(const intptr_t id,
63 FlutterDamage* existing_damage);
64
65 void* GLGetProcAddress(const char* name);
66
67 protected:
68 virtual void SetupCompositor() override;
69
70 private:
71 // This allows the builder to access the hooks.
73
74 std::unique_ptr<TestGLSurface> gl_surface_;
75 size_t gl_surface_present_count_ = 0;
76 std::mutex gl_callback_mutex_;
77 GLGetFBOCallback gl_get_fbo_callback_;
78 GLPresentCallback gl_present_callback_;
79 GLPopulateExistingDamageCallback gl_populate_existing_damage_callback_;
80
81 void SetupSurface(SkISize surface_size) override;
82
83 bool GLMakeCurrent();
84
85 bool GLClearCurrent();
86
87 bool GLPresent(FlutterPresentInfo present_info);
88
89 uint32_t GLGetFramebuffer(FlutterFrameInfo frame_info);
90
91 bool GLMakeResourceCurrent();
92
94};
95
96} // namespace testing
97} // namespace flutter
98
99#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_CONTEXT_GL_H_
std::function< void(FlutterPresentInfo present_info)> GLPresentCallback
void SetGLGetFBOCallback(GLGetFBOCallback callback)
Sets a callback that will be invoked (on the raster task runner) when the engine asks the embedder fo...
void GLPopulateExistingDamage(const intptr_t id, FlutterDamage *existing_damage)
EmbedderTestContextType GetContextType() const override
void SetGLPopulateExistingDamageCallback(GLPopulateExistingDamageCallback callback)
std::function< void(FlutterFrameInfo frame_info)> GLGetFBOCallback
void SetGLPresentCallback(GLPresentCallback callback)
Sets a callback that will be invoked (on the raster task runner) when the engine presents an fbo that...
std::function< void(intptr_t id, FlutterDamage *existing_damage)> GLPopulateExistingDamageCallback
void SetupSurface(SkISize surface_size) override
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32
A structure to represent a damage region.
Definition embedder.h:458