5#include "flutter/shell/platform/embedder/embedder_external_view.h"
7#include "flutter/display_list/dl_builder.h"
8#include "flutter/fml/trace_event.h"
9#include "flutter/shell/common/dl_op_spy.h"
11#ifdef IMPELLER_SUPPORTS_RENDERING
13#define ENABLE_EXPERIMENTAL_CANVAS false
21 const auto transformed_rect = transformation.
mapRect(source_rect);
22 return SkISize::Make(transformed_rect.width(), transformed_rect.height());
27 const SkMatrix& surface_transformation)
32 const SkMatrix& surface_transformation,
34 std::unique_ptr<EmbeddedViewParams>
params)
35 : render_surface_size_(
37 surface_transformation_(surface_transformation),
51 return slice_->canvas();
55 return render_surface_size_;
67 return slice_->getRegion();
71 if (has_engine_rendered_contents_.has_value()) {
72 return has_engine_rendered_contents_.value();
76 slice_->dispatch(dl_op_spy);
77 has_engine_rendered_contents_ = dl_op_spy.
did_draw() && !slice_->is_empty();
79 return has_engine_rendered_contents_.value();
84 return view_identifier_;
88 return embedded_view_params_.get();
96 <<
"Unnecessarily asked to render into a render target when there was "
99#ifdef IMPELLER_SUPPORTS_RENDERING
101 if (impeller_target) {
105 dl_builder.SetTransform(&surface_transformation_);
106 slice_->render_into(&dl_builder);
107 auto display_list = dl_builder.Build();
109#if ENABLE_EXPERIMENTAL_CANVAS
119 aiks_context->GetContentContext(), *impeller_target,
120 display_list->root_has_backdrop_filter(),
121 display_list->max_root_blend_mode(), cull_rect);
122 display_list->Dispatch(impeller_dispatcher, sk_cull_rect);
124 aiks_context->GetContentContext().GetTransientsBuffer().Reset();
125 aiks_context->GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames();
130 dispatcher.drawDisplayList(display_list, 1);
131 return aiks_context->Render(dispatcher.EndRecordingAsPicture(),
132 *impeller_target,
true);
148 auto canvas = skia_surface->getCanvas();
158 slice_->render_into(&dl_canvas);
166void EmbedderExternalView::TryEndRecording()
const {
167 if (slice_->recording_ended()) {
170 slice_->end_recording();
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Developer-facing API for rendering anything within the engine.
void Clear(DlColor color)
bool did_draw()
Returns true if any non transparent content has been drawn.
Backend implementation of |DlCanvas| for |SkCanvas|.
int GetSaveCount() const override
void SetTransform(const SkMatrix *matrix) override
void RestoreToCount(int restore_count) override
const EmbeddedViewParams * GetEmbeddedViewParams() const
RenderTargetDescriptor CreateRenderTargetDescriptor() const
SkISize GetRenderSurfaceSize() const
bool Render(const EmbedderRenderTarget &render_target, bool clear_surface=true)
const DlRegion & GetDlRegion() const
bool HasPlatformView() const
ViewIdentifier GetViewIdentifier() const
bool HasEngineRenderedContents()
EmbedderExternalView(const SkISize &frame_size, const SkMatrix &surface_transformation)
Describes a surface whose backing store is managed by the embedder. The type of surface depends on th...
virtual impeller::RenderTarget * GetImpellerRenderTarget() const =0
An impeller render target the rasterizer can use to draw into the backing store.
virtual sk_sp< SkSurface > GetSkiaSurface() const =0
A render surface the rasterizer can use to draw into the backing store of this render target.
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const =0
Returns the AiksContext that should be used for rendering, if this render target is backed by Impelle...
virtual SkISize GetRenderTargetSize() const =0
Returns the size of the render target.
Performs a first pass over the display list to collect all text frames.
EmbedderExternalView::ViewIdentifier view_identifier
const EmbeddedViewParams * params
#define FML_LOG(severity)
#define FML_DCHECK(condition)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
it will be possible to load the file into Perfetto s trace viewer 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
static SkISize TransformedSurfaceSize(const SkISize &size, const SkMatrix &transformation)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeWH(float w, float h)
static constexpr DlColor kTransparent()
std::optional< PlatformViewID > platform_view_id
A 4x4 matrix using column-major storage.
static constexpr TRect MakeSize(const TSize< U > &size)
#define TRACE_EVENT0(category_group, name)