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"
102 std::unique_ptr<EntityPassTarget> p_entity_pass_target)
121 const Matrix& effect_transform,
127 bool requires_readback);
132 bool requires_readback,
138 bool requires_readback,
145 void SetBackdropData(std::unordered_map<int64_t, BackdropData> backdrop_data,
146 size_t backdrop_count);
156 std::optional<Rect> bounds = std::nullopt,
157 const flutter::DlImageFilter* backdrop_filter =
nullptr,
159 uint32_t total_content_depth =
kMaxDepth,
160 bool can_distribute_opacity =
false,
161 std::optional<int64_t> backdrop_id = std::nullopt);
196 bool reuse_depth =
false);
212 void DrawImage(
const std::shared_ptr<Texture>& image,
218 const std::shared_ptr<Texture>& image,
225 void DrawTextFrame(
const std::shared_ptr<TextFrame>& text_frame,
229 void DrawVertices(
const std::shared_ptr<VerticesGeometry>& vertices,
233 void DrawAtlas(
const std::shared_ptr<AtlasContents>& atlas_contents,
244 uint64_t
GetMaxOpDepth()
const {
return transform_stack_.back().clip_depth; }
271 const bool is_onscreen_;
272 bool requires_readback_;
275 std::deque<CanvasStackEntry> transform_stack_;
276 std::optional<Rect> initial_cull_rect_;
277 std::vector<LazyRenderingConfig> render_passes_;
278 std::vector<SaveLayerState> save_layer_state_;
285 std::unordered_map<int64_t, BackdropData> backdrop_data_;
295 size_t backdrop_count_ = 0u;
300 std::vector<std::unique_ptr<Geometry>> clip_geometry_;
302 uint64_t current_depth_ = 0u;
304 Point GetGlobalPassPosition()
const;
307 size_t GetClipHeightFloor()
const;
311 bool IsSkipping()
const;
314 void SkipUntilMatchingRestore(
size_t total_content_depth);
316 void SetupRenderPass();
335 std::shared_ptr<Texture> FlipBackdrop(
Point global_pass_position,
336 bool should_remove_texture =
false,
337 bool should_use_onscreen =
false);
339 bool BlitToOnscreen(
bool is_onscreen =
false);
341 size_t GetClipHeight()
const;
343 void Initialize(std::optional<Rect> cull_rect);
347 void AddRenderEntityWithFiltersToCurrentPass(
Entity& entity,
350 bool reuse_depth =
false);
352 void AddRenderEntityToCurrentPass(
Entity& entity,
bool reuse_depth =
false);
354 bool AttemptDrawBlurredRRect(
const Rect& rect,
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
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.