#include <layer_raster_cache_item.h>
|
| LayerRasterCacheItem (Layer *layer, int layer_cached_threshold=1, bool can_cache_children=false) |
|
std::optional< RasterCacheKeyID > | GetId () const override |
|
void | PrerollSetup (PrerollContext *context, const SkMatrix &matrix) override |
|
void | PrerollFinalize (PrerollContext *context, const SkMatrix &matrix) override |
|
bool | Draw (const PaintContext &context, const DlPaint *paint) const override |
|
bool | Draw (const PaintContext &context, DlCanvas *canvas, const DlPaint *paint) const override |
|
bool | TryToPrepareRasterCache (const PaintContext &context, bool parent_cached=false) const override |
|
void | MarkCacheChildren () |
|
void | MarkNotCacheChildren () |
|
bool | IsCacheChildren () const |
|
| RasterCacheItem (RasterCacheKeyID key_id, CacheState cache_state=CacheState::kNone, unsigned child_entries=0) |
|
virtual void | PrerollSetup (PrerollContext *context, const SkMatrix &matrix)=0 |
|
virtual void | PrerollFinalize (PrerollContext *context, const SkMatrix &matrix)=0 |
|
virtual bool | Draw (const PaintContext &context, const DlPaint *paint) const =0 |
|
virtual bool | Draw (const PaintContext &context, DlCanvas *canvas, const DlPaint *paint) const =0 |
|
virtual std::optional< RasterCacheKeyID > | GetId () const |
|
virtual bool | TryToPrepareRasterCache (const PaintContext &context, bool parent_cached=false) const =0 |
|
unsigned | child_items () const |
|
void | set_matrix (const SkMatrix &matrix) |
|
CacheState | cache_state () const |
|
bool | need_caching () const |
|
virtual | ~RasterCacheItem ()=default |
|
Definition at line 17 of file layer_raster_cache_item.h.
◆ LayerRasterCacheItem()
flutter::LayerRasterCacheItem::LayerRasterCacheItem |
( |
Layer * |
layer, |
|
|
int |
layer_cached_threshold = 1 , |
|
|
bool |
can_cache_children = false |
|
) |
| |
|
explicit |
Definition at line 15 of file layer_raster_cache_item.cc.
20
int layer_cached_threshold_
RasterCacheItem(RasterCacheKeyID key_id, CacheState cache_state=CacheState::kNone, unsigned child_entries=0)
◆ Draw() [1/2]
bool flutter::LayerRasterCacheItem::Draw |
( |
const PaintContext & |
context, |
|
|
const DlPaint * |
paint |
|
) |
| const |
|
overridevirtual |
◆ Draw() [2/2]
Implements flutter::RasterCacheItem.
Definition at line 176 of file layer_raster_cache_item.cc.
178 {
179 if (!context.raster_cache || !canvas) {
180 return false;
181 }
184 return false;
186 return context.raster_cache->Draw(
key_id_, *canvas,
paint,
187 context.rendering_above_platform_view);
188 }
191 return false;
192 }
195 context.rendering_above_platform_view);
196 }
197 }
198}
std::optional< RasterCacheKeyID > layer_children_id_
◆ GetId()
std::optional< RasterCacheKeyID > flutter::LayerRasterCacheItem::GetId |
( |
| ) |
const |
|
overridevirtual |
◆ GetPaintBoundsFromLayer()
const SkRect * flutter::LayerRasterCacheItem::GetPaintBoundsFromLayer |
( |
| ) |
const |
|
protected |
Definition at line 91 of file layer_raster_cache_item.cc.
91 {
93 case CacheState::kCurrent:
95 case CacheState::kChildren:
98 default:
100 return nullptr;
101 }
102}
const SkRect & child_paint_bounds() const
const SkRect & paint_bounds() const
virtual const ContainerLayer * as_container_layer() const
#define FML_DCHECK(condition)
◆ IsCacheChildren()
bool flutter::LayerRasterCacheItem::IsCacheChildren |
( |
| ) |
const |
|
inline |
◆ Make()
std::unique_ptr< LayerRasterCacheItem > flutter::LayerRasterCacheItem::Make |
( |
Layer * |
layer, |
|
|
int |
layer_cache_threshold, |
|
|
bool |
can_cache_children = false |
|
) |
| |
|
static |
Create a LayerRasterCacheItem, connect a layer and manage the Layer's raster cache.
- Parameters
-
layer_cache_threshold | after how many frames to start trying to cache the layer self |
can_cache_children | the layer can do a cache for his children |
Definition at line 36 of file layer_raster_cache_item.cc.
39 {
40 return std::make_unique<LayerRasterCacheItem>(layer, layer_cache_threshold,
41 can_cache_children);
42}
◆ MarkCacheChildren()
void flutter::LayerRasterCacheItem::MarkCacheChildren |
( |
| ) |
|
|
inline |
◆ MarkNotCacheChildren()
void flutter::LayerRasterCacheItem::MarkNotCacheChildren |
( |
| ) |
|
|
inline |
◆ PrerollFinalize()
Implements flutter::RasterCacheItem.
Definition at line 44 of file layer_raster_cache_item.cc.
45 {
46 if (!context->raster_cache || !context->raster_cached_entries) {
47 return;
48 }
49
50
51
52 if (context->has_platform_view || context->has_texture_layer ||
54 return;
55 }
58
61 } else {
63
67 if (!ids.has_value()) {
68 return;
69 }
72 }
75 true);
76 }
77 }
78}
static std::optional< std::vector< RasterCacheKeyID > > LayerChildrenIds(const Layer *layer)
◆ PrerollSetup()
Implements flutter::RasterCacheItem.
Definition at line 26 of file layer_raster_cache_item.cc.
27 {
29 if (context->raster_cache && context->raster_cached_entries) {
30 context->raster_cached_entries->push_back(this);
33 }
34}
unsigned useCenter Optional< SkMatrix > matrix
◆ TryToPrepareRasterCache()
bool flutter::LayerRasterCacheItem::TryToPrepareRasterCache |
( |
const PaintContext & |
context, |
|
|
bool |
parent_cached = false |
|
) |
| const |
|
overridevirtual |
Implements flutter::RasterCacheItem.
Definition at line 142 of file layer_raster_cache_item.cc.
143 {
144 auto maybe_id =
GetId();
145 if (!maybe_id.has_value() || !context.raster_cache || parent_cached) {
146 return false;
147 }
150 RasterCache::Context r_context = {
151
152 .gr_context = context.gr_context,
153 .dst_color_space = context.dst_color_space,
155 .logical_rect = *paint_bounds,
157
158 };
159 auto id = maybe_id.value();
160 return context.raster_cache->UpdateCacheEntry(
161 id, r_context,
165 });
166 }
167 }
168 return false;
169}
std::optional< RasterCacheKeyID > GetId() const override
const SkRect * GetPaintBoundsFromLayer() const
CacheState cache_state() const
static const auto * flow_type
bool Rasterize(RasterCacheItem::CacheState cache_state, Layer *layer, const PaintContext &paint_context, DlCanvas *canvas)
flutter::DlCanvas DlCanvas
◆ can_cache_children_
bool flutter::LayerRasterCacheItem::can_cache_children_ = false |
|
protected |
◆ layer_
Layer* flutter::LayerRasterCacheItem::layer_ |
|
protected |
◆ layer_cached_threshold_
int flutter::LayerRasterCacheItem::layer_cached_threshold_ = 1 |
|
protected |
◆ layer_children_id_
std::optional<RasterCacheKeyID> flutter::LayerRasterCacheItem::layer_children_id_ |
|
protected |
◆ num_cache_attempts_
int flutter::LayerRasterCacheItem::num_cache_attempts_ = 1 |
|
mutableprotected |
The documentation for this class was generated from the following files: