summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc
blob: 7fa8e9603e00f84740ae83487766c9b2db19fcba (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
// Copyright 2015 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.

#include "third_party/blink/renderer/core/animation/svg_path_interpolation_type.h"

#include "third_party/blink/renderer/core/animation/path_interpolation_functions.h"
#include "third_party/blink/renderer/core/svg/svg_path.h"
#include "third_party/blink/renderer/platform/heap/heap.h"

namespace blink {

InterpolationValue SVGPathInterpolationType::MaybeConvertSVGValue(
    const SVGPropertyBase& svg_value) const {
  if (svg_value.GetType() != kAnimatedPath)
    return nullptr;

  return PathInterpolationFunctions::ConvertValue(
      To<SVGPath>(svg_value).ByteStream(),
      PathInterpolationFunctions::PreserveCoordinates);
}

InterpolationValue SVGPathInterpolationType::MaybeConvertNeutral(
    const InterpolationValue& underlying,
    ConversionCheckers& conversion_checkers) const {
  return PathInterpolationFunctions::MaybeConvertNeutral(underlying,
                                                         conversion_checkers);
}

PairwiseInterpolationValue SVGPathInterpolationType::MaybeMergeSingles(
    InterpolationValue&& start,
    InterpolationValue&& end) const {
  return PathInterpolationFunctions::MaybeMergeSingles(std::move(start),
                                                       std::move(end));
}

void SVGPathInterpolationType::Composite(
    UnderlyingValueOwner& underlying_value_owner,
    double underlying_fraction,
    const InterpolationValue& value,
    double interpolation_fraction) const {
  PathInterpolationFunctions::Composite(underlying_value_owner,
                                        underlying_fraction, *this, value);
}

SVGPropertyBase* SVGPathInterpolationType::AppliedSVGValue(
    const InterpolableValue& interpolable_value,
    const NonInterpolableValue* non_interpolable_value) const {
  return MakeGarbageCollected<SVGPath>(
      MakeGarbageCollected<cssvalue::CSSPathValue>(
          PathInterpolationFunctions::AppliedValue(interpolable_value,
                                                   non_interpolable_value)));
}

}  // namespace blink