OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PointSVGInterpolation_h | 5 #ifndef PointSVGInterpolation_h |
6 #define PointSVGInterpolation_h | 6 #define PointSVGInterpolation_h |
7 | 7 |
8 #include "core/animation/SVGInterpolation.h" | 8 #include "core/animation/SVGInterpolation.h" |
9 #include "core/svg/SVGPointList.h" | 9 #include "core/svg/SVGPointList.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class PointSVGInterpolation { | 13 class PointSVGInterpolation { |
14 public: | 14 public: |
15 typedef SVGPointList ListType; | 15 typedef SVGPointList ListType; |
16 typedef void NonInterpolableType; | 16 typedef void NonInterpolableType; |
17 | 17 |
18 static PassOwnPtrWillBeRawPtr<InterpolableList> toInterpolableValue(SVGPrope
rtyBase* item) | 18 static InterpolableList* toInterpolableValue(SVGPropertyBase* item) |
19 { | 19 { |
20 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2
); | 20 InterpolableList* result = InterpolableList::create(2); |
21 result->set(0, InterpolableNumber::create(toSVGPoint(item)->x())); | 21 result->set(0, InterpolableNumber::create(toSVGPoint(item)->x())); |
22 result->set(1, InterpolableNumber::create(toSVGPoint(item)->y())); | 22 result->set(1, InterpolableNumber::create(toSVGPoint(item)->y())); |
23 return result.release(); | 23 return result; |
24 } | 24 } |
25 | 25 |
26 static PassRefPtrWillBeRawPtr<SVGPoint> fromInterpolableValue(const Interpol
ableValue& value) | 26 static PassRefPtrWillBeRawPtr<SVGPoint> fromInterpolableValue(const Interpol
ableValue& value) |
27 { | 27 { |
28 const InterpolableList& list = toInterpolableList(value); | 28 const InterpolableList& list = toInterpolableList(value); |
29 return SVGPoint::create(FloatPoint( | 29 return SVGPoint::create(FloatPoint( |
30 toInterpolableNumber(list.get(0))->value(), | 30 toInterpolableNumber(list.get(0))->value(), |
31 toInterpolableNumber(list.get(1))->value())); | 31 toInterpolableNumber(list.get(1))->value())); |
32 } | 32 } |
33 }; | 33 }; |
34 | 34 |
35 } | 35 } |
36 | 36 |
37 #endif // PointSVGInterpolation_h | 37 #endif // PointSVGInterpolation_h |
OLD | NEW |