Flutter Engine
The Flutter Engine
cacheable_layer.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/flow/layers/cacheable_layer.h"
6
7namespace flutter {
8
10 PrerollContext* context,
11 const SkMatrix& matrix)
12 : raster_cache_item_(raster_cache_item),
13 context_(context),
14 matrix_(matrix) {
15#if !SLIMPELLER
16 if (IsCacheEnabled()) {
17 raster_cache_item->PrerollSetup(context, matrix);
18 }
19#endif // !SLIMPELLER
20}
21
22bool AutoCache::IsCacheEnabled() {
23#if SLIMPELLER
24 return false;
25#else // SLIMPELLER
26 return raster_cache_item_ && context_ && context_->raster_cache;
27#endif // SLIMPELLER
28}
29
31#if !SLIMPELLER
32 if (IsCacheEnabled()) {
33 raster_cache_item_->PrerollFinalize(context_, matrix_);
34 }
35#endif // !SLIMPELLER
36}
37
39 bool can_cache_children) {
40#if !SLIMPELLER
42 this, layer_cached_threshold, can_cache_children);
43#endif // !SLIMPELLER
44}
45
46} // namespace flutter
AutoCache(RasterCacheItem *raster_cache_item, PrerollContext *context, const SkMatrix &matrix)
CacheableContainerLayer(int layer_cached_threshold=RasterCacheUtil::kMinimumRendersBeforeCachingFilterLayer, bool can_cache_children=false)
std::unique_ptr< LayerRasterCacheItem > layer_raster_cache_item_
static std::unique_ptr< LayerRasterCacheItem > Make(Layer *, int layer_cache_threshold, bool can_cache_children=false)
Create a LayerRasterCacheItem, connect a layer and manage the Layer's raster cache.
virtual void PrerollFinalize(PrerollContext *context, const SkMatrix &matrix)=0
virtual void PrerollSetup(PrerollContext *context, const SkMatrix &matrix)=0
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258