transform_animation_curve_adapter.h revision 3551c9c881056c480085172ff9840cab31610854
1// Copyright (c) 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#ifndef UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_
6#define UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_
7
8#include "base/time/time.h"
9#include "cc/animation/animation_curve.h"
10#include "ui/base/animation/tween.h"
11#include "ui/gfx/transform.h"
12#include "ui/gfx/transform_util.h"
13
14namespace ui {
15
16class TransformAnimationCurveAdapter :public cc::TransformAnimationCurve {
17 public:
18  TransformAnimationCurveAdapter(Tween::Type tween_type,
19                                 gfx::Transform intial_value,
20                                 gfx::Transform target_value,
21                                 base::TimeDelta duration);
22
23  virtual ~TransformAnimationCurveAdapter();
24
25  // TransformAnimationCurve implementation.
26  virtual double Duration() const OVERRIDE;
27  virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
28  virtual gfx::Transform GetValue(double t) const OVERRIDE;
29  virtual bool AnimatedBoundsForBox(const gfx::BoxF& box,
30                                    gfx::BoxF* bounds) const OVERRIDE;
31
32 private:
33  Tween::Type tween_type_;
34  gfx::Transform initial_value_;
35  gfx::Transform target_value_;
36  gfx::DecomposedTransform decomposed_initial_value_;
37  gfx::DecomposedTransform decomposed_target_value_;
38  base::TimeDelta duration_;
39};
40
41}  // namespace ui
42
43#endif  // UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_
44
45