Flutter Engine
 
Loading...
Searching...
No Matches
flutter::SnapshotControllerImpeller Class Reference

#include <snapshot_controller_impeller.h>

Inheritance diagram for flutter::SnapshotControllerImpeller:
flutter::SnapshotController

Public Member Functions

 SnapshotControllerImpeller (const SnapshotController::Delegate &delegate)
 
void MakeRasterSnapshot (sk_sp< DisplayList > display_list, DlISize picture_size, std::function< void(const sk_sp< DlImage > &)> callback) override
 
sk_sp< DlImageMakeRasterSnapshotSync (sk_sp< DisplayList > display_list, DlISize picture_size) override
 
sk_sp< SkImage > ConvertToRasterImage (sk_sp< SkImage > image) override
 
void CacheRuntimeStage (const std::shared_ptr< impeller::RuntimeStage > &runtime_stage) override
 
virtual bool MakeRenderContextCurrent () override
 
- Public Member Functions inherited from flutter::SnapshotController
virtual ~SnapshotController ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from flutter::SnapshotController
static std::unique_ptr< SnapshotControllerMake (const Delegate &delegate, const Settings &settings)
 
- Protected Member Functions inherited from flutter::SnapshotController
 SnapshotController (const Delegate &delegate)
 
const DelegateGetDelegate ()
 

Detailed Description

Definition at line 13 of file snapshot_controller_impeller.h.

Constructor & Destructor Documentation

◆ SnapshotControllerImpeller()

flutter::SnapshotControllerImpeller::SnapshotControllerImpeller ( const SnapshotController::Delegate delegate)
inlineexplicit

Definition at line 15 of file snapshot_controller_impeller.h.

17 : SnapshotController(delegate) {}
SnapshotController(const Delegate &delegate)

Member Function Documentation

◆ CacheRuntimeStage()

void flutter::SnapshotControllerImpeller::CacheRuntimeStage ( const std::shared_ptr< impeller::RuntimeStage > &  runtime_stage)
overridevirtual

Implements flutter::SnapshotController.

Definition at line 147 of file snapshot_controller_impeller.cc.

148 {
149 if (!GetDelegate().IsAiksContextInitialized()) {
150 return;
151 }
152 auto context = GetDelegate().GetAiksContext();
153 if (!context) {
154 return;
155 }
156 impeller::RuntimeEffectContents runtime_effect;
157 runtime_effect.SetRuntimeStage(runtime_stage);
158 runtime_effect.BootstrapShader(context->GetContentContext());
159}
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const =0
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)

References impeller::RuntimeEffectContents::BootstrapShader(), flutter::SnapshotController::Delegate::GetAiksContext(), flutter::SnapshotController::GetDelegate(), and impeller::RuntimeEffectContents::SetRuntimeStage().

◆ ConvertToRasterImage()

sk_sp< SkImage > flutter::SnapshotControllerImpeller::ConvertToRasterImage ( sk_sp< SkImage >  image)
overridevirtual

Implements flutter::SnapshotController.

Definition at line 161 of file snapshot_controller_impeller.cc.

162 {
164}
#define FML_UNREACHABLE()
Definition logging.h:128

References FML_UNREACHABLE.

◆ MakeRasterSnapshot()

void flutter::SnapshotControllerImpeller::MakeRasterSnapshot ( sk_sp< DisplayList display_list,
DlISize  picture_size,
std::function< void(const sk_sp< DlImage > &)>  callback 
)
overridevirtual

Implements flutter::SnapshotController.

Definition at line 97 of file snapshot_controller_impeller.cc.

100 {
101 std::shared_ptr<const fml::SyncSwitch> sync_switch =
103 sync_switch->Execute(
105 .SetIfTrue([&] {
106 std::shared_ptr<impeller::AiksContext> context =
108 if (context) {
109 context->GetContext()->StoreTaskForGPU(
110 [context, sync_switch, display_list = std::move(display_list),
111 picture_size, callback] {
112 callback(DoMakeRasterSnapshot(display_list, picture_size,
113 sync_switch, context));
114 },
115 [callback]() { callback(nullptr); });
116 } else {
117#if FML_OS_IOS_SIMULATOR
120 /*is_fake_image=*/true));
121#else
122 callback(nullptr);
123
124#endif // FML_OS_IOS_SIMULATOR
125 }
126 })
127 .SetIfFalse([&] {
128#if FML_OS_IOS_SIMULATOR
129 if (!GetDelegate().GetAiksContext()) {
132 /*is_fake_image=*/true));
133 return;
134 }
135#endif
136 callback(DoMakeRasterSnapshot(display_list, picture_size,
137 GetDelegate()));
138 }));
139}
virtual std::shared_ptr< const fml::SyncSwitch > GetIsGpuDisabledSyncSwitch() const =0
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
FlutterDesktopBinaryReply callback
Represents the 2 code paths available when calling |SyncSwitchExecute|.
Definition sync_switch.h:35

References callback, flutter::SnapshotController::Delegate::GetAiksContext(), flutter::SnapshotController::GetDelegate(), flutter::SnapshotController::Delegate::GetIsGpuDisabledSyncSwitch(), flutter::DlImage::kRaster, and impeller::DlImageImpeller::Make().

◆ MakeRasterSnapshotSync()

sk_sp< DlImage > flutter::SnapshotControllerImpeller::MakeRasterSnapshotSync ( sk_sp< DisplayList display_list,
DlISize  picture_size 
)
overridevirtual

Implements flutter::SnapshotController.

Definition at line 141 of file snapshot_controller_impeller.cc.

143 {
144 return DoMakeRasterSnapshot(display_list, picture_size, GetDelegate());
145}

References flutter::SnapshotController::GetDelegate().

◆ MakeRenderContextCurrent()

bool flutter::SnapshotControllerImpeller::MakeRenderContextCurrent ( )
overridevirtual

Implements flutter::SnapshotController.

Definition at line 166 of file snapshot_controller_impeller.cc.

166 {
167 const std::unique_ptr<Surface>& surface = GetDelegate().GetSurface();
168 if (!surface) {
169 // Some backends (such as Metal) can operate without a surface and do not
170 // require MakeRenderContextCurrent.
171 return true;
172 }
173 return surface->MakeRenderContextCurrent()->GetResult();
174}
virtual const std::unique_ptr< Surface > & GetSurface() const =0
VkSurfaceKHR surface
Definition main.cc:65

References flutter::SnapshotController::GetDelegate(), flutter::SnapshotController::Delegate::GetSurface(), and surface.


The documentation for this class was generated from the following files: