Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: third_party/WebKit/Source/core/animation/IntegerSVGInterpolation.h

Issue 1406393006: Web Animations: Migrate SVG integer interpolation to interpolation types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IntegerSVGInterpolation_h
6 #define IntegerSVGInterpolation_h
7
8 #include "core/animation/SVGInterpolation.h"
9 #include "core/svg/SVGInteger.h"
10
11 namespace blink {
12
13 class IntegerSVGInterpolation : public SVGInterpolation {
14 public:
15 static PassRefPtr<IntegerSVGInterpolation> create(SVGPropertyBase* start, SV GPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute)
16 {
17 return adoptRef(new IntegerSVGInterpolation(toInterpolableValue(start), toInterpolableValue(end), attribute));
18 }
19
20 PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement&) const final
21 {
22 return fromInterpolableValue(*m_cachedValue);
23 }
24
25 private:
26 IntegerSVGInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Inte rpolableValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute)
27 : SVGInterpolation(start, end, attribute)
28 {
29 }
30
31 static PassOwnPtr<InterpolableValue> toInterpolableValue(SVGPropertyBase* va lue)
32 {
33 return InterpolableNumber::create(toSVGInteger(value)->value());
34 }
35
36 static PassRefPtrWillBeRawPtr<SVGInteger> fromInterpolableValue(const Interp olableValue& value)
37 {
38 return SVGInteger::create(clampTo<int>(roundf(toInterpolableNumber(value ).value())));
39 }
40 };
41
42 }
43
44 #endif // IntegerSVGInterpolation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698