• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 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 #include "cc/animation/animation_curve.h"
6 
7 #include "base/logging.h"
8 #include "cc/animation/scroll_offset_animation_curve.h"
9 
10 namespace cc {
11 
ToColorAnimationCurve() const12 const ColorAnimationCurve* AnimationCurve::ToColorAnimationCurve() const {
13   DCHECK(Type() == AnimationCurve::Color);
14   return static_cast<const ColorAnimationCurve*>(this);
15 }
16 
Type() const17 AnimationCurve::CurveType ColorAnimationCurve::Type() const { return Color; }
18 
ToFloatAnimationCurve() const19 const FloatAnimationCurve* AnimationCurve::ToFloatAnimationCurve() const {
20   DCHECK(Type() == AnimationCurve::Float);
21   return static_cast<const FloatAnimationCurve*>(this);
22 }
23 
Type() const24 AnimationCurve::CurveType FloatAnimationCurve::Type() const {
25   return Float;
26 }
27 
ToTransformAnimationCurve() const28 const TransformAnimationCurve* AnimationCurve::ToTransformAnimationCurve()
29     const {
30   DCHECK(Type() == AnimationCurve::Transform);
31   return static_cast<const TransformAnimationCurve*>(this);
32 }
33 
Type() const34 AnimationCurve::CurveType TransformAnimationCurve::Type() const {
35   return Transform;
36 }
37 
ToFilterAnimationCurve() const38 const FilterAnimationCurve* AnimationCurve::ToFilterAnimationCurve() const {
39   DCHECK(Type() == AnimationCurve::Filter);
40   return static_cast<const FilterAnimationCurve*>(this);
41 }
42 
Type() const43 AnimationCurve::CurveType FilterAnimationCurve::Type() const {
44   return Filter;
45 }
46 
ToScrollOffsetAnimationCurve() const47 const ScrollOffsetAnimationCurve* AnimationCurve::ToScrollOffsetAnimationCurve()
48     const {
49   DCHECK(Type() == AnimationCurve::ScrollOffset);
50   return static_cast<const ScrollOffsetAnimationCurve*>(this);
51 }
52 
ToScrollOffsetAnimationCurve()53 ScrollOffsetAnimationCurve* AnimationCurve::ToScrollOffsetAnimationCurve() {
54   DCHECK(Type() == AnimationCurve::ScrollOffset);
55   return static_cast<ScrollOffsetAnimationCurve*>(this);
56 }
57 
58 }  // namespace cc
59