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

Side by Side Diff: cc/input/page_scale_animation.h

Issue 139173004: [#3] Pass gfx structs by const ref (gfx::SizeF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT and fixed build error for Android platform! Created 6 years, 11 months 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
« no previous file with comments | « cc/input/layer_scroll_offset_delegate.h ('k') | cc/input/page_scale_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
11 #include "ui/gfx/vector2d_f.h" 11 #include "ui/gfx/vector2d_f.h"
12 12
13 namespace cc { 13 namespace cc {
14 class TimingFunction; 14 class TimingFunction;
15 15
16 // A small helper class that does the math for zoom animations, primarily for 16 // A small helper class that does the math for zoom animations, primarily for
17 // double-tap zoom. Initialize it with starting and ending scroll/page scale 17 // double-tap zoom. Initialize it with starting and ending scroll/page scale
18 // positions and an animation length time, then call ...AtTime() at every frame 18 // positions and an animation length time, then call ...AtTime() at every frame
19 // to obtain the current interpolated position. The supplied timing function 19 // to obtain the current interpolated position. The supplied timing function
20 // is used to ease the animation. 20 // is used to ease the animation.
21 // 21 //
22 // All sizes and vectors in this class's public methods are in the root scroll 22 // All sizes and vectors in this class's public methods are in the root scroll
23 // layer's coordinate space. 23 // layer's coordinate space.
24 class PageScaleAnimation { 24 class PageScaleAnimation {
25 public: 25 public:
26 // Construct with the state at the beginning of the animation. 26 // Construct with the state at the beginning of the animation.
27 static scoped_ptr<PageScaleAnimation> Create( 27 static scoped_ptr<PageScaleAnimation> Create(
28 gfx::Vector2dF start_scroll_offset, 28 gfx::Vector2dF start_scroll_offset,
29 float start_page_scale_factor, 29 float start_page_scale_factor,
30 gfx::SizeF viewport_size, 30 const gfx::SizeF& viewport_size,
31 gfx::SizeF root_layer_size, 31 const gfx::SizeF& root_layer_size,
32 scoped_ptr<TimingFunction> timing_function); 32 scoped_ptr<TimingFunction> timing_function);
33 33
34 ~PageScaleAnimation(); 34 ~PageScaleAnimation();
35 35
36 // The following methods initialize the animation. Call one of them 36 // The following methods initialize the animation. Call one of them
37 // immediately after construction to set the final scroll and page scale. 37 // immediately after construction to set the final scroll and page scale.
38 38
39 // Zoom while explicitly specifying the top-left scroll position. 39 // Zoom while explicitly specifying the top-left scroll position.
40 void ZoomTo(gfx::Vector2dF target_scroll_offset, 40 void ZoomTo(gfx::Vector2dF target_scroll_offset,
41 float target_page_scale_factor, 41 float target_page_scale_factor,
(...skipping 22 matching lines...) Expand all
64 // course of the animation. 64 // course of the animation.
65 double start_time() const { return start_time_; } 65 double start_time() const { return start_time_; }
66 double duration() const { return duration_; } 66 double duration() const { return duration_; }
67 double end_time() const { return start_time_ + duration_; } 67 double end_time() const { return start_time_ + duration_; }
68 gfx::Vector2dF target_scroll_offset() const { return target_scroll_offset_; } 68 gfx::Vector2dF target_scroll_offset() const { return target_scroll_offset_; }
69 float target_page_scale_factor() const { return target_page_scale_factor_; } 69 float target_page_scale_factor() const { return target_page_scale_factor_; }
70 70
71 protected: 71 protected:
72 PageScaleAnimation(gfx::Vector2dF start_scroll_offset, 72 PageScaleAnimation(gfx::Vector2dF start_scroll_offset,
73 float start_page_scale_factor, 73 float start_page_scale_factor,
74 gfx::SizeF viewport_size, 74 const gfx::SizeF& viewport_size,
75 gfx::SizeF root_layer_size, 75 const gfx::SizeF& root_layer_size,
76 scoped_ptr<TimingFunction> timing_function); 76 scoped_ptr<TimingFunction> timing_function);
77 77
78 private: 78 private:
79 void ClampTargetScrollOffset(); 79 void ClampTargetScrollOffset();
80 void InferTargetScrollOffsetFromStartAnchor(); 80 void InferTargetScrollOffsetFromStartAnchor();
81 void InferTargetAnchorFromScrollOffsets(); 81 void InferTargetAnchorFromScrollOffsets();
82 82
83 gfx::SizeF StartViewportSize() const; 83 gfx::SizeF StartViewportSize() const;
84 gfx::SizeF TargetViewportSize() const; 84 gfx::SizeF TargetViewportSize() const;
85 float InterpAtTime(double time) const; 85 float InterpAtTime(double time) const;
(...skipping 18 matching lines...) Expand all
104 double duration_; 104 double duration_;
105 105
106 scoped_ptr<TimingFunction> timing_function_; 106 scoped_ptr<TimingFunction> timing_function_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(PageScaleAnimation); 108 DISALLOW_COPY_AND_ASSIGN(PageScaleAnimation);
109 }; 109 };
110 110
111 } // namespace cc 111 } // namespace cc
112 112
113 #endif // CC_INPUT_PAGE_SCALE_ANIMATION_H_ 113 #endif // CC_INPUT_PAGE_SCALE_ANIMATION_H_
OLDNEW
« no previous file with comments | « cc/input/layer_scroll_offset_delegate.h ('k') | cc/input/page_scale_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698