mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The earlier design speculated that embedders could affect the same transformations on the layers post engine compositor presentation but before final composition. However, the linked issue points out that this design is not suitable for use with hardware overlay planes. When rendering to the same, to affect the transformation before composition, embedders would have to render to an off-screen render target and then apply the transformation before presentation. This patch negates the need for that off-screen render pass. To be clear, the previous architecture is still fully viable. Embedders still have full control over layer transformations before composition. This is an optimization for the hardware overlay planes use-case. Fixes b/139758641
91 lines
2.6 KiB
C++
91 lines
2.6 KiB
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_
|
|
#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_
|
|
|
|
#include "flutter/fml/macros.h"
|
|
#include "flutter/fml/unique_object.h"
|
|
#include "flutter/shell/platform/embedder/embedder.h"
|
|
#include "flutter/shell/platform/embedder/tests/embedder_test.h"
|
|
#include "flutter/shell/platform/embedder/tests/embedder_test_compositor.h"
|
|
#include "flutter/shell/platform/embedder/tests/embedder_test_context.h"
|
|
|
|
namespace flutter {
|
|
namespace testing {
|
|
|
|
struct UniqueEngineTraits {
|
|
static FlutterEngine InvalidValue() { return nullptr; }
|
|
|
|
static bool IsValid(const FlutterEngine& value) { return value != nullptr; }
|
|
|
|
static void Free(FlutterEngine& engine) {
|
|
auto result = FlutterEngineShutdown(engine);
|
|
FML_CHECK(result == kSuccess);
|
|
}
|
|
};
|
|
|
|
using UniqueEngine = fml::UniqueObject<FlutterEngine, UniqueEngineTraits>;
|
|
|
|
class EmbedderConfigBuilder {
|
|
public:
|
|
enum class InitializationPreference {
|
|
kInitialize,
|
|
kNoInitialize,
|
|
};
|
|
|
|
EmbedderConfigBuilder(EmbedderTestContext& context,
|
|
InitializationPreference preference =
|
|
InitializationPreference::kInitialize);
|
|
|
|
~EmbedderConfigBuilder();
|
|
|
|
FlutterProjectArgs& GetProjectArgs();
|
|
|
|
void SetSoftwareRendererConfig(SkISize surface_size = SkISize::Make(1, 1));
|
|
|
|
void SetOpenGLRendererConfig(SkISize surface_size);
|
|
|
|
void SetAssetsPath();
|
|
|
|
void SetSnapshots();
|
|
|
|
void SetIsolateCreateCallbackHook();
|
|
|
|
void SetSemanticsCallbackHooks();
|
|
|
|
void SetDartEntrypoint(std::string entrypoint);
|
|
|
|
void AddCommandLineArgument(std::string arg);
|
|
|
|
void SetPlatformTaskRunner(const FlutterTaskRunnerDescription* runner);
|
|
|
|
void SetPlatformMessageCallback(
|
|
std::function<void(const FlutterPlatformMessage*)> callback);
|
|
|
|
void SetCompositor();
|
|
|
|
FlutterCompositor& GetCompositor();
|
|
|
|
UniqueEngine LaunchEngine() const;
|
|
|
|
private:
|
|
EmbedderTestContext& context_;
|
|
FlutterProjectArgs project_args_ = {};
|
|
FlutterRendererConfig renderer_config_ = {};
|
|
FlutterSoftwareRendererConfig software_renderer_config_ = {};
|
|
FlutterOpenGLRendererConfig opengl_renderer_config_ = {};
|
|
std::string dart_entrypoint_;
|
|
FlutterCustomTaskRunners custom_task_runners_ = {};
|
|
FlutterCompositor compositor_ = {};
|
|
std::vector<std::string> command_line_arguments_;
|
|
|
|
FML_DISALLOW_COPY_AND_ASSIGN(EmbedderConfigBuilder);
|
|
};
|
|
|
|
} // namespace testing
|
|
} // namespace flutter
|
|
|
|
#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_
|