5#ifndef FLUTTER_FLOW_RASTER_CACHE_KEY_H_
6#define FLUTTER_FLOW_RASTER_CACHE_KEY_H_
11#include <unordered_map>
18#include "third_party/skia/include/core/SkMatrix.h"
43 const std::vector<RasterCacheKeyID>&
child_ids()
const {
return child_ids_; }
50 return cached_hash_.value();
55 for (
auto& child_id : child_ids_) {
63 return unique_id_ == other.unique_id_ && type_ == other.type_ &&
68 const uint64_t unique_id_;
70 const std::vector<RasterCacheKeyID> child_ids_;
71 mutable std::optional<std::size_t> cached_hash_;
84 : id_(
std::move(
id)), matrix_(ctm) {
85 matrix_[SkMatrix::kMTransX] = 0;
86 matrix_[SkMatrix::kMTransY] = 0;
90 const SkMatrix&
matrix()
const {
return matrix_; }
104 return key.id_.GetHash();
111 return lhs.id_ == rhs.id_ && lhs.matrix_ == rhs.matrix_;
115 template <
class Value>
116 using Map = std::unordered_map<RasterCacheKey, Value, Hash, Equal>;
const RasterCacheKeyID & id() const
const SkMatrix & matrix() const
std::unordered_map< RasterCacheKey, Value, Hash, Equal > Map
RasterCacheKey(RasterCacheKeyID id, const SkMatrix &ctm)
RasterCacheKeyKind kind() const
RasterCacheKey(uint64_t unique_id, RasterCacheKeyType type, const SkMatrix &ctm)
static constexpr uint64_t kDefaultUniqueID
bool operator==(const RasterCacheKeyID &other) const
RasterCacheKeyID(std::vector< RasterCacheKeyID > child_ids, RasterCacheKeyType type)
const std::vector< RasterCacheKeyID > & child_ids() const
RasterCacheKeyType type() const
RasterCacheKeyID(uint64_t unique_id, RasterCacheKeyType type)
std::size_t GetHash() const
uint64_t unique_id() const
static std::optional< std::vector< RasterCacheKeyID > > LayerChildrenIds(const Layer *layer)
constexpr std::size_t HashCombine()
constexpr void HashCombineSeed(std::size_t &seed, const Type &arg)
constexpr bool operator()(const RasterCacheKey &lhs, const RasterCacheKey &rhs) const
std::size_t operator()(RasterCacheKey const &key) const