5#ifndef FLUTTER_IMPELLER_DISPLAY_LIST_CANVAS_H_
6#define FLUTTER_IMPELLER_DISPLAY_LIST_CANVAS_H_
103 std::unique_ptr<EntityPassTarget> p_entity_pass_target);
115 std::unique_ptr<EntityPassTarget> entity_pass_target_;
116 std::unique_ptr<InlinePassContext> inline_pass_context_;
126 bool requires_readback);
131 bool requires_readback,
137 bool requires_readback,
144 void SetBackdropData(std::unordered_map<int64_t, BackdropData> backdrop_data,
145 size_t backdrop_count);
155 std::optional<Rect> bounds = std::nullopt,
158 uint32_t total_content_depth =
kMaxDepth,
159 bool can_distribute_opacity =
false,
160 std::optional<int64_t> backdrop_id = std::nullopt);
195 bool reuse_depth =
false);
231 const std::shared_ptr<Texture>&
image,
238 void DrawTextFrame(
const std::shared_ptr<TextFrame>& text_frame,
242 void DrawVertices(
const std::shared_ptr<VerticesGeometry>& vertices,
246 void DrawAtlas(
const std::shared_ptr<AtlasContents>& atlas_contents,
257 uint64_t
GetMaxOpDepth()
const {
return transform_stack_.back().clip_depth; }
289 virtual ~BlurShape() =
default;
290 virtual Rect GetBounds()
const = 0;
291 virtual std::shared_ptr<SolidBlurContents> BuildBlurContent(
293 virtual const Geometry& BuildDrawGeometry() = 0;
295 class RRectBlurShape;
296 class RSuperellipseBlurShape;
299 ContentContext& renderer_;
300 RenderTarget render_target_;
301 const bool is_onscreen_;
302 bool requires_readback_;
303 EntityPassClipStack clip_coverage_stack_;
305 std::deque<CanvasStackEntry> transform_stack_;
306 std::optional<Rect> initial_cull_rect_;
307 std::vector<LazyRenderingConfig> render_passes_;
308 std::vector<SaveLayerState> save_layer_state_;
315 std::unordered_map<int64_t, BackdropData> backdrop_data_;
325 size_t backdrop_count_ = 0u;
330 std::vector<std::unique_ptr<Geometry>> clip_geometry_;
332 uint64_t current_depth_ = 0u;
334 Point GetGlobalPassPosition()
const;
337 size_t GetClipHeightFloor()
const;
341 bool IsSkipping()
const;
344 void SkipUntilMatchingRestore(
size_t total_content_depth);
346 void SetupRenderPass();
365 std::shared_ptr<Texture> FlipBackdrop(
Point global_pass_position,
366 bool should_remove_texture =
false,
367 bool should_use_onscreen =
false,
368 bool post_depth_increment =
false);
370 bool BlitToOnscreen(
bool is_onscreen =
false);
372 size_t GetClipHeight()
const;
374 void Initialize(std::optional<Rect> cull_rect);
378 void AddRenderEntityWithFiltersToCurrentPass(
380 const Geometry* geometry,
382 bool reuse_depth =
false,
383 std::shared_ptr<Contents> override_contents =
nullptr);
385 void AddRenderSDFEntityToCurrentPass(
const Paint& paint,
386 UberSDFParameters
params);
388 void AddRenderEntityToCurrentPass(Entity& entity,
bool reuse_depth =
false);
392 static bool IsShadowBlurDrawOperation(
const Paint& paint);
394 bool AttemptDrawAntialiasedCircle(
const Point& center,
400 static Scalar GetCommonRRectLikeRadius(
const RoundingRadii& radii);
402 bool AttemptDrawBlurredPathSource(
const PathSource& source,
405 bool AttemptDrawBlurredRRect(
const RoundRect& round_rect,
const Paint& paint);
407 bool AttemptDrawBlurredRSuperellipse(
const RoundSuperellipse& rse,
410 bool AttemptDrawBlur(BlurShape& shape,
const Paint& paint);
416 bool AttemptColorFilterOptimization(
const std::shared_ptr<Texture>&
image,
420 const SamplerDescriptor& sampler,
423 bool AttemptBlurredTextOptimization(
424 const std::shared_ptr<TextFrame>& text_frame,
425 const std::shared_ptr<TextContents>& text_contents,
429 RenderPass& GetCurrentRenderPass()
const;
431 Canvas(
const Canvas&) =
delete;
433 Canvas& operator=(
const Canvas&) =
delete;
void ClipGeometry(const Geometry &geometry, Entity::ClipOperation clip_op, bool is_aa=true)
static constexpr uint32_t kMaxDepth
void SetBackdropData(std::unordered_map< int64_t, BackdropData > backdrop_data, size_t backdrop_count)
Update the backdrop data used to group together backdrop filters within the same layer.
bool RequiresReadback() const
void DrawRoundSuperellipse(const RoundSuperellipse &rse, const Paint &paint)
std::optional< Rect > GetLocalCoverageLimit() const
Return the culling bounds of the current render target, or nullopt if there is no coverage.
void SaveLayer(const Paint &paint, std::optional< Rect > bounds=std::nullopt, const flutter::DlImageFilter *backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown, uint32_t total_content_depth=kMaxDepth, bool can_distribute_opacity=false, std::optional< int64_t > backdrop_id=std::nullopt)
const Matrix & GetCurrentTransform() const
void DrawVertices(const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint)
void DrawOval(const Rect &rect, const Paint &paint)
void DrawImageRect(const std::shared_ptr< Texture > &image, Rect source, Rect dest, const Paint &paint, const SamplerDescriptor &sampler={}, SourceRectConstraint src_rect_constraint=SourceRectConstraint::kFast)
void RestoreToCount(size_t count)
static bool IsCompatibleWithSDFRendering(const Paint &paint)
size_t GetSaveCount() const
void Concat(const Matrix &transform)
void Transform(const Matrix &transform)
uint64_t GetMaxOpDepth() const
void DrawDashedLine(const Point &p0, const Point &p1, Scalar on_length, Scalar off_length, const Paint &paint)
void DrawDiffRoundRect(const RoundRect &outer, const RoundRect &inner, const Paint &paint)
void DrawPath(const flutter::DlPath &path, const Paint &paint)
void PreConcat(const Matrix &transform)
void Rotate(Radians radians)
void DrawPoints(const Point points[], uint32_t count, Scalar radius, const Paint &paint, PointStyle point_style)
void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
void DrawImage(const std::shared_ptr< Texture > &image, Point offset, const Paint &paint, const SamplerDescriptor &sampler={})
void DrawPaint(const Paint &paint)
void DrawRoundRect(const RoundRect &rect, const Paint &paint)
void Skew(Scalar sx, Scalar sy)
void Scale(const Vector2 &scale)
uint64_t GetOpDepth() const
void Save(uint32_t total_content_depth=kMaxDepth)
bool SupportsBlitToOnscreen() const
void DrawRect(const Rect &rect, const Paint &paint)
bool EnsureFinalMipmapGeneration() const
void DrawAtlas(const std::shared_ptr< AtlasContents > &atlas_contents, const Paint &paint)
void DrawLine(const Point &p0, const Point &p1, const Paint &paint, bool reuse_depth=false)
void Translate(const Vector3 &offset)
void DrawCircle(const Point ¢er, Scalar radius, const Paint &paint)
void DrawArc(const Arc &arc, const Paint &paint)
bool IsApplyingClearColor() const
Whether or not the clear color texture can still be updated.
EntityPassTarget * GetEntityPassTarget() const
LazyRenderingConfig(LazyRenderingConfig &&)=default
InlinePassContext * GetInlinePassContext() const
const EmbeddedViewParams * params
FlutterVulkanImage * image
SourceRectConstraint
Controls the behavior of the source rectangle given to DrawImageRect.
@ kStrict
Sample only within the source rectangle. May be slower.
@ kFast
Faster, but may sample outside the bounds of the source rectangle.
@ kRound
Points are drawn as squares.
@ kSquare
Points are drawn as circles.
@ kUnknown
The caller makes no claims related to the size of the bounds.
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
std::shared_ptr< Texture > texture_slot
std::shared_ptr< flutter::DlImageFilter > last_backdrop
std::optional< Snapshot > shared_filter_snapshot
Entity::RenderingMode rendering_mode
Scalar distributed_opacity
A 4x4 matrix using column-major storage.
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
std::vector< Point > points