6#define FML_USED_ON_EMBEDDER
15#include "flutter/flow/raster_cache.h"
16#include "flutter/fml/file.h"
17#include "flutter/fml/make_copyable.h"
18#include "flutter/fml/mapping.h"
19#include "flutter/fml/message_loop.h"
20#include "flutter/fml/message_loop_task_queues.h"
21#include "flutter/fml/native_library.h"
22#include "flutter/fml/paths.h"
23#include "flutter/fml/synchronization/count_down_latch.h"
24#include "flutter/fml/synchronization/waitable_event.h"
25#include "flutter/fml/task_source.h"
26#include "flutter/fml/thread.h"
27#include "flutter/lib/ui/painting/image.h"
28#include "flutter/runtime/dart_vm.h"
29#include "flutter/shell/platform/embedder/embedder_surface_gl_impeller.h"
30#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
31#include "flutter/shell/platform/embedder/tests/embedder_config_builder.h"
32#include "flutter/shell/platform/embedder/tests/embedder_test.h"
33#include "flutter/shell/platform/embedder/tests/embedder_test_context_gl.h"
34#include "flutter/shell/platform/embedder/tests/embedder_unittests_util.h"
35#include "flutter/testing/assertions_skia.h"
36#include "flutter/testing/test_gl_surface.h"
37#include "flutter/testing/testing.h"
59 ASSERT_TRUE(
engine.is_valid());
68 MustPreventEngineLaunchWhenRequiredCompositorArgsAreAbsent) {
73 builder.GetCompositor().create_backing_store_callback =
nullptr;
74 builder.GetCompositor().collect_backing_store_callback =
nullptr;
75 builder.GetCompositor().present_layers_callback =
nullptr;
76 builder.GetCompositor().present_view_callback =
nullptr;
78 ASSERT_FALSE(
engine.is_valid());
91 builder.GetCompositor().present_layers_callback =
95 builder.GetCompositor().present_view_callback =
98 ASSERT_FALSE(
engine.is_valid());
111 builder.SetDartEntrypoint(
"can_composite_platform_views");
117 context.GetCompositor().SetNextPresentCallback(
119 size_t layers_count) {
120 ASSERT_EQ(layers_count, 3u);
135 .rects = paint_region_rects,
139 .paint_region = &paint_region,
150 ASSERT_EQ(*layers[0], layer);
165 ASSERT_EQ(*layers[1], layer);
181 .rects = paint_region_rects,
185 .paint_region = &paint_region,
196 ASSERT_EQ(*layers[2], layer);
202 context.AddNativeCallback(
214 event.pixel_ratio = 1.0;
217 ASSERT_TRUE(
engine.is_valid());
231 builder.SetDartEntrypoint(
"can_composite_platform_views_with_opacity");
239 context.GetCompositor().SetNextPresentCallback(
241 size_t layers_count) {
242 ASSERT_EQ(layers_count, 3u);
257 .rects = paint_region_rects,
261 .paint_region = &paint_region,
272 ASSERT_EQ(*layers[0], layer);
287 ASSERT_EQ(*layers[1], layer);
303 .rects = paint_region_rects,
307 .paint_region = &paint_region,
318 ASSERT_EQ(*layers[2], layer);
324 context.AddNativeCallback(
336 event.pixel_ratio = 1.0;
339 ASSERT_TRUE(
engine.is_valid());
343 shell.GetTaskRunners().GetRasterTaskRunner()->PostTask([&] {
345 shell.GetRasterizer()->compositor_context()->raster_cache();
364 builder.SetDartEntrypoint(
"can_composite_with_opacity");
372 context.GetCompositor().SetNextPresentCallback(
374 size_t layers_count) {
375 ASSERT_EQ(layers_count, 1u);
390 .rects = paint_region_rects,
394 .paint_region = &paint_region,
405 ASSERT_EQ(*layers[0], layer);
411 context.AddNativeCallback(
423 event.pixel_ratio = 1.0;
426 ASSERT_TRUE(
engine.is_valid());
430 shell.GetTaskRunners().GetRasterTaskRunner()->PostTask([&] {
432 shell.GetRasterizer()->compositor_context()->raster_cache();
450 builder.SetDartEntrypoint(
"can_composite_platform_views");
456 context.GetCompositor().SetNextPresentCallback(
458 size_t layers_count) {
459 ASSERT_EQ(layers_count, 3u);
474 .rects = paint_region_rects,
478 .paint_region = &paint_region,
489 ASSERT_EQ(*layers[0], layer);
504 ASSERT_EQ(*layers[1], layer);
520 .rects = paint_region_rects,
524 .paint_region = &paint_region,
535 ASSERT_EQ(*layers[2], layer);
541 context.AddNativeCallback(
553 event.pixel_ratio = 1.0;
556 ASSERT_TRUE(
engine.is_valid());
571 builder.SetDartEntrypoint(
"can_composite_platform_views");
577 context.GetCompositor().SetNextPresentCallback(
579 size_t layers_count) {
580 ASSERT_EQ(layers_count, 3u);
597 .rects = paint_region_rects,
601 .paint_region = &paint_region,
612 ASSERT_EQ(*layers[0], layer);
627 ASSERT_EQ(*layers[1], layer);
642 .rects = paint_region_rects,
646 .paint_region = &paint_region,
657 ASSERT_EQ(*layers[2], layer);
663 context.AddNativeCallback(
675 event.pixel_ratio = 1.0;
678 ASSERT_TRUE(
engine.is_valid());
692 builder.SetDartEntrypoint(
"can_composite_platform_views_with_known_scene");
699 auto scene_image = context.GetNextSceneImage();
701 context.GetCompositor().SetNextPresentCallback(
703 size_t layers_count) {
704 ASSERT_EQ(layers_count, 5u);
719 .rects = paint_region_rects,
723 .paint_region = &paint_region,
734 ASSERT_EQ(*layers[0], layer);
750 ASSERT_EQ(*layers[1], layer);
766 .rects = paint_region_rects,
770 .paint_region = &paint_region,
781 ASSERT_EQ(*layers[2], layer);
797 ASSERT_EQ(*layers[3], layer);
813 .rects = paint_region_rects,
817 .paint_region = &paint_region,
828 ASSERT_EQ(*layers[4], layer);
834 context.GetCompositor().SetPlatformViewRendererCallback(
838 auto canvas =
surface->getCanvas();
865 <<
"Test was asked to composite an unknown platform view.";
868 return surface->makeImageSnapshot();
871 context.AddNativeCallback(
883 event.pixel_ratio = 1.0;
886 ASSERT_TRUE(
engine.is_valid());
893 ASSERT_EQ(context.GetSurfacePresentCount(), 0u);
907 builder.SetDartEntrypoint(
"can_composite_platform_views");
910 static std::mutex engine_mutex;
916 std::scoped_lock lock(engine_mutex);
927 context.GetCompositor().SetNextPresentCallback(
929 size_t layers_count) {
930 ASSERT_EQ(layers_count, 3u);
945 .rects = paint_region_rects,
949 .paint_region = &paint_region,
960 ASSERT_EQ(*layers[0], layer);
974 .rects = paint_region_rects,
978 .paint_region = &paint_region,
989 ASSERT_EQ(*layers[1], layer);
1005 .rects = paint_region_rects,
1009 .paint_region = &paint_region,
1020 ASSERT_EQ(*layers[2], layer);
1026 const auto task_runner_description =
1027 test_task_runner.GetFlutterTaskRunnerDescription();
1029 builder.SetPlatformTaskRunner(&task_runner_description);
1031 context.AddNativeCallback(
1036 platform_task_runner->PostTask([&]() {
1037 std::scoped_lock lock(engine_mutex);
1039 ASSERT_TRUE(
engine.is_valid());
1046 event.pixel_ratio = 1.0;
1049 ASSERT_TRUE(
engine.is_valid());
1056 platform_task_runner->PostTask([&]() {
1057 std::scoped_lock lock(engine_mutex);
1075 "can_composite_platform_views_with_root_layer_only");
1082 auto scene_image = context.GetNextSceneImage();
1084 context.GetCompositor().SetNextPresentCallback(
1086 size_t layers_count) {
1087 ASSERT_EQ(layers_count, 1u);
1102 .rects = paint_region_rects,
1106 .paint_region = &paint_region,
1117 ASSERT_EQ(*layers[0], layer);
1123 context.AddNativeCallback(
1135 event.pixel_ratio = 1.0;
1138 ASSERT_TRUE(
engine.is_valid());
1157 "can_composite_platform_views_with_platform_layer_on_bottom");
1164 auto scene_image = context.GetNextSceneImage();
1166 context.GetCompositor().SetNextPresentCallback(
1168 size_t layers_count) {
1169 ASSERT_EQ(layers_count, 2u);
1184 .rects = paint_region_rects,
1188 .paint_region = &paint_region,
1199 ASSERT_EQ(*layers[0], layer);
1215 ASSERT_EQ(*layers[1], layer);
1221 context.GetCompositor().SetPlatformViewRendererCallback(
1225 auto canvas =
surface->getCanvas();
1233 paint.setAlpha(127);
1242 <<
"Test was asked to composite an unknown platform view.";
1245 return surface->makeImageSnapshot();
1248 context.AddNativeCallback(
1260 event.pixel_ratio = 1.0;
1263 ASSERT_TRUE(
engine.is_valid());
1268 "compositor_with_platform_layer_on_bottom.png", scene_image));
1270 ASSERT_EQ(context.GetCompositor().GetPendingBackingStoresCount(), 1u);
1278 CompositorMustBeAbleToRenderKnownSceneWithRootSurfaceTransformation) {
1284 builder.SetDartEntrypoint(
"can_composite_platform_views_with_known_scene");
1292 const auto root_surface_transformation =
1295 context.SetRootSurfaceTransformation(root_surface_transformation);
1299 auto scene_image = context.GetNextSceneImage();
1301 context.GetCompositor().SetNextPresentCallback(
1303 size_t layers_count) {
1304 ASSERT_EQ(layers_count, 5u);
1319 .rects = paint_region_rects,
1323 .paint_region = &paint_region,
1334 ASSERT_EQ(*layers[0], layer);
1350 ASSERT_EQ(*layers[1], layer);
1366 .rects = paint_region_rects,
1370 .paint_region = &paint_region,
1381 ASSERT_EQ(*layers[2], layer);
1397 ASSERT_EQ(*layers[3], layer);
1413 .rects = paint_region_rects,
1417 .paint_region = &paint_region,
1428 ASSERT_EQ(*layers[4], layer);
1434 context.GetCompositor().SetPlatformViewRendererCallback(
1438 auto canvas =
surface->getCanvas();
1446 paint.setAlpha(127);
1456 paint.setAlpha(127);
1465 <<
"Test was asked to composite an unknown platform view.";
1468 return surface->makeImageSnapshot();
1471 context.AddNativeCallback(
1484 event.pixel_ratio = 1.0;
1487 ASSERT_TRUE(
engine.is_valid());
1500 builder.SetDartEntrypoint(
"can_render_scene_without_custom_compositor");
1503 auto rendered_scene = context.GetNextSceneImage();
1506 ASSERT_TRUE(
engine.is_valid());
1513 event.pixel_ratio = 1.0;
1524 const auto root_surface_transformation =
1527 context.SetRootSurfaceTransformation(root_surface_transformation);
1531 builder.SetDartEntrypoint(
"can_render_scene_without_custom_compositor");
1534 auto rendered_scene = context.GetNextSceneImage();
1537 ASSERT_TRUE(
engine.is_valid());
1546 event.pixel_ratio = 1.0;
1551 "scene_without_custom_compositor_with_xform.png", rendered_scene));
1556 auto& context = GetEmbedderContext(
backend);
1560 builder.SetDartEntrypoint(
"render_gradient");
1563 auto rendered_scene = context.GetNextSceneImage();
1566 ASSERT_TRUE(
engine.is_valid());
1573 event.pixel_ratio = 1.0;
1584 const auto root_surface_transformation =
1587 context.SetRootSurfaceTransformation(root_surface_transformation);
1593 builder.SetDartEntrypoint(
"render_gradient");
1594 builder.SetOpenGLRendererConfig(surface_size);
1596 auto rendered_scene = context.GetNextSceneImage();
1599 ASSERT_TRUE(
engine.is_valid());
1607 event.pixel_ratio = 1.0;
1616 auto& context = GetEmbedderContext(
backend);
1620 builder.SetDartEntrypoint(
"render_gradient");
1625 auto rendered_scene = context.GetNextSceneImage();
1628 ASSERT_TRUE(
engine.is_valid());
1635 event.pixel_ratio = 1.0;
1649 const auto root_surface_transformation =
1652 context.SetRootSurfaceTransformation(root_surface_transformation);
1656 builder.SetDartEntrypoint(
"render_gradient");
1662 auto rendered_scene = context.GetNextSceneImage();
1665 ASSERT_TRUE(
engine.is_valid());
1673 event.pixel_ratio = 1.0;
1681 CanRenderGradientWithCompositorOnNonRootLayer) {
1683 auto& context = GetEmbedderContext(
backend);
1687 builder.SetDartEntrypoint(
"render_gradient_on_non_root_backing_store");
1692 context.GetCompositor().SetNextPresentCallback(
1694 size_t layers_count) {
1695 ASSERT_EQ(layers_count, 3u);
1709 .rects = paint_region_rects,
1713 .paint_region = &paint_region,
1724 ASSERT_EQ(*layers[0], layer);
1740 ASSERT_EQ(*layers[1], layer);
1755 .rects = paint_region_rects,
1759 .paint_region = &paint_region,
1770 ASSERT_EQ(*layers[2], layer);
1774 context.GetCompositor().SetPlatformViewRendererCallback(
1778 auto canvas =
surface->getCanvas();
1790 <<
"Test was asked to composite an unknown platform view.";
1793 return surface->makeImageSnapshot();
1796 auto rendered_scene = context.GetNextSceneImage();
1799 ASSERT_TRUE(
engine.is_valid());
1806 event.pixel_ratio = 1.0;
1820 const auto root_surface_transformation =
1823 context.SetRootSurfaceTransformation(root_surface_transformation);
1827 builder.SetDartEntrypoint(
"render_gradient_on_non_root_backing_store");
1833 context.GetCompositor().SetNextPresentCallback(
1835 size_t layers_count) {
1836 ASSERT_EQ(layers_count, 3u);
1851 .rects = paint_region_rects,
1855 .paint_region = &paint_region,
1866 ASSERT_EQ(*layers[0], layer);
1882 ASSERT_EQ(*layers[1], layer);
1898 .rects = paint_region_rects,
1902 .paint_region = &paint_region,
1913 ASSERT_EQ(*layers[2], layer);
1917 context.GetCompositor().SetPlatformViewRendererCallback(
1921 auto canvas =
surface->getCanvas();
1933 <<
"Test was asked to composite an unknown platform view.";
1936 return surface->makeImageSnapshot();
1939 auto rendered_scene = context.GetNextSceneImage();
1942 ASSERT_TRUE(
engine.is_valid());
1950 event.pixel_ratio = 1.0;
1964 const auto root_surface_transformation =
1967 const auto root_surface_rect =
1968 root_surface_transformation.mapRect(flutter_application_rect);
1970 ASSERT_DOUBLE_EQ(root_surface_rect.width(), 600.0);
1971 ASSERT_DOUBLE_EQ(root_surface_rect.height(), 800.0);
1974 context.SetRootSurfaceTransformation(root_surface_transformation);
1977 builder.SetOpenGLRendererConfig(
1978 SkISize::Make(root_surface_rect.width(), root_surface_rect.height()));
1985 builder.SetDartEntrypoint(
"verify_b141980393");
1989 context.GetCompositor().SetNextPresentCallback(
1991 size_t layers_count) {
1992 ASSERT_EQ(layers_count, 1u);
2007 const double unxformed_top_margin = 31.0;
2008 const double unxformed_bottom_margin = 37.0;
2011 unxformed_top_margin,
2013 600 - unxformed_top_margin - unxformed_bottom_margin
2020 const auto xformed_platform_view_rect =
2021 root_surface_transformation.mapRect(unxformed_platform_view_rect);
2025 ASSERT_EQ(xformed_platform_view_rect,
2034 xformed_platform_view_rect.y());
2036 xformed_platform_view_rect.height());
2038 ASSERT_EQ(*layers[0], layer);
2052 event.width = flutter_application_rect.width();
2053 event.height = flutter_application_rect.height();
2054 event.pixel_ratio = 1.0;
2057 ASSERT_TRUE(
engine.is_valid());
2066 std::mutex engine_mutex;
2069 bool task_executed =
false;
2072 std::scoped_lock engine_lock(engine_mutex);
2075 task_executed =
true;
2081 builder.SetDartEntrypoint(
"can_render_scene_without_custom_compositor");
2084 &render_task_runner.GetFlutterTaskRunnerDescription());
2087 std::scoped_lock lock(engine_mutex);
2093 ASSERT_TRUE(
engine.is_valid());
2099 event.pixel_ratio = 1.0;
2103 ASSERT_TRUE(task_executed);
2107 std::scoped_lock engine_lock(engine_mutex);
2117 CanCreateEmbedderWithCustomRenderTaskRunnerTheSameAsPlatformTaskRunner) {
2123 static std::mutex engine_mutex;
2126 bool task_executed =
false;
2129 std::scoped_lock engine_lock(engine_mutex);
2132 task_executed =
true;
2137 platform_task_runner->PostTask([&]() {
2140 builder.SetDartEntrypoint(
"can_render_scene_without_custom_compositor");
2143 &common_task_runner.GetFlutterTaskRunnerDescription());
2144 builder.SetPlatformTaskRunner(
2145 &common_task_runner.GetFlutterTaskRunnerDescription());
2148 std::scoped_lock lock(engine_mutex);
2154 ASSERT_TRUE(
engine.is_valid());
2160 event.pixel_ratio = 1.0;
2171 platform_task_runner->PostTask([&]() {
2172 ASSERT_TRUE(task_executed);
2176 std::scoped_lock engine_lock(engine_mutex);
2182 shutdown_latch.
Wait();
2185 std::scoped_lock engine_lock(engine_mutex);
2187 ASSERT_FALSE(
engine.is_valid());
2192 CompositorMustBeAbleToRenderKnownScenePixelRatioOnSurface) {
2194 auto& context = GetEmbedderContext(
backend);
2199 builder.SetDartEntrypoint(
"can_display_platform_view_with_pixel_ratio");
2205 auto rendered_scene = context.GetNextSceneImage();
2207 context.GetCompositor().SetNextPresentCallback(
2209 size_t layers_count) {
2210 ASSERT_EQ(layers_count, 3u);
2224 .rects = paint_region_rects,
2228 .paint_region = &paint_region,
2239 ASSERT_EQ(*layers[0], layer);
2255 ASSERT_EQ(*layers[1], layer);
2270 .rects = paint_region_rects,
2274 .paint_region = &paint_region,
2285 ASSERT_EQ(*layers[2], layer);
2296 event.width = 400 * 2.0;
2297 event.height = 300 * 2.0;
2298 event.pixel_ratio = 2.0;
2301 ASSERT_TRUE(
engine.is_valid());
2311 CompositorMustBeAbleToRenderKnownScenePixelRatioOnSurfaceWithRootSurfaceXformation) {
2317 builder.SetDartEntrypoint(
"can_display_platform_view_with_pixel_ratio");
2322 const auto root_surface_transformation =
2325 context.SetRootSurfaceTransformation(root_surface_transformation);
2327 auto rendered_scene = context.GetNextSceneImage();
2330 context.GetCompositor().SetNextPresentCallback(
2332 size_t layers_count) {
2333 ASSERT_EQ(layers_count, 3u);
2348 .rects = paint_region_rects,
2352 .paint_region = &paint_region,
2363 ASSERT_EQ(*layers[0], layer);
2379 ASSERT_EQ(*layers[1], layer);
2395 .rects = paint_region_rects,
2399 .paint_region = &paint_region,
2410 ASSERT_EQ(*layers[2], layer);
2421 event.width = 400 * 2.0;
2422 event.height = 300 * 2.0;
2423 event.pixel_ratio = 2.0;
2426 ASSERT_TRUE(
engine.is_valid());
2434 PushingMutlipleFramesSetsUpNewRecordingCanvasWithCustomCompositor) {
2440 builder.SetDartEntrypoint(
"push_frames_over_and_over");
2445 const auto root_surface_transformation =
2448 context.SetRootSurfaceTransformation(root_surface_transformation);
2457 event.pixel_ratio = 1.0;
2460 ASSERT_TRUE(
engine.is_valid());
2462 constexpr size_t frames_expected = 10;
2464 std::atomic_size_t frames_seen = 0;
2465 context.AddNativeCallback(
"SignalNativeTest",
2472 ASSERT_GE(frames_seen, frames_expected);
2478 PushingMutlipleFramesSetsUpNewRecordingCanvasWithoutCustomCompositor) {
2483 builder.SetDartEntrypoint(
"push_frames_over_and_over");
2485 const auto root_surface_transformation =
2488 context.SetRootSurfaceTransformation(root_surface_transformation);
2497 event.pixel_ratio = 1.0;
2500 ASSERT_TRUE(
engine.is_valid());
2502 constexpr size_t frames_expected = 10;
2504 std::atomic_size_t frames_seen = 0;
2505 context.AddNativeCallback(
"SignalNativeTest",
2512 ASSERT_GE(frames_seen, frames_expected);
2519 auto& context = GetEmbedderContext(
backend);
2524 builder.SetDartEntrypoint(
"platform_view_mutators");
2529 context.GetCompositor().SetNextPresentCallback(
2531 size_t layers_count) {
2532 ASSERT_EQ(layers_count, 2u);
2546 .rects = paint_region_rects,
2550 .paint_region = &paint_region,
2561 ASSERT_EQ(*layers[0], layer);
2578 ASSERT_EQ(*layers[1], layer);
2583 switch (mutation.
type) {
2598 mutation.
opacity = 128.0 / 255.0;
2602 <<
"There should be no transformation in the test.";
2619 event.pixel_ratio = 1.0;
2622 ASSERT_TRUE(
engine.is_valid());
2633 builder.SetDartEntrypoint(
"platform_view_mutators_with_pixel_ratio");
2639 context.GetCompositor().SetNextPresentCallback(
2641 size_t layers_count) {
2642 ASSERT_EQ(layers_count, 2u);
2657 .rects = paint_region_rects,
2661 .paint_region = &paint_region,
2672 ASSERT_EQ(*layers[0], layer);
2689 ASSERT_EQ(*layers[1], layer);
2694 switch (mutation.
type) {
2708 mutation.
opacity = 128.0 / 255.0;
2730 event.pixel_ratio = 2.0;
2733 ASSERT_TRUE(
engine.is_valid());
2739 PlatformViewMutatorsAreValidWithPixelRatioAndRootSurfaceTransformation) {
2745 builder.SetDartEntrypoint(
"platform_view_mutators_with_pixel_ratio");
2750 static const auto root_surface_transformation =
2753 context.SetRootSurfaceTransformation(root_surface_transformation);
2756 context.GetCompositor().SetNextPresentCallback(
2758 size_t layers_count) {
2759 ASSERT_EQ(layers_count, 2u);
2774 .rects = paint_region_rects,
2778 .paint_region = &paint_region,
2789 ASSERT_EQ(*layers[0], layer);
2806 ASSERT_EQ(*layers[1], layer);
2811 switch (mutation.
type) {
2825 mutation.
opacity = 128.0 / 255.0;
2848 event.pixel_ratio = 2.0;
2851 ASSERT_TRUE(
engine.is_valid());
2862 builder.SetDartEntrypoint(
"empty_scene");
2864 context.AddNativeCallback(
2870 ASSERT_TRUE(
engine.is_valid());
2876 event.pixel_ratio = 1.0;
2890 builder.SetDartEntrypoint(
"scene_with_no_container");
2892 context.AddNativeCallback(
2898 ASSERT_TRUE(
engine.is_valid());
2904 event.pixel_ratio = 1.0;
2918 builder.SetDartEntrypoint(
"arc_end_caps_correct");
2922 const auto root_surface_transformation =
SkMatrix()
2927 context.SetRootSurfaceTransformation(root_surface_transformation);
2931 auto scene_image = context.GetNextSceneImage();
2933 ASSERT_TRUE(
engine.is_valid());
2938 event.height = 1024;
2939 event.pixel_ratio = 1.0;
2952 builder.SetDartEntrypoint(
"scene_builder_with_clips");
2956 const auto root_surface_transformation =
2959 context.SetRootSurfaceTransformation(root_surface_transformation);
2962 context.GetCompositor().SetNextPresentCallback(
2964 size_t layers_count) {
2965 ASSERT_EQ(layers_count, 2u);
2979 ASSERT_EQ(*layers[0], layer);
2981 bool clip_assertions_checked =
false;
2984 const auto total_xformation =
2990 [&](
const auto& mutation) {
2995 const auto rect_to_compare =
3001 ASSERT_TRUE(total_xformation.mapRect(&mapped, rect_to_compare));
3003 clip_assertions_checked =
true;
3006 ASSERT_TRUE(clip_assertions_checked);
3013 ASSERT_TRUE(
engine.is_valid());
3019 event.pixel_ratio = 1.0;
3032 builder.SetDartEntrypoint(
"scene_builder_with_complex_clips");
3036 const auto root_surface_transformation =
3039 context.SetRootSurfaceTransformation(root_surface_transformation);
3042 context.GetCompositor().SetNextPresentCallback(
3044 size_t layers_count) {
3045 ASSERT_EQ(layers_count, 2u);
3059 ASSERT_EQ(*layers[0], layer);
3063 ASSERT_EQ(mutations[0]->
type,
3066 root_surface_transformation);
3068 ASSERT_EQ(mutations[1]->
type,
3070 ASSERT_EQ(
SkRectMake(mutations[1]->clip_rect),
3073 ASSERT_EQ(mutations[2]->
type,
3078 ASSERT_EQ(mutations[3]->
type,
3080 ASSERT_EQ(
SkRectMake(mutations[3]->clip_rect),
3083 ASSERT_EQ(mutations[4]->
type,
3088 ASSERT_EQ(mutations[5]->
type,
3090 ASSERT_EQ(
SkRectMake(mutations[5]->clip_rect),
3098 ASSERT_TRUE(
engine.is_valid());
3104 event.pixel_ratio = 1.0;
3115 builder.SetDartEntrypoint(
"objects_can_be_posted");
3122 context.AddNativeCallback(
"SignalNativeCount",
3129 ASSERT_TRUE(
engine.is_valid());
3134 Trampoline trampoline;
3136 context.AddNativeCallback(
"SendObjectToNativeCode",
3139 auto trampoline_copy = trampoline;
3140 trampoline =
nullptr;
3161 object.bool_value =
true;
3175 object.int32_value = 1988;
3189 object.int64_value = 1988;
3203 object.double_value = 1988.0;
3215 const char*
message =
"Hello. My name is Inigo Montoya.";
3218 object.string_value =
message;
3240 buffer.user_data =
nullptr;
3241 buffer.buffer_collect_callback =
nullptr;
3247 object.buffer_value = &
buffer;
3276 buffer.user_data = &buffer_released_latch;
3285 object.buffer_value = &
buffer;
3307 buffer_released_latch.
Wait();
3316 builder.SetDartEntrypoint(
"empty_scene_posts_zero_layers_to_compositor");
3322 context.GetCompositor().SetNextPresentCallback(
3324 size_t layers_count) {
3325 ASSERT_EQ(layers_count, 0u);
3335 event.pixel_ratio = 1.0;
3338 ASSERT_TRUE(
engine.is_valid());
3341 ASSERT_EQ(context.GetCompositor().GetPendingBackingStoresCount(), 0u);
3350 builder.SetDartEntrypoint(
"compositor_can_post_only_platform_views");
3356 context.GetCompositor().SetNextPresentCallback(
3358 size_t layers_count) {
3359 ASSERT_EQ(layers_count, 2u);
3373 ASSERT_EQ(*layers[0], layer);
3388 ASSERT_EQ(*layers[1], layer);
3399 event.pixel_ratio = 1.0;
3402 ASSERT_TRUE(
engine.is_valid());
3405 ASSERT_EQ(context.GetCompositor().GetPendingBackingStoresCount(), 0u);
3414 builder.SetDartEntrypoint(
"render_targets_are_recycled");
3420 context.AddNativeCallback(
"SignalNativeTest",
3425 context.GetCompositor().SetNextPresentCallback(
3427 size_t layers_count) {
3428 ASSERT_EQ(layers_count, 20u);
3433 ASSERT_TRUE(
engine.is_valid());
3439 event.pixel_ratio = 1.0;
3444 ASSERT_EQ(context.GetCompositor().GetPendingBackingStoresCount(), 10u);
3445 ASSERT_EQ(context.GetCompositor().GetBackingStoresCreatedCount(), 10u);
3446 ASSERT_EQ(context.GetCompositor().GetBackingStoresCollectedCount(), 0u);
3449 ASSERT_EQ(context.GetCompositor().GetPendingBackingStoresCount(), 0u);
3450 ASSERT_EQ(context.GetCompositor().GetBackingStoresCreatedCount(), 10u);
3451 ASSERT_EQ(context.GetCompositor().GetBackingStoresCollectedCount(), 10u);
3460 builder.SetDartEntrypoint(
"render_targets_are_in_stable_order");
3466 context.AddNativeCallback(
"SignalNativeTest",
3471 size_t frame_count = 0;
3472 std::vector<void*> first_frame_backing_store_user_data;
3473 context.GetCompositor().SetPresentCallback(
3475 size_t layers_count) {
3476 ASSERT_EQ(layers_count, 20u);
3478 if (first_frame_backing_store_user_data.empty()) {
3479 for (
size_t i = 0;
i < layers_count; ++
i) {
3481 first_frame_backing_store_user_data.push_back(
3482 layers[
i]->backing_store->user_data);
3488 ASSERT_EQ(first_frame_backing_store_user_data.size(), 10u);
3491 std::vector<void*> backing_store_user_data;
3492 for (
size_t i = 0;
i < layers_count; ++
i) {
3494 backing_store_user_data.push_back(
3495 layers[
i]->backing_store->user_data);
3499 ASSERT_EQ(backing_store_user_data.size(), 10u);
3501 ASSERT_EQ(first_frame_backing_store_user_data, backing_store_user_data);
3503 if (frame_count == 20) {
3511 ASSERT_TRUE(
engine.is_valid());
3517 event.pixel_ratio = 1.0;
3529 builder.SetDartEntrypoint(
"push_frames_over_and_over");
3531 const auto root_surface_transformation =
3534 context.SetRootSurfaceTransformation(root_surface_transformation);
3543 event.pixel_ratio = 1.0;
3546 ASSERT_TRUE(
engine.is_valid());
3550 context.AddNativeCallback(
"SignalNativeTest",
3572 builder.SetOpenGLFBOCallBack();
3575 ASSERT_FALSE(
engine.is_valid());
3583 builder.SetOpenGLPresentCallBack();
3586 ASSERT_FALSE(
engine.is_valid());
3594 builder.GetRendererConfig().open_gl.populate_existing_damage =
nullptr;
3597 ASSERT_TRUE(
engine.is_valid());
3606 builder.GetRendererConfig().open_gl.populate_existing_damage =
3607 [](
void* context,
const intptr_t
id,
3610 ->GLPopulateExistingDamage(
id, existing_damage);
3614 ASSERT_TRUE(
engine.is_valid());
3622 builder.GetRendererConfig().open_gl.fbo_callback =
3623 [](
void* context) -> uint32_t {
return 0; };
3624 builder.GetRendererConfig().open_gl.fbo_with_frame_info_callback =
nullptr;
3625 builder.GetRendererConfig().open_gl.populate_existing_damage =
3626 [](
void* context,
const intptr_t
id,
3629 ->GLPopulateExistingDamage(
id, existing_damage);
3633 ASSERT_TRUE(
engine.is_valid());
3637 MustNotRunWhenPopulateExistingDamageButNoOtherFBOCallback) {
3642 builder.GetRendererConfig().open_gl.fbo_callback =
nullptr;
3643 builder.GetRendererConfig().open_gl.fbo_with_frame_info_callback =
nullptr;
3644 builder.GetRendererConfig().open_gl.populate_existing_damage =
3645 [](
void* context,
const intptr_t
id,
3648 ->GLPopulateExistingDamage(
id, existing_damage);
3652 ASSERT_FALSE(
engine.is_valid());
3660 builder.SetDartEntrypoint(
"push_frames_over_and_over");
3662 const auto root_surface_transformation =
3665 context.SetRootSurfaceTransformation(root_surface_transformation);
3674 event.pixel_ratio = 1.0;
3677 ASSERT_TRUE(
engine.is_valid());
3681 context.AddNativeCallback(
"SignalNativeTest",
3686 const uint32_t window_fbo_id =
3690 ASSERT_EQ(present_info.
fbo_id, window_fbo_id);
3699 PresentInfoReceivesFullDamageWhenExistingDamageIsWholeScreen) {
3704 builder.SetDartEntrypoint(
"render_gradient_retained");
3705 builder.GetRendererConfig().open_gl.populate_existing_damage =
3706 [](
void* context,
const intptr_t
id,
3709 ->GLPopulateExistingDamage(
id, existing_damage);
3714 .SetGLPopulateExistingDamageCallback(
3716 const size_t num_rects = 1;
3718 static FlutterRect existing_damage_rects[num_rects] = {
3720 existing_damage_ptr->
num_rects = num_rects;
3721 existing_damage_ptr->
damage = existing_damage_rects;
3725 ASSERT_TRUE(
engine.is_valid());
3732 const size_t num_rects = 1;
3753 event.pixel_ratio = 1.0;
3763 const size_t num_rects = 1;
3789 builder.SetDartEntrypoint(
"render_gradient_retained");
3790 builder.GetRendererConfig().open_gl.populate_existing_damage =
3791 [](
void* context,
const intptr_t
id,
3794 ->GLPopulateExistingDamage(
id, existing_damage);
3799 .SetGLPopulateExistingDamageCallback(
3801 const size_t num_rects = 1;
3803 static FlutterRect existing_damage_rects[num_rects] = {
3805 existing_damage_ptr->
num_rects = num_rects;
3806 existing_damage_ptr->
damage = existing_damage_rects;
3810 ASSERT_TRUE(
engine.is_valid());
3817 const size_t num_rects = 1;
3838 event.pixel_ratio = 1.0;
3847 const size_t num_rects = 1;
3873 builder.SetDartEntrypoint(
"render_gradient_retained");
3874 builder.GetRendererConfig().open_gl.populate_existing_damage =
3875 [](
void* context,
const intptr_t
id,
3878 ->GLPopulateExistingDamage(
id, existing_damage);
3883 .SetGLPopulateExistingDamageCallback(
3884 [&](
const intptr_t
id,
FlutterDamage* existing_damage_ptr) {
3885 const size_t num_rects = 1;
3887 static FlutterRect existing_damage_rects[num_rects] = {
3889 existing_damage_ptr->
num_rects = num_rects;
3890 existing_damage_ptr->
damage = existing_damage_rects;
3894 ASSERT_TRUE(
engine.is_valid());
3901 const size_t num_rects = 1;
3922 event.pixel_ratio = 1.0;
3932 const size_t num_rects = 1;
3958 builder.SetDartEntrypoint(
"render_gradient_retained");
3959 builder.GetRendererConfig().open_gl.populate_existing_damage =
3960 [](
void* context,
const intptr_t
id,
3963 ->GLPopulateExistingDamage(
id, existing_damage);
3967 ASSERT_TRUE(
engine.is_valid());
3969 const uint32_t window_fbo_id =
3972 .SetGLPopulateExistingDamageCallback(
3973 [window_fbo_id = window_fbo_id](intptr_t
id,
3975 ASSERT_EQ(
id, window_fbo_id);
3977 existing_damage->
damage =
nullptr;
3985 event.pixel_ratio = 1.0;
3995 builder.SetDartEntrypoint(
"render_gradient_retained");
3996 builder.GetRendererConfig().open_gl.populate_existing_damage =
3997 [](
void* context,
const intptr_t
id,
4000 ->GLPopulateExistingDamage(
id, existing_damage);
4004 builder.GetRendererConfig().open_gl.fbo_with_frame_info_callback =
4010 ASSERT_TRUE(
engine.is_valid());
4012 context.AddNativeCallback(
"SignalNativeTest",
4017 const uint32_t window_fbo_id =
4020 .SetGLPopulateExistingDamageCallback(
4021 [window_fbo_id = window_fbo_id](intptr_t
id,
4023 ASSERT_NE(
id, window_fbo_id);
4025 existing_damage->
damage =
nullptr;
4033 event.pixel_ratio = 1.0;
4044 builder.SetDartEntrypoint(
"empty_scene");
4046 context.AddNativeCallback(
4052 ASSERT_TRUE(
engine.is_valid());
4059 std::vector<FlutterEngineDisplay> displays = {display};
4073 event.pixel_ratio = 1.0;
4086 builder.SetDartEntrypoint(
"empty_scene");
4088 context.AddNativeCallback(
4094 ASSERT_TRUE(
engine.is_valid());
4101 std::vector<FlutterEngineDisplay> displays = {display};
4115 event.pixel_ratio = 1.0;
4128 builder.SetDartEntrypoint(
"empty_scene");
4130 context.AddNativeCallback(
4136 ASSERT_TRUE(
engine.is_valid());
4150 std::vector<FlutterEngineDisplay> displays = {display_1, display_2};
4164 event.pixel_ratio = 1.0;
4177 builder.SetDartEntrypoint(
"empty_scene");
4179 context.AddNativeCallback(
4185 ASSERT_TRUE(
engine.is_valid());
4199 std::vector<FlutterEngineDisplay> displays = {display_1, display_2};
4210 event.pixel_ratio = 1.0;
4223 builder.SetDartEntrypoint(
"empty_scene");
4225 context.AddNativeCallback(
4231 ASSERT_TRUE(
engine.is_valid());
4245 std::vector<FlutterEngineDisplay> displays = {display_1, display_2};
4256 event.pixel_ratio = 1.0;
4269 builder.SetDartEntrypoint(
"render_targets_are_recycled");
4273 const unsigned num_frames = 8;
4274 const unsigned num_engine_layers = 10;
4275 const unsigned num_backing_stores = num_frames * num_engine_layers;
4278 context.AddNativeCallback(
"SignalNativeTest",
4283 context.GetCompositor().SetPresentCallback(
4285 size_t layers_count) {
4286 ASSERT_EQ(layers_count, 20u);
4292 ASSERT_TRUE(
engine.is_valid());
4298 event.pixel_ratio = 1.0;
4304 ASSERT_EQ(context.GetCompositor().GetBackingStoresCreatedCount(),
4305 num_backing_stores);
4308 ASSERT_EQ(context.GetCompositor().GetPendingBackingStoresCount(), 0u);
4318 auto max_size = context.GetCompositor().GetGrContext()->maxRenderTargetSize();
4320 context.AddIsolateCreateCallback([&]() {
4327 context.AddNativeCallback(
4329 auto get_arg = [&
args](
int index) {
4338 ASSERT_EQ(big_image->
width(), max_size);
4339 ASSERT_EQ(big_image->
height(), max_size / 2);
4343 small_image->
image()->skia_image()));
4349 ASSERT_TRUE(
engine.is_valid());
4358 builder.SetDartEntrypoint(
"objects_can_be_posted");
4365 context.AddNativeCallback(
"SignalNativeCount",
4372 ASSERT_TRUE(
engine.is_valid());
4377 Trampoline trampoline;
4379 context.AddNativeCallback(
"SendObjectToNativeCode",
4382 auto trampoline_copy = trampoline;
4383 trampoline =
nullptr;
4391 object.bool_value =
true;
4411 builder.SetDartEntrypoint(
"invalid_backingstore");
4413 class TestCollectOnce {
4417 ASSERT_FALSE(collected_);
4422 bool collected_ =
false;
4426 builder.GetCompositor().create_backing_store_callback =
4433 backing_store_out->user_data =
nullptr;
4435 backing_store_out->open_gl.texture.target = 0;
4436 backing_store_out->open_gl.texture.name = 0;
4437 backing_store_out->open_gl.texture.format = 0;
4438 static TestCollectOnce collect_once_user_data;
4439 collect_once_user_data = {};
4440 backing_store_out->open_gl.texture.user_data = &collect_once_user_data;
4441 backing_store_out->open_gl.texture.destruction_callback =
4443 reinterpret_cast<TestCollectOnce*
>(
user_data)->Collect();
4448 context.AddNativeCallback(
4460 event.pixel_ratio = 1.0;
4463 ASSERT_TRUE(
engine.is_valid());
4474 builder.SetDartEntrypoint(
"invalid_backingstore");
4476 class TestCollectOnce {
4480 ASSERT_FALSE(collected_);
4485 bool collected_ =
false;
4489 builder.GetCompositor().create_backing_store_callback =
4496 backing_store_out->user_data =
nullptr;
4498 backing_store_out->open_gl.framebuffer.target = 0;
4499 backing_store_out->open_gl.framebuffer.name = 0;
4500 static TestCollectOnce collect_once_user_data;
4501 collect_once_user_data = {};
4502 backing_store_out->open_gl.framebuffer.user_data =
4503 &collect_once_user_data;
4504 backing_store_out->open_gl.framebuffer.destruction_callback =
4506 reinterpret_cast<TestCollectOnce*
>(
user_data)->Collect();
4511 context.AddNativeCallback(
4523 event.pixel_ratio = 1.0;
4526 ASSERT_TRUE(
engine.is_valid());
4532 auto context =
surface.GetGrContext();
4534 typedef void (*glGenTexturesProc)(uint32_t n, uint32_t* textures);
4535 typedef void (*glFinishProc)();
4537 glGenTexturesProc glGenTextures;
4538 glFinishProc glFinish;
4540 glGenTextures =
reinterpret_cast<glGenTexturesProc
>(
4541 surface.GetProcAddress(
"glGenTextures"));
4542 glFinish =
reinterpret_cast<glFinishProc
>(
surface.GetProcAddress(
"glFinish"));
4545 glGenTextures(1, &
name);
4547 bool resolve_called =
false;
4550 [&](int64_t,
size_t,
size_t) {
4551 resolve_called =
true;
4552 auto res = std::make_unique<FlutterOpenGLTexture>();
4553 res->target = GL_TEXTURE_2D;
4555 res->format = GL_RGBA8;
4556 res->user_data =
nullptr;
4557 res->destruction_callback = [](
void*) {};
4558 res->width = res->height = 100;
4563 auto skia_surface =
surface.GetOnscreenSurface();
4569 .gr_context = context.get(),
4575 resolve_called =
false;
4580 EXPECT_FALSE(resolve_called);
4593 PresentInfoReceivesFullScreenDamageWhenPopulateExistingDamageIsNotProvided) {
4598 builder.SetDartEntrypoint(
"render_gradient_retained");
4599 builder.GetRendererConfig().open_gl.populate_existing_damage =
nullptr;
4602 ASSERT_TRUE(
engine.is_valid());
4609 const size_t num_rects = 1;
4630 event.pixel_ratio = 1.0;
4640 const size_t num_rects = 1;
4662 PresentInfoReceivesJoinedDamageWhenExistingDamageContainsMultipleRects) {
4667 builder.SetDartEntrypoint(
"render_gradient_retained");
4668 builder.GetRendererConfig().open_gl.populate_existing_damage =
4669 [](
void* context,
const intptr_t
id,
4672 ->GLPopulateExistingDamage(
id, existing_damage);
4677 .SetGLPopulateExistingDamageCallback(
4679 const size_t num_rects = 2;
4681 static FlutterRect existing_damage_rects[num_rects] = {
4685 existing_damage_ptr->
num_rects = num_rects;
4686 existing_damage_ptr->
damage = existing_damage_rects;
4690 ASSERT_TRUE(
engine.is_valid());
4697 const size_t num_rects = 1;
4718 event.pixel_ratio = 1.0;
4728 const size_t num_rects = 1;
4754 bool present_called =
false;
4757 present_called =
true;
4760 builder.AddCommandLineArgument(
"--enable-impeller");
4761 builder.SetDartEntrypoint(
"render_impeller_gl_test");
4770 ASSERT_TRUE(
engine.is_valid());
4774 typedef void (*glGenFramebuffersProc)(GLsizei n, GLuint* ids);
4775 typedef void (*glBindFramebufferProc)(GLenum
target, GLuint framebuffer);
4776 auto glGenFramebuffers =
reinterpret_cast<glGenFramebuffersProc
>(
4778 auto glBindFramebuffer =
reinterpret_cast<glBindFramebufferProc
>(
4782 shell.GetTaskRunners().GetRasterTaskRunner()->PostTask([&] {
4784 glGenFramebuffers(1, &fbo);
4785 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
4788 raster_event.
Wait();
4795 event.pixel_ratio = 1.0;
4801 "impeller_gl_test.png"),
4806 ASSERT_FALSE(present_called);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorGREEN
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
SkMatrix & preTranslate(SkScalar dx, SkScalar dy)
SkMatrix & preRotate(SkScalar degrees, SkScalar px, SkScalar py)
SkMatrix & preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
sk_sp< DlImage > image() const
Backend implementation of |DlCanvas| for |SkCanvas|.
std::function< std::unique_ptr< FlutterOpenGLTexture >(int64_t, size_t, size_t)> ExternalTextureCallback
size_t GetCachedEntriesCount() const
virtual void MarkNewFrameAvailable()=0
virtual void Paint(PaintContext &context, const SkRect &bounds, bool freeze, const DlImageSampling sampling)=0
void * GLGetProcAddress(const char *name)
std::future< sk_sp< SkImage > > GetNextSceneImage()
A task runner that we expect the embedder to provide but whose implementation is a real FML task runn...
static TaskSourceGrade GetCurrentTaskSourceGrade()
struct _Dart_Handle * Dart_Handle
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
struct _Dart_NativeArguments * Dart_NativeArguments
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *length)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name)
DART_EXPORT Dart_Handle Dart_RootLibrary(void)
FlutterEngineResult FlutterEngineRunTask(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterTask *task)
Inform the engine to run the specified task. This task has been given to the engine via the FlutterTa...
FlutterEngineResult FlutterEngineSendWindowMetricsEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterWindowMetricsEvent *flutter_metrics)
FlutterEngineResult FlutterEnginePostDartObject(FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterEngineDartPort port, const FlutterEngineDartObject *object)
Posts a Dart object to specified send port. The corresponding receive port for send port can be in an...
FLUTTER_EXPORT FlutterEngineResult FlutterEngineDeinitialize(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Stops running the Flutter engine instance. After this call, the embedder is also guaranteed that no m...
FlutterEngineResult FlutterEngineShutdown(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Shuts down a Flutter engine instance. The engine handle is no longer valid for any calls in the embed...
FlutterEngineResult FlutterEngineNotifyDisplayUpdate(FLUTTER_API_SYMBOL(FlutterEngine) raw_engine, const FlutterEngineDisplaysUpdateType update_type, const FlutterEngineDisplay *embedder_displays, size_t display_count)
Posts updates corresponding to display changes to a running engine instance.
FlutterEngineResult FlutterEngineRunInitialized(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Runs an initialized engine instance. An engine can be initialized via FlutterEngineInitialize....
@ kFlutterLayerContentTypePlatformView
Indicates that the contents of this layer are determined by the embedder.
@ kFlutterLayerContentTypeBackingStore
@ kFlutterPlatformViewMutationTypeClipRoundedRect
@ kFlutterPlatformViewMutationTypeClipRect
@ kFlutterPlatformViewMutationTypeTransformation
@ kFlutterPlatformViewMutationTypeOpacity
@ kFlutterEngineDartObjectTypeString
@ kFlutterEngineDartObjectTypeBool
@ kFlutterEngineDartObjectTypeDouble
@ kFlutterEngineDartObjectTypeInt32
@ kFlutterEngineDartObjectTypeBuffer
@ kFlutterEngineDartObjectTypeInt64
@ kFlutterEngineDartObjectTypeNull
@ kFlutterEngineDisplaysUpdateTypeStartup
int64_t FlutterEngineDartPort
@ kFlutterOpenGLTargetTypeFramebuffer
@ kFlutterOpenGLTargetTypeTexture
@ kFlutterBackingStoreTypeSoftware
Specified an software allocation for Flutter to render into using the CPU.
@ kFlutterBackingStoreTypeOpenGL
FlutterSize FlutterSizeMake(double width, double height)
FlutterTransformation FlutterTransformationMake(const SkMatrix &matrix)
FlutterRect FlutterRectMake(const SkRect &rect)
SkMatrix SkMatrixMake(const FlutterTransformation &xformation)
FlutterRect FlutterRectMakeLTRB(double l, double t, double r, double b)
FlutterPoint FlutterPointMake(double x, double y)
SkRect SkRectMake(const FlutterRect &rect)
flutter::EmbedderEngine * ToEmbedderEngine(const FlutterEngine &engine)
FlutterRoundedRect FlutterRoundedRectMake(const SkRRect &rect)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
#define FML_CHECK(condition)
Dart_NativeFunction function
fml::RefPtr< fml::TaskRunner > CreateNewThread(const std::string &name)
sk_sp< SkBlender > blender SkRect rect
TEST_F(DisplayListTest, Defaults)
sk_sp< SkSurface > CreateRenderSurface(const FlutterLayer &layer, GrDirectContext *context)
bool MemsetPatternSetOrCheck(uint8_t *buffer, size_t size, MemsetPatternOp op)
Depending on the operation, either scribbles a known pattern into the buffer or checks if that patter...
void FilterMutationsByType(const FlutterPlatformViewMutation **mutations, size_t count, FlutterPlatformViewMutationType type, const std::function< void(const FlutterPlatformViewMutation &mutation)> &handler)
@ kMemsetPatternOpSetBuffer
void ConfigureBackingStore(FlutterBackingStore &backing_store, EmbedderTestContextType backend, bool opengl_framebuffer)
Configures per-backend properties for a given backing store.
testing::EmbedderTest EmbedderTest
INSTANTIATE_TEST_SUITE_P(EmbedderTestGlVk, EmbedderTestMultiBackend, ::testing::Values(EmbedderTestContextType::kOpenGLContext, EmbedderTestContextType::kVulkanContext))
TEST_P(DlGoldenTest, TextBlurMaskFilterRespectCTM)
SkMatrix GetTotalMutationTransformationMatrix(const FlutterPlatformViewMutation **mutations, size_t count)
std::string FixtureNameForBackend(EmbedderTestContextType backend, const std::string &name)
Prepends a prefix to the name which is unique to the test context type. This is useful for tests that...
bool ImageMatchesFixture(const std::string &fixture_file_name, const sk_sp< SkImage > &scene_image)
EmbedderTestBackingStoreProducer::RenderTargetType GetRenderTargetFromBackend(EmbedderTestContextType backend, bool opengl_framebuffer)
Resolves a render target type for a given backend description. This is useful for tests that use Embe...
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service port
DEF_SWITCHES_START aot vmservice shared library name
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Dart_Handle ToDart(const T &object)
Dart_Handle DartInvoke(Dart_Handle closure, std::initializer_list< Dart_Handle > args)
FlutterBackingStoreType type
Specifies the type of backing store.
FlutterOpenGLBackingStore open_gl
The description of the OpenGL backing store.
FlutterSoftwareBackingStore software
The description of the software backing store.
size_t struct_size
The size of this struct. Must be sizeof(FlutterBackingStore).
A structure to represent a damage region.
size_t num_rects
The number of rectangles within the damage region.
FlutterRect * damage
The actual damage region(s) in question.
FlutterEngineDartObjectType type
size_t struct_size
This size of this struct. Must be sizeof(FlutterDisplay).
FlutterEngineDisplayId display_id
FlutterUIntSize size
The size of the surface that will be backed by the fbo.
FlutterLayerContentType type
const FlutterBackingStore * backing_store
FlutterBackingStorePresentInfo * backing_store_present_info
const FlutterPlatformView * platform_view
size_t struct_size
This size of this struct. Must be sizeof(FlutterLayer).
FlutterSize size
The size of the layer (in physical pixels).
FlutterOpenGLTargetType type
uint32_t fbo_id
Id of the fbo backing the surface that was presented.
FlutterDamage frame_damage
Damage representing the area that the compositor needs to render.
FlutterDamage buffer_damage
Damage used to set the buffer's damage region.
A structure to represent a rectangle.
A region represented by a collection of non-overlapping rectangles.
size_t struct_size
The size of this struct. Must be sizeof(FlutterRegion).
size_t row_bytes
The number of bytes in a single row of the allocation.
size_t height
The number of rows in the allocation.
size_t struct_size
The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
#define CREATE_NATIVE_ENTRY(native_entry)
static void setup(SkCanvas *canvas, SkPaint *paint, const SkBitmap &bm, SkFilterMode fm, SkTileMode tmx, SkTileMode tmy)
#define EXPECT_TRUE(handle)