Flutter Engine
The Flutter Engine
cacheable_layer.h
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#ifndef FLUTTER_FLOW_LAYERS_CACHEABLE_LAYER_H_
6#define FLUTTER_FLOW_LAYERS_CACHEABLE_LAYER_H_
7
8#include <memory>
9
10#include "flutter/flow/layers/container_layer.h"
11#include "flutter/flow/layers/layer_raster_cache_item.h"
12#include "flutter/flow/raster_cache_util.h"
13
14namespace flutter {
15
16class AutoCache {
17 public:
18 AutoCache(RasterCacheItem* raster_cache_item,
19 PrerollContext* context,
20 const SkMatrix& matrix);
21
22 void ShouldNotBeCached() { raster_cache_item_ = nullptr; }
23
24 ~AutoCache();
25
26 private:
27 inline bool IsCacheEnabled();
28 RasterCacheItem* raster_cache_item_ = nullptr;
29 [[maybe_unused]] PrerollContext* context_ = nullptr;
30 const SkMatrix matrix_;
31};
32
34 public:
36 int layer_cached_threshold =
38 bool can_cache_children = false);
39
40#if !SLIMPELLER
42 return layer_raster_cache_item_.get();
43 }
44
45 protected:
46 std::unique_ptr<LayerRasterCacheItem> layer_raster_cache_item_;
47#endif // !SLIMPELLER
48};
49
50} // namespace flutter
51
52#endif // FLUTTER_FLOW_LAYERS_CACHEABLE_LAYER_H_
AutoCache(RasterCacheItem *raster_cache_item, PrerollContext *context, const SkMatrix &matrix)
CacheableContainerLayer(int layer_cached_threshold=RasterCacheUtil::kMinimumRendersBeforeCachingFilterLayer, bool can_cache_children=false)
const LayerRasterCacheItem * raster_cache_item() const
std::unique_ptr< LayerRasterCacheItem > layer_raster_cache_item_
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
static constexpr int kMinimumRendersBeforeCachingFilterLayer