#include "ui/gfx/animation/keyframe/keyframed_animation_curve.h"
#include <stddef.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/numerics/ranges.h"
#include "base/time/time.h"
#include "ui/gfx/animation/keyframe/keyframed_animation_curve-inl.h"
#include "ui/gfx/animation/tween.h"
#include "ui/gfx/geometry/box_f.h"
namespace gfx {
namespace {
static constexpr float kTolerance = …;
template <typename KeyframeType, typename ValueType, typename TargetType>
std::unique_ptr<AnimationCurve> RetargettedCurve(
std::vector<std::unique_ptr<KeyframeType>>& keyframes,
base::TimeDelta t,
const ValueType& value_at_t,
const ValueType& new_target_value,
double scaled_duration,
TargetType* target,
const TimingFunction* timing_function) { … }
}
Keyframe::Keyframe(base::TimeDelta time,
std::unique_ptr<TimingFunction> timing_function)
: … { … }
Keyframe::~Keyframe() = default;
base::TimeDelta Keyframe::Time() const { … }
std::unique_ptr<ColorKeyframe> ColorKeyframe::Create(
base::TimeDelta time,
SkColor value,
std::unique_ptr<TimingFunction> timing_function) { … }
ColorKeyframe::ColorKeyframe(base::TimeDelta time,
SkColor value,
std::unique_ptr<TimingFunction> timing_function)
: … { … }
ColorKeyframe::~ColorKeyframe() = default;
SkColor ColorKeyframe::Value() const { … }
std::unique_ptr<ColorKeyframe> ColorKeyframe::Clone() const { … }
std::unique_ptr<FloatKeyframe> FloatKeyframe::Create(
base::TimeDelta time,
float value,
std::unique_ptr<TimingFunction> timing_function) { … }
FloatKeyframe::FloatKeyframe(base::TimeDelta time,
float value,
std::unique_ptr<TimingFunction> timing_function)
: … { … }
FloatKeyframe::~FloatKeyframe() = default;
float FloatKeyframe::Value() const { … }
std::unique_ptr<FloatKeyframe> FloatKeyframe::Clone() const { … }
std::unique_ptr<TransformKeyframe> TransformKeyframe::Create(
base::TimeDelta time,
const gfx::TransformOperations& value,
std::unique_ptr<TimingFunction> timing_function) { … }
TransformKeyframe::TransformKeyframe(
base::TimeDelta time,
const gfx::TransformOperations& value,
std::unique_ptr<TimingFunction> timing_function)
: … { … }
TransformKeyframe::~TransformKeyframe() = default;
const gfx::TransformOperations& TransformKeyframe::Value() const { … }
std::unique_ptr<TransformKeyframe> TransformKeyframe::Clone() const { … }
std::unique_ptr<SizeKeyframe> SizeKeyframe::Create(
base::TimeDelta time,
const gfx::SizeF& value,
std::unique_ptr<TimingFunction> timing_function) { … }
SizeKeyframe::SizeKeyframe(base::TimeDelta time,
const gfx::SizeF& value,
std::unique_ptr<TimingFunction> timing_function)
: … { … }
SizeKeyframe::~SizeKeyframe() = default;
const gfx::SizeF& SizeKeyframe::Value() const { … }
std::unique_ptr<SizeKeyframe> SizeKeyframe::Clone() const { … }
std::unique_ptr<RectKeyframe> RectKeyframe::Create(
base::TimeDelta time,
const gfx::Rect& value,
std::unique_ptr<TimingFunction> timing_function) { … }
RectKeyframe::RectKeyframe(base::TimeDelta time,
const gfx::Rect& value,
std::unique_ptr<TimingFunction> timing_function)
: … { … }
RectKeyframe::~RectKeyframe() = default;
const gfx::Rect& RectKeyframe::Value() const { … }
std::unique_ptr<RectKeyframe> RectKeyframe::Clone() const { … }
std::unique_ptr<KeyframedColorAnimationCurve>
KeyframedColorAnimationCurve::Create() { … }
KeyframedColorAnimationCurve::KeyframedColorAnimationCurve()
: … { … }
KeyframedColorAnimationCurve::~KeyframedColorAnimationCurve() = default;
void KeyframedColorAnimationCurve::AddKeyframe(
std::unique_ptr<ColorKeyframe> keyframe) { … }
base::TimeDelta KeyframedColorAnimationCurve::Duration() const { … }
base::TimeDelta KeyframedColorAnimationCurve::TickInterval() const { … }
std::unique_ptr<AnimationCurve> KeyframedColorAnimationCurve::Clone() const { … }
SkColor KeyframedColorAnimationCurve::GetValue(base::TimeDelta t) const { … }
SkColor KeyframedColorAnimationCurve::GetTransformedValue(
base::TimeDelta t,
gfx::TimingFunction::LimitDirection limit_direction) const { … }
std::unique_ptr<AnimationCurve> KeyframedColorAnimationCurve::Retarget(
base::TimeDelta t,
SkColor new_target) { … }
std::unique_ptr<KeyframedFloatAnimationCurve>
KeyframedFloatAnimationCurve::Create() { … }
KeyframedFloatAnimationCurve::KeyframedFloatAnimationCurve()
: … { … }
KeyframedFloatAnimationCurve::~KeyframedFloatAnimationCurve() = default;
void KeyframedFloatAnimationCurve::AddKeyframe(
std::unique_ptr<FloatKeyframe> keyframe) { … }
base::TimeDelta KeyframedFloatAnimationCurve::Duration() const { … }
base::TimeDelta KeyframedFloatAnimationCurve::TickInterval() const { … }
std::unique_ptr<AnimationCurve> KeyframedFloatAnimationCurve::Clone() const { … }
std::unique_ptr<AnimationCurve> KeyframedFloatAnimationCurve::Retarget(
base::TimeDelta t,
float new_target) { … }
float KeyframedFloatAnimationCurve::GetValue(base::TimeDelta t) const { … }
float KeyframedFloatAnimationCurve::GetTransformedValue(
base::TimeDelta t,
gfx::TimingFunction::LimitDirection limit_direction) const { … }
std::unique_ptr<KeyframedTransformAnimationCurve>
KeyframedTransformAnimationCurve::Create() { … }
KeyframedTransformAnimationCurve::KeyframedTransformAnimationCurve()
: … { … }
KeyframedTransformAnimationCurve::~KeyframedTransformAnimationCurve() = default;
void KeyframedTransformAnimationCurve::AddKeyframe(
std::unique_ptr<TransformKeyframe> keyframe) { … }
base::TimeDelta KeyframedTransformAnimationCurve::Duration() const { … }
base::TimeDelta KeyframedTransformAnimationCurve::TickInterval() const { … }
std::unique_ptr<AnimationCurve> KeyframedTransformAnimationCurve::Clone()
const { … }
gfx::TransformOperations KeyframedTransformAnimationCurve::GetValue(
base::TimeDelta t) const { … }
gfx::TransformOperations KeyframedTransformAnimationCurve::GetTransformedValue(
base::TimeDelta t,
gfx::TimingFunction::LimitDirection limit_direction) const { … }
bool KeyframedTransformAnimationCurve::PreservesAxisAlignment() const { … }
bool KeyframedTransformAnimationCurve::MaximumScale(float* max_scale) const { … }
std::unique_ptr<AnimationCurve> KeyframedTransformAnimationCurve::Retarget(
base::TimeDelta t,
const gfx::TransformOperations& new_target) { … }
std::unique_ptr<KeyframedSizeAnimationCurve>
KeyframedSizeAnimationCurve::Create() { … }
KeyframedSizeAnimationCurve::KeyframedSizeAnimationCurve()
: … { … }
KeyframedSizeAnimationCurve::~KeyframedSizeAnimationCurve() = default;
void KeyframedSizeAnimationCurve::AddKeyframe(
std::unique_ptr<SizeKeyframe> keyframe) { … }
base::TimeDelta KeyframedSizeAnimationCurve::Duration() const { … }
base::TimeDelta KeyframedSizeAnimationCurve::TickInterval() const { … }
std::unique_ptr<AnimationCurve> KeyframedSizeAnimationCurve::Clone() const { … }
gfx::SizeF KeyframedSizeAnimationCurve::GetValue(base::TimeDelta t) const { … }
gfx::SizeF KeyframedSizeAnimationCurve::GetTransformedValue(
base::TimeDelta t,
gfx::TimingFunction::LimitDirection limit_direction) const { … }
std::unique_ptr<AnimationCurve> KeyframedSizeAnimationCurve::Retarget(
base::TimeDelta t,
const gfx::SizeF& new_target) { … }
std::unique_ptr<KeyframedRectAnimationCurve>
KeyframedRectAnimationCurve::Create() { … }
KeyframedRectAnimationCurve::KeyframedRectAnimationCurve()
: … { … }
KeyframedRectAnimationCurve::~KeyframedRectAnimationCurve() = default;
void KeyframedRectAnimationCurve::AddKeyframe(
std::unique_ptr<RectKeyframe> keyframe) { … }
base::TimeDelta KeyframedRectAnimationCurve::Duration() const { … }
base::TimeDelta KeyframedRectAnimationCurve::TickInterval() const { … }
std::unique_ptr<AnimationCurve> KeyframedRectAnimationCurve::Clone() const { … }
gfx::Rect KeyframedRectAnimationCurve::GetValue(base::TimeDelta t) const { … }
gfx::Rect KeyframedRectAnimationCurve::GetTransformedValue(
base::TimeDelta t,
gfx::TimingFunction::LimitDirection limit_direction) const { … }
std::unique_ptr<AnimationCurve> KeyframedRectAnimationCurve::Retarget(
base::TimeDelta t,
const gfx::Rect& new_target) { … }
bool SufficientlyEqual(float lhs, float rhs) { … }
bool SufficientlyEqual(const TransformOperations& lhs,
const TransformOperations& rhs) { … }
bool SufficientlyEqual(const SizeF& lhs, const SizeF& rhs) { … }
bool SufficientlyEqual(SkColor lhs, SkColor rhs) { … }
bool SufficientlyEqual(const Rect& lhs, const Rect& rhs) { … }
}