Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
FontArguments.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2
4
7 return a.axis == b.axis && a.value == b.value;
8}
9
12 return a.index == b.index && a.color == b.color;
13}
14
15namespace std {
16
17size_t hash<skia::textlayout::FontArguments>::operator()(const skia::textlayout::FontArguments& args) const {
18 size_t hash = 0;
19 hash ^= std::hash<int>()(args.fCollectionIndex);
20 for (const auto& coord : args.fCoordinates) {
21 hash ^= std::hash<SkFourByteTag>()(coord.axis);
22 hash ^= std::hash<float>()(coord.value);
23 }
24 hash ^= std::hash<int>()(args.fPaletteIndex);
25 for (const auto& override : args.fPaletteOverrides) {
26 hash ^= std::hash<int>()(override.index);
27 hash ^= std::hash<SkColor>()(override.color);
28 }
29 return hash;
30}
31
32} // namespace std
33
34namespace skia {
35namespace textlayout {
36
37FontArguments::FontArguments(const SkFontArguments& args)
38 : fCollectionIndex(args.getCollectionIndex()),
39 fCoordinates(args.getVariationDesignPosition().coordinates,
40 args.getVariationDesignPosition().coordinates +
41 args.getVariationDesignPosition().coordinateCount),
42 fPaletteIndex(args.getPalette().index),
43 fPaletteOverrides(args.getPalette().overrides,
44 args.getPalette().overrides +
45 args.getPalette().overrideCount) {}
46
48 return a.fCollectionIndex == b.fCollectionIndex &&
49 a.fCoordinates == b.fCoordinates &&
50 a.fPaletteIndex == b.fPaletteIndex &&
51 a.fPaletteOverrides == b.fPaletteOverrides;
52}
53
57
60 fCoordinates.data(),
61 static_cast<int>(fCoordinates.size())
62 };
63
65 fPaletteIndex,
66 fPaletteOverrides.data(),
67 static_cast<int>(fPaletteOverrides.size())
68 };
69
71 args.setCollectionIndex(fCollectionIndex);
73 args.setPalette(palette);
74
75 return typeface->makeClone(args);
76}
77
78} // namespace textlayout
79} // namespace skia
static bool operator==(const SkFontArguments::VariationPosition::Coordinate &a, const SkFontArguments::VariationPosition::Coordinate &b)
static uint32_t hash(const SkShaderBase::GradientInfo &v)
sk_sp< SkTypeface > CloneTypeface(const sk_sp< SkTypeface > &typeface) const
static bool b
struct MyStruct a[10]
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
bool operator==(const FontArguments &a, const FontArguments &b)
bool operator!=(const skia::textlayout::FontArguments &a, const skia::textlayout::FontArguments &b)
Definition ref_ptr.h:256
SkFontArguments & setCollectionIndex(int collectionIndex)
SkFontArguments & setVariationDesignPosition(VariationPosition position)
SkFontArguments & setPalette(Palette palette)