5#ifndef FLUTTER_FLOW_LAYERS_LAYER_STATE_STACK_H_
6#define FLUTTER_FLOW_LAYERS_LAYER_STATE_STACK_H_
8#include "flutter/display_list/dl_canvas.h"
9#include "flutter/flow/embedded_views.h"
10#include "flutter/flow/paint_utils.h"
137 layer_state_stack_->restore_to_count(stack_restore_count_);
142 : layer_state_stack_(stack),
143 stack_restore_count_(stack->stack_count()) {
144 if (stack->needs_save_layer(
flags)) {
145 stack->save_layer(
bounds);
151 const size_t stack_restore_count_;
159 layer_state_stack_->restore_to_count(stack_restore_count_);
180 const std::shared_ptr<const DlImageFilter>& filter);
188 const std::shared_ptr<const DlColorFilter>& filter);
199 const std::shared_ptr<const DlImageFilter>& filter,
214 : layer_state_stack_(stack),
215 stack_restore_count_(stack->stack_count()) {}
219 const size_t stack_restore_count_;
220 bool save_needed_ =
true;
244 int can_apply_flags) {
251 return outstanding_.color_filter;
255 return outstanding_.image_filter;
306 return delegate_->content_culled(content_bounds);
317 bool is_empty()
const {
return state_stack_.empty(); }
320 size_t stack_count()
const {
return state_stack_.size(); }
321 void restore_to_count(
size_t restore_count);
324 void apply_last_entry() { state_stack_.back()->apply(
this); }
332 const std::shared_ptr<const DlColorFilter>& filter);
334 const std::shared_ptr<const DlImageFilter>& filter);
336 const std::shared_ptr<const DlImageFilter>& filter,
342 void push_integral_transform();
344 void push_clip_rect(
const SkRect&
rect,
bool is_aa);
346 void push_clip_path(
const SkPath&
path,
bool is_aa);
355 bool needs_save_layer(
int flags)
const;
358 void maybe_save_layer_for_transform(
bool needs_save);
359 void maybe_save_layer_for_clip(
bool needs_save);
361 void maybe_save_layer(
SkScalar opacity);
362 void maybe_save_layer(
const std::shared_ptr<const DlColorFilter>& filter);
363 void maybe_save_layer(
const std::shared_ptr<const DlImageFilter>& filter);
366 struct RenderingAttributes {
376 SkRect save_layer_bounds{0, 0, 0, 0};
380 std::shared_ptr<const DlImageFilter> image_filter;
385 bool operator==(
const RenderingAttributes& other)
const {
386 return save_layer_bounds == other.save_layer_bounds &&
387 opacity == other.opacity &&
389 Equals(image_filter, other.image_filter);
395 virtual ~StateEntry() =
default;
400 virtual void update_mutators(MutatorsStack* mutators_stack)
const {}
403 StateEntry() =
default;
427 virtual ~Delegate() =
default;
436 virtual void decommission() = 0;
438 virtual DlCanvas* canvas()
const {
return nullptr; }
442 virtual SkM44 matrix_4x4()
const = 0;
443 virtual SkMatrix matrix_3x3()
const = 0;
446 virtual void save() = 0;
448 RenderingAttributes& attributes,
451 virtual void restore() = 0;
456 virtual void integralTransform() = 0;
466 std::vector<std::unique_ptr<StateEntry>> state_stack_;
470 RenderingAttributes outstanding_;
static void apply_flags(SkFont *font, unsigned flags)
static sk_sp< SkImage > color_filter(const SkImage *image, SkColorFilter *colorFilter)
static bool apply(Pass *pass, SkRecord *record)
Developer-facing API for rendering anything within the engine.
void applyColorFilter(const SkRect &bounds, const std::shared_ptr< const DlColorFilter > &filter)
void translate(SkScalar tx, SkScalar ty)
void applyImageFilter(const SkRect &bounds, const std::shared_ptr< const DlImageFilter > &filter)
void clipPath(const SkPath &path, bool is_aa)
void applyBackdropFilter(const SkRect &bounds, const std::shared_ptr< const DlImageFilter > &filter, DlBlendMode blend_mode)
void clipRRect(const SkRRect &rrect, bool is_aa)
void clipRect(const SkRect &rect, bool is_aa)
void applyOpacity(const SkRect &bounds, SkScalar opacity)
void saveLayer(const SkRect &bounds)
void transform(const SkM44 &m44)
void translate(SkPoint tp)
std::shared_ptr< const DlImageFilter > outstanding_image_filter() const
SkRect outstanding_bounds() const
SkMatrix transform_3x3() const
void fill(MutatorsStack *mutators)
DlCanvas * canvas_delegate()
AutoRestore applyState(const SkRect &bounds, int can_apply_flags)
DlPaint * fill(DlPaint &paint) const
void set_preroll_delegate(const SkRect &cull_rect, const SkMatrix &matrix)
bool painting_is_nop() const
SkM44 transform_4x4() const
SkScalar outstanding_opacity() const
SkRect device_cull_rect() const
friend class MutatorContext
static constexpr int kCallerCanApplyAnything
static constexpr int kCallerCanApplyColorFilter
SkRect local_cull_rect() const
void set_delegate(DlCanvas *canvas)
bool content_culled(const SkRect &content_bounds) const
std::shared_ptr< const DlColorFilter > outstanding_color_filter() const
static constexpr int kCallerCanApplyImageFilter
static constexpr int kCallerCanApplyOpacity
FlutterSemanticsFlag flags
#define FML_DISALLOW_COPY_ASSIGN_AND_MOVE(TypeName)
static SkColor blend(SkColor dst, SkColor src, void(*mode)(float, float, float, float *, float *, float *))
clipRRect(r.rrect, r.opAA.op(), r.opAA.aa())) DRAW(ClipRect
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
clipPath(r.path, r.opAA.op(), r.opAA.aa())) DRAW(ClipRRect
sk_sp< const SkImageFilter > backdrop
sk_sp< SkBlender > blender SkRect rect
bool Equals(const T *a, const T *b)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
bool operator==(const ViewportMetrics &a, const ViewportMetrics &b)
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 mode
@ kSrcOver
r = s + (1-sa)*d
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)