5#include "flutter/flow/layers/container_layer.h"
14 auto old_container =
static_cast<const ContainerLayer*
>(old_layer);
22 for (
auto& layer : layers_) {
23 layer->PreservePaintRegion(context);
30 for (
auto& layer : layers_) {
31 layer->Diff(context,
nullptr);
37 const auto& prev_layers = old_layer->layers_;
40 int new_children_top = 0;
41 int old_children_top = 0;
44 int new_children_bottom = layers_.size() - 1;
45 int old_children_bottom = prev_layers.size() - 1;
47 while ((old_children_top <= old_children_bottom) &&
48 (new_children_top <= new_children_bottom)) {
50 context, prev_layers[old_children_top].
get())) {
57 while ((old_children_top <= old_children_bottom) &&
58 (new_children_top <= new_children_bottom)) {
60 context, prev_layers[old_children_bottom].
get())) {
63 --new_children_bottom;
64 --old_children_bottom;
68 for (
int i = old_children_top;
i <= old_children_bottom; ++
i) {
69 auto layer = prev_layers[
i];
73 for (
int i = 0; i < static_cast<int>(layers_.size()); ++
i) {
74 if (i < new_children_top || i > new_children_bottom) {
76 i < new_children_top ?
i : prev_layers.size() - (layers_.size() -
i);
77 auto layer = layers_[
i];
78 auto prev_layer = prev_layers[i_prev];
80 if (layer == prev_layer && !paint_region.has_readback() &&
81 !paint_region.has_texture()) {
93 layer->PreservePaintRegion(context);
95 layer->Diff(context, prev_layer.get());
100 auto layer = layers_[
i];
101 layer->Diff(context,
nullptr);
107 layers_.emplace_back(std::move(layer));
130 SkRect* child_paint_bounds) {
136 bool child_has_platform_view =
false;
137 bool child_has_texture_layer =
false;
140 for (
auto& layer : layers_) {
151 layer->Preroll(context);
158 all_renderable_state_flags = 0;
162 child_has_platform_view =
164 child_has_texture_layer =
190 for (
auto& layer : layers_) {
191 if (layer->needs_painting(context)) {
192 layer->Paint(context);
void set_children_renderable_state_flags(int flags)
int children_renderable_state_flags() const
void Preroll(PrerollContext *context) override
void PrerollChildren(PrerollContext *context, SkRect *child_paint_bounds)
void Paint(PaintContext &context) const override
void PreservePaintRegion(DiffContext *context) override
virtual void Add(std::shared_ptr< Layer > layer)
void PaintChildren(PaintContext &context) const override
void Diff(DiffContext *context, const Layer *old_layer) override
void set_child_paint_bounds(const SkRect &bounds)
virtual void DiffChildren(DiffContext *context, const ContainerLayer *old_layer)
const SkRect & child_paint_bounds() const
void SetLayerPaintRegion(const Layer *layer, const PaintRegion ®ion)
void MarkSubtreeDirty(const PaintRegion &previous_paint_region=PaintRegion())
void AddDamage(const PaintRegion &damage)
PaintRegion CurrentSubtreeRegion() const
void AddExistingPaintRegion(const PaintRegion ®ion)
PaintRegion GetOldLayerPaintRegion(const Layer *layer) const
bool IsSubtreeDirty() const
AutoRestore applyState(const SkRect &bounds, int can_apply_flags)
static constexpr int kCallerCanApplyAnything
virtual void PreservePaintRegion(DiffContext *context)
void set_subtree_has_platform_view(bool value)
virtual bool IsReplacing(DiffContext *context, const Layer *old_layer) const
bool needs_painting(PaintContext &context) const
void set_paint_bounds(const SkRect &paint_bounds)
#define FML_DCHECK(condition)
static bool safe_intersection_test(const SkRect *rect1, const SkRect &rect2)
const myers::Point & get(const myers::Segment &)
static constexpr SkRect MakeEmpty()
bool intersects(const SkRect &r) const
void join(const SkRect &r)
LayerStateStack & state_stack
int renderable_state_flags