22sk_sp<DlImage> DoMakeRasterSnapshot(
23 const sk_sp<DisplayList>& display_list,
25 const std::shared_ptr<impeller::AiksContext>& context) {
31 auto max_size = context->GetContext()
32 ->GetResourceAllocator()
33 ->GetMaxTextureSizeSupported();
34 double scale_factor_x =
35 static_cast<double>(max_size.width) /
static_cast<double>(
size.width);
36 double scale_factor_y =
37 static_cast<double>(max_size.height) /
static_cast<double>(
size.height);
38 double scale_factor = std::min({1.0, scale_factor_x, scale_factor_y});
45 if (scale_factor < 1.0) {
46 render_target_size.width *= scale_factor;
47 render_target_size.height *= scale_factor;
57sk_sp<DlImage> DoMakeRasterSnapshot(
58 const sk_sp<DisplayList>& display_list,
60 const SnapshotController::Delegate& delegate) {
64 std::unique_ptr<Surface> pbuffer_surface;
65 if (delegate.GetSurface()) {
66 delegate.GetSurface()->MakeRenderContextCurrent();
67 }
else if (delegate.GetSnapshotSurfaceProducer()) {
69 delegate.GetSnapshotSurfaceProducer()->CreateSnapshotSurface();
70 if (pbuffer_surface) {
71 pbuffer_surface->MakeRenderContextCurrent();
75 return DoMakeRasterSnapshot(display_list,
size, delegate.GetAiksContext());
78sk_sp<DlImage> DoMakeRasterSnapshot(
79 sk_sp<DisplayList> display_list,
81 const std::shared_ptr<const fml::SyncSwitch>& sync_switch,
82 const std::shared_ptr<impeller::AiksContext>& context) {
83 sk_sp<DlImage> result;
89 result = DoMakeRasterSnapshot(
90 display_list, picture_size, context);
98 sk_sp<DisplayList> display_list,
100 std::function<
void(
const sk_sp<DlImage>&)>
callback) {
101 std::shared_ptr<const fml::SyncSwitch> sync_switch =
103 sync_switch->Execute(
106 std::shared_ptr<impeller::AiksContext> context =
109 context->GetContext()->StoreTaskForGPU(
110 [context, sync_switch, display_list = std::move(display_list),
112 callback(DoMakeRasterSnapshot(display_list, picture_size,
113 sync_switch, context));
117#if FML_OS_IOS_SIMULATOR
128#if FML_OS_IOS_SIMULATOR
136 callback(DoMakeRasterSnapshot(display_list, picture_size,
142 sk_sp<DisplayList> display_list,
144 return DoMakeRasterSnapshot(display_list, picture_size,
GetDelegate());
148 const std::shared_ptr<impeller::RuntimeStage>& runtime_stage) {
162 sk_sp<SkImage>
image) {
173 return surface->MakeRenderContextCurrent()->GetResult();
virtual const std::unique_ptr< Surface > & GetSurface() const =0
virtual std::shared_ptr< const fml::SyncSwitch > GetIsGpuDisabledSyncSwitch() const =0
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const =0
const Delegate & GetDelegate()
virtual bool MakeRenderContextCurrent() override
void MakeRasterSnapshot(sk_sp< DisplayList > display_list, DlISize picture_size, std::function< void(const sk_sp< DlImage > &)> callback) override
sk_sp< SkImage > ConvertToRasterImage(sk_sp< SkImage > image) override
sk_sp< DlImage > MakeRasterSnapshotSync(sk_sp< DisplayList > display_list, DlISize picture_size) override
void CacheRuntimeStage(const std::shared_ptr< impeller::RuntimeStage > &runtime_stage) override
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
bool BootstrapShader(const ContentContext &renderer) const
Load the runtime effect and ensure a default PSO is initialized.
void SetRuntimeStage(std::shared_ptr< RuntimeStage > runtime_stage)
FlutterVulkanImage * image
FlutterDesktopBinaryReply callback
#define FML_UNREACHABLE()
impeller::ISize32 DlISize
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
std::shared_ptr< Texture > DisplayListToTexture(const sk_sp< flutter::DisplayList > &display_list, ISize size, AiksContext &context, bool reset_host_buffer, bool generate_mips)
Render the provided display list to a texture with the given size.
Represents the 2 code paths available when calling |SyncSwitchExecute|.
#define TRACE_EVENT0(category_group, name)