Flutter Engine
The Flutter Engine
|
#include <raster_cache.h>
Classes | |
struct | CacheInfo |
struct | Context |
Public Member Functions | |
std::unique_ptr< RasterCacheResult > | Rasterize (const RasterCache::Context &context, sk_sp< const DlRTree > rtree, const std::function< void(DlCanvas *)> &draw_function, const std::function< void(DlCanvas *, const SkRect &rect)> &draw_checkerboard) const |
RasterCache (size_t access_threshold=3, size_t picture_and_display_list_cache_limit_per_frame=RasterCacheUtil::kDefaultPictureAndDisplayListCacheLimitPerFrame) | |
virtual | ~RasterCache ()=default |
bool | Draw (const RasterCacheKeyID &id, DlCanvas &canvas, const DlPaint *paint, bool preserve_rtree=false) const |
bool | HasEntry (const RasterCacheKeyID &id, const SkMatrix &) const |
void | BeginFrame () |
void | EvictUnusedCacheEntries () |
void | EndFrame () |
void | Clear () |
const RasterCacheMetrics & | picture_metrics () const |
const RasterCacheMetrics & | layer_metrics () const |
size_t | GetCachedEntriesCount () const |
size_t | GetLayerCachedEntriesCount () const |
size_t | GetPictureCachedEntriesCount () const |
size_t | EstimatePictureCacheByteSize () const |
Estimate how much memory is used by picture raster cache entries in bytes. More... | |
size_t | EstimateLayerCacheByteSize () const |
Estimate how much memory is used by layer raster cache entries in bytes. More... | |
size_t | access_threshold () const |
Return the number of frames that a picture must be prepared before it will be cached. If the number is 0, then no picture will ever be cached. More... | |
bool | GenerateNewCacheInThisFrame () const |
CacheInfo | MarkSeen (const RasterCacheKeyID &id, const SkMatrix &matrix, bool visible) const |
The entry whose RasterCacheKey is generated by RasterCacheKeyID and matrix is marked as encountered by the current frame. The entry will be created if it does not exist. Optionally the entry will be marked as visible in the current frame if the caller determines that it intersects the cull rect. The access_count of the entry will be increased if it is visible, or if it was ever visible. More... | |
int | GetAccessCount (const RasterCacheKeyID &id, const SkMatrix &matrix) const |
bool | UpdateCacheEntry (const RasterCacheKeyID &id, const Context &raster_cache_context, const std::function< void(DlCanvas *)> &render_function, sk_sp< const DlRTree > rtree=nullptr) const |
Friends | |
class | RasterCacheItem |
class | LayerRasterCacheItem |
RasterCache is used to cache rasterized layers or display lists to improve performance.
Life cycle of RasterCache methods:
PrerollContext::raster_cached_entries
.RasterCache::Draw
will be used to draw those cache images.Definition at line 118 of file raster_cache.h.
|
explicit |
Definition at line 73 of file raster_cache.cc.
|
virtualdefault |
|
inline |
Return the number of frames that a picture must be prepared before it will be cached. If the number is 0, then no picture will ever be cached.
If the number is one, then it must be prepared and drawn on 1 frame and it will then be cached on the next frame if it is prepared.
Definition at line 216 of file raster_cache.h.
void flutter::RasterCache::BeginFrame | ( | ) |
Definition at line 195 of file raster_cache.cc.
void flutter::RasterCache::Clear | ( | ) |
Definition at line 239 of file raster_cache.cc.
bool flutter::RasterCache::Draw | ( | const RasterCacheKeyID & | id, |
DlCanvas & | canvas, | ||
const DlPaint * | paint, | ||
bool | preserve_rtree = false |
||
) | const |
Definition at line 176 of file raster_cache.cc.
void flutter::RasterCache::EndFrame | ( | ) |
Definition at line 234 of file raster_cache.cc.
size_t flutter::RasterCache::EstimateLayerCacheByteSize | ( | ) | const |
Estimate how much memory is used by layer raster cache entries in bytes.
Only SkImage's memory usage is counted as other objects are often much smaller compared to SkImage. SkImageInfo::computeMinByteSize is used to estimate the SkImage memory usage.
Definition at line 282 of file raster_cache.cc.
size_t flutter::RasterCache::EstimatePictureCacheByteSize | ( | ) | const |
Estimate how much memory is used by picture raster cache entries in bytes.
Only SkImage's memory usage is counted as other objects are often much smaller compared to SkImage. SkImageInfo::computeMinByteSize is used to estimate the SkImage memory usage.
Definition at line 293 of file raster_cache.cc.
void flutter::RasterCache::EvictUnusedCacheEntries | ( | ) |
Definition at line 214 of file raster_cache.cc.
|
inline |
Definition at line 218 of file raster_cache.h.
int flutter::RasterCache::GetAccessCount | ( | const RasterCacheKeyID & | id, |
const SkMatrix & | matrix | ||
) | const |
Returns the access count (i.e. accesses_since_visible) for the given entry in the cache, or -1 if no such entry exists.
Definition at line 157 of file raster_cache.cc.
size_t flutter::RasterCache::GetCachedEntriesCount | ( | ) | const |
Definition at line 245 of file raster_cache.cc.
size_t flutter::RasterCache::GetLayerCachedEntriesCount | ( | ) | const |
Return the number of map entries in the layer cache regardless of whether the entries have been populated with an image.
Definition at line 249 of file raster_cache.cc.
size_t flutter::RasterCache::GetPictureCachedEntriesCount | ( | ) | const |
Return the number of map entries in the picture (DisplayList) cache regardless of whether the entries have been populated with an image.
Definition at line 259 of file raster_cache.cc.
bool flutter::RasterCache::HasEntry | ( | const RasterCacheKeyID & | id, |
const SkMatrix & | matrix | ||
) | const |
Definition at line 167 of file raster_cache.cc.
|
inline |
Definition at line 172 of file raster_cache.h.
RasterCache::CacheInfo flutter::RasterCache::MarkSeen | ( | const RasterCacheKeyID & | id, |
const SkMatrix & | matrix, | ||
bool | visible | ||
) | const |
The entry whose RasterCacheKey is generated by RasterCacheKeyID and matrix is marked as encountered by the current frame. The entry will be created if it does not exist. Optionally the entry will be marked as visible in the current frame if the caller determines that it intersects the cull rect. The access_count of the entry will be increased if it is visible, or if it was ever visible.
Definition at line 144 of file raster_cache.cc.
|
inline |
Definition at line 171 of file raster_cache.h.
std::unique_ptr< RasterCacheResult > flutter::RasterCache::Rasterize | ( | const RasterCache::Context & | context, |
sk_sp< const DlRTree > | rtree, | ||
const std::function< void(DlCanvas *)> & | draw_function, | ||
const std::function< void(DlCanvas *, const SkRect &rect)> & | draw_checkerboard | ||
) | const |
Definition at line 79 of file raster_cache.cc.
bool flutter::RasterCache::UpdateCacheEntry | ( | const RasterCacheKeyID & | id, |
const Context & | raster_cache_context, | ||
const std::function< void(DlCanvas *)> & | render_function, | ||
sk_sp< const DlRTree > | rtree = nullptr |
||
) | const |
Definition at line 118 of file raster_cache.cc.
|
friend |
Definition at line 272 of file raster_cache.h.
|
friend |
Definition at line 271 of file raster_cache.h.