Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 (IsCacheEnabled()) {
16 raster_cache_item->PrerollSetup(context, matrix);
17 }
18}
19
20bool AutoCache::IsCacheEnabled() {
21 return raster_cache_item_ && context_ && context_->raster_cache;
22}
23
25 if (IsCacheEnabled()) {
26 raster_cache_item_->PrerollFinalize(context_, matrix_);
27 }
28}
29
31 bool can_cache_children) {
33 this, layer_cached_threshold, can_cache_children);
34}
35
36} // 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
RasterCache * raster_cache
Definition layer.h:55