MCPcopy Create free account
hub / github.com/Tencent/libpag / GetMaxScale

Function GetMaxScale

src/rendering/caches/TextContentCache.cpp:50–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50static float GetMaxScale(std::vector<TextAnimator*>* animators) {
51 if (animators == nullptr) {
52 return 1.0f;
53 }
54 float scale = 1.0f;
55 for (auto* animator : *animators) {
56 Property<Point>* scaleProperty = nullptr;
57 if (animator->typographyProperties) {
58 scaleProperty = animator->typographyProperties->scale;
59 }
60 if (scaleProperty == nullptr) {
61 continue;
62 }
63 if (scaleProperty->animatable()) {
64 auto animatableProperty = static_cast<AnimatableProperty<Point>*>(scaleProperty);
65 auto value = animatableProperty->keyframes[0]->startValue;
66 float maxScale = std::max(1.f, std::max(value.x, value.y));
67 for (const auto& keyframe : animatableProperty->keyframes) {
68 value = keyframe->endValue;
69 maxScale = std::max(maxScale, std::max(value.x, value.y));
70 }
71 scale *= maxScale;
72 } else {
73 auto value = scaleProperty->value;
74 scale *= std::max(1.f, std::max(value.x, value.y));
75 }
76 }
77 return scale;
78}
79
80void TextContentCache::initTextGlyphs(const std::vector<std::vector<GlyphHandle>>* glyphLines) {
81 auto scale = GetMaxScale(animators);

Callers 1

initTextGlyphsMethod · 0.85

Calls 1

animatableMethod · 0.45

Tested by

no test coverage detected