Flutter Engine
The Flutter Engine
raster_cache_key.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#if !SLIMPELLER
6
7#include "flutter/flow/raster_cache_key.h"
8#include <optional>
9#include "flutter/flow/layers/container_layer.h"
10#include "flutter/flow/layers/display_list_layer.h"
11#include "flutter/flow/layers/layer.h"
12
13namespace flutter {
14
15std::optional<std::vector<RasterCacheKeyID>> RasterCacheKeyID::LayerChildrenIds(
16 const Layer* layer) {
18 auto& children_layers = layer->as_container_layer()->layers();
19 auto children_count = children_layers.size();
20 if (children_count == 0) {
21 return std::nullopt;
22 }
23 std::vector<RasterCacheKeyID> ids;
25 children_layers.begin(), children_layers.end(), std::back_inserter(ids),
26 [](auto& layer) -> RasterCacheKeyID { return layer->caching_key_id(); });
27 return ids;
28}
29
30} // namespace flutter
31
32#endif // !SLIMPELLER
const std::vector< std::shared_ptr< Layer > > & layers() const
virtual const ContainerLayer * as_container_layer() const
Definition: layer.h:258
static std::optional< std::vector< RasterCacheKeyID > > LayerChildrenIds(const Layer *layer)
#define FML_DCHECK(condition)
Definition: logging.h:103
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47