blob: 389df39c2c8fda87e9afa3b4533bffe94132fe74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_TYPED_INTERPOLATION_VALUE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_TYPED_INTERPOLATION_VALUE_H_
#include <memory>
#include <utility>
#include "base/memory/ptr_util.h"
#include "third_party/blink/renderer/core/animation/interpolation_value.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
class InterpolationType;
// Represents an interpolated value between an adjacent pair of
// PropertySpecificKeyframes.
class TypedInterpolationValue {
USING_FAST_MALLOC(TypedInterpolationValue);
public:
TypedInterpolationValue(
const InterpolationType& type,
std::unique_ptr<InterpolableValue> interpolable_value,
scoped_refptr<NonInterpolableValue> non_interpolable_value = nullptr)
: type_(type),
value_(std::move(interpolable_value),
std::move(non_interpolable_value)) {
DCHECK(value_.interpolable_value);
}
std::unique_ptr<TypedInterpolationValue> Clone() const {
InterpolationValue copy = value_.Clone();
return std::make_unique<TypedInterpolationValue>(
type_, std::move(copy.interpolable_value),
std::move(copy.non_interpolable_value));
}
const InterpolationType& GetType() const { return type_; }
const InterpolableValue& GetInterpolableValue() const {
return *value_.interpolable_value;
}
const NonInterpolableValue* GetNonInterpolableValue() const {
return value_.non_interpolable_value.get();
}
const InterpolationValue& Value() const { return value_; }
InterpolationValue& MutableValue() { return value_; }
private:
const InterpolationType& type_;
InterpolationValue value_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_TYPED_INTERPOLATION_VALUE_H_
|