| 48 | } |
| 49 | |
| 50 | static 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 | |
| 80 | void TextContentCache::initTextGlyphs(const std::vector<std::vector<GlyphHandle>>* glyphLines) { |
| 81 | auto scale = GetMaxScale(animators); |
no test coverage detected