OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_INPUT_PAGE_SCALE_ANIMATION_H_ | 5 #ifndef CC_INPUT_PAGE_SCALE_ANIMATION_H_ |
6 #define CC_INPUT_PAGE_SCALE_ANIMATION_H_ | 6 #define CC_INPUT_PAGE_SCALE_ANIMATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 #include "ui/gfx/geometry/vector2d.h" |
13 #include "ui/gfx/geometry/vector2d_f.h" | 14 #include "ui/gfx/geometry/vector2d_f.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 class TimingFunction; | 18 class TimingFunction; |
18 | 19 |
| 20 // Used in the CC to pass around a scale animation that hasn't yet been |
| 21 // initialized. |
| 22 struct PendingPageScaleAnimation { |
| 23 PendingPageScaleAnimation( |
| 24 const gfx::Vector2d _target_offset, |
| 25 bool _use_anchor, |
| 26 float _scale, |
| 27 const base::TimeDelta& _duration) |
| 28 : target_offset(_target_offset), |
| 29 use_anchor(_use_anchor), |
| 30 scale(_scale), |
| 31 duration(_duration) {} |
| 32 gfx::Vector2d target_offset; |
| 33 bool use_anchor; |
| 34 float scale; |
| 35 base::TimeDelta duration; |
| 36 }; |
| 37 |
19 // A small helper class that does the math for zoom animations, primarily for | 38 // A small helper class that does the math for zoom animations, primarily for |
20 // double-tap zoom. Initialize it with starting and ending scroll/page scale | 39 // double-tap zoom. Initialize it with starting and ending scroll/page scale |
21 // positions and an animation length time, then call ...AtTime() at every frame | 40 // positions and an animation length time, then call ...AtTime() at every frame |
22 // to obtain the current interpolated position. The supplied timing function | 41 // to obtain the current interpolated position. The supplied timing function |
23 // is used to ease the animation. | 42 // is used to ease the animation. |
24 // | 43 // |
25 // All sizes and vectors in this class's public methods are in the root scroll | 44 // All sizes and vectors in this class's public methods are in the root scroll |
26 // layer's coordinate space. | 45 // layer's coordinate space. |
27 class CC_EXPORT PageScaleAnimation { | 46 class CC_EXPORT PageScaleAnimation { |
28 public: | 47 public: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 base::TimeDelta duration_; | 126 base::TimeDelta duration_; |
108 | 127 |
109 scoped_ptr<TimingFunction> timing_function_; | 128 scoped_ptr<TimingFunction> timing_function_; |
110 | 129 |
111 DISALLOW_COPY_AND_ASSIGN(PageScaleAnimation); | 130 DISALLOW_COPY_AND_ASSIGN(PageScaleAnimation); |
112 }; | 131 }; |
113 | 132 |
114 } // namespace cc | 133 } // namespace cc |
115 | 134 |
116 #endif // CC_INPUT_PAGE_SCALE_ANIMATION_H_ | 135 #endif // CC_INPUT_PAGE_SCALE_ANIMATION_H_ |
OLD | NEW |