5 #ifndef FLUTTER_IMPELLER_DISPLAY_LIST_CANVAS_H_
6 #define FLUTTER_IMPELLER_DISPLAY_LIST_CANVAS_H_
15 #include "display_list/effects/dl_image_filter.h"
103 std::unique_ptr<EntityPassTarget> p_entity_pass_target)
122 const Matrix& effect_transform,
128 bool requires_readback);
133 bool requires_readback,
139 bool requires_readback,
146 void SetBackdropData(std::unordered_map<int64_t, BackdropData> backdrop_data,
147 size_t backdrop_count);
157 std::optional<Rect> bounds = std::nullopt,
158 const flutter::DlImageFilter* backdrop_filter =
nullptr,
160 uint32_t total_content_depth =
kMaxDepth,
161 bool can_distribute_opacity =
false,
162 std::optional<int64_t> backdrop_id = std::nullopt);
197 bool reuse_depth =
false);
215 void DrawImage(
const std::shared_ptr<Texture>& image,
221 const std::shared_ptr<Texture>& image,
228 void DrawTextFrame(
const std::shared_ptr<TextFrame>& text_frame,
232 void DrawVertices(
const std::shared_ptr<VerticesGeometry>& vertices,
236 void DrawAtlas(
const std::shared_ptr<AtlasContents>& atlas_contents,
247 uint64_t
GetMaxOpDepth()
const {
return transform_stack_.back().clip_depth; }
274 const bool is_onscreen_;
275 bool requires_readback_;
278 std::deque<CanvasStackEntry> transform_stack_;
279 std::optional<Rect> initial_cull_rect_;
280 std::vector<LazyRenderingConfig> render_passes_;
281 std::vector<SaveLayerState> save_layer_state_;
288 std::unordered_map<int64_t, BackdropData> backdrop_data_;
298 size_t backdrop_count_ = 0u;
303 std::vector<std::unique_ptr<Geometry>> clip_geometry_;
305 uint64_t current_depth_ = 0u;
307 Point GetGlobalPassPosition()
const;
310 size_t GetClipHeightFloor()
const;
314 bool IsSkipping()
const;
317 void SkipUntilMatchingRestore(
size_t total_content_depth);
319 void SetupRenderPass();
338 std::shared_ptr<Texture> FlipBackdrop(
Point global_pass_position,
339 bool should_remove_texture =
false,
340 bool should_use_onscreen =
false);
342 bool BlitToOnscreen(
bool is_onscreen =
false);
344 size_t GetClipHeight()
const;
346 void Initialize(std::optional<Rect> cull_rect);
350 void AddRenderEntityWithFiltersToCurrentPass(
Entity& entity,
353 bool reuse_depth =
false);
355 void AddRenderEntityToCurrentPass(
Entity& entity,
bool reuse_depth =
false);
357 bool AttemptDrawBlurredRRect(
const Rect& rect,
365 bool AttemptColorFilterOptimization(
const std::shared_ptr<Texture>& image,
372 bool AttemptBlurredTextOptimization(
373 const std::shared_ptr<TextFrame>& text_frame,
374 const std::shared_ptr<TextContents>& text_contents,
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.
Canvas(ContentContext &renderer, const RenderTarget &render_target, bool is_onscreen, bool requires_readback)
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)
size_t GetSaveCount() const
void Concat(const Matrix &transform)
void Transform(const Matrix &transform)
uint64_t GetMaxOpDepth() const
std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, const Matrix &effect_transform, Entity::RenderingMode rendering_mode)> BackdropFilterProc
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 DrawPath(const Path &path, const Paint &paint)
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)
A class that tracks all clips that have been recorded in the current entity pass stencil.
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Render passes encode render commands directed as one specific render target into an underlying comman...
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
LazyRenderingConfig(ContentContext &renderer, std::unique_ptr< EntityPassTarget > p_entity_pass_target)
bool IsApplyingClearColor() const
Whether or not the clear color texture can still be updated.
std::unique_ptr< InlinePassContext > inline_pass_context
std::unique_ptr< EntityPassTarget > entity_pass_target
LazyRenderingConfig(ContentContext &renderer, std::unique_ptr< EntityPassTarget > entity_pass_target, std::unique_ptr< InlinePassContext > inline_pass_context)
A 4x4 matrix using column-major storage.