[Embedder API] Fix test helper's present callback registration (flutter/engine#51560)

https://github.com/flutter/engine/pull/51293 added a new present callback that supports multiple views. However, the test helper incorrectly inversed the single-view and multi-view present callbacks. This didn't affect the existing tests as we don't any multi-view tests yet.

Prepares for https://github.com/flutter/flutter/issues/144810

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Loïc Sharma 2024-03-21 14:07:27 -07:00 committed by GitHub
parent 9d1537ccb8
commit 454af9a350

View File

@ -377,14 +377,6 @@ void EmbedderConfigBuilder::SetCompositor(bool avoid_backing_store_cache,
->CollectBackingStore(backing_store);
};
if (use_present_layers_callback) {
compositor_.present_view_callback = [](const FlutterPresentViewInfo* info) {
auto compositor =
reinterpret_cast<EmbedderTestCompositor*>(info->user_data);
return compositor->Present(info->view_id, info->layers,
info->layers_count);
};
} else {
compositor_.present_layers_callback = [](const FlutterLayer** layers,
size_t layers_count,
void* user_data) {
@ -394,6 +386,14 @@ void EmbedderConfigBuilder::SetCompositor(bool avoid_backing_store_cache,
// it can only be used to render the implicit view.
return compositor->Present(kFlutterImplicitViewId, layers, layers_count);
};
} else {
compositor_.present_view_callback = [](const FlutterPresentViewInfo* info) {
auto compositor =
reinterpret_cast<EmbedderTestCompositor*>(info->user_data);
return compositor->Present(info->view_id, info->layers,
info->layers_count);
};
}
compositor_.avoid_backing_store_cache = avoid_backing_store_cache;
project_args_.compositor = &compositor_;