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

Side by Side Diff: content/browser/android/edge_effect.h

Issue 14268004: Add overscroll edge effect animations for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use vsync ticks to drive overscroll animation Created 7 years, 8 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_
6 #define CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/time.h"
11 #include "ui/gfx/size_f.h"
12
13 namespace cc {
14 class Layer;
15 }
16
17 namespace gfx {
18 class SizeF;
19 class Size;
aelias_OOO_until_Jul13 2013/04/22 23:46:48 Delete these two forward declarations
jdduke (slow) 2013/04/23 16:02:13 Done.
20 }
21
22 namespace content {
23
24 /* |EdgeEffect| mirrors its Android counterpart, EdgeEffect.java.
25 * The primary difference is ownership; the Android version manages render
26 * resources directly, while this version simply applies the effect to
27 * existing resources. Conscious tradeoffs were made to align this as closely
28 * as possible with the original Android java version.
29 */
30 class EdgeEffect {
31 public:
32 enum Edge {
33 EDGE_TOP = 0,
34 EDGE_LEFT,
35 EDGE_BOTTOM,
36 EDGE_RIGHT,
37 EDGE_COUNT
38 };
39
40 EdgeEffect(scoped_refptr<cc::Layer> edge, scoped_refptr<cc::Layer> glow);
41 ~EdgeEffect();
42
43 void Pull(base::TimeTicks current_time, float delta_distance);
44 void Absorb(base::TimeTicks current_time, float velocity);
45 bool Update(base::TimeTicks current_time);
46 void Release(base::TimeTicks current_time);
47
48 void Finish();
49 bool IsFinished() const;
50
51 void Draw(cc::Layer* parent_layer, const gfx::SizeF& size, Edge edge);
aelias_OOO_until_Jul13 2013/04/22 23:46:48 Nit: just gfx::SizeF
jdduke (slow) 2013/04/23 16:02:13 Done.
52
53 private:
54
55 enum State {
56 STATE_IDLE = 0,
57 STATE_PULL,
58 STATE_ABSORB,
59 STATE_RECEDE,
60 STATE_PULL_DECAY
61 };
62
63 void Attach(cc::Layer* parent_layer);
64 void Detach();
65 int CurrentAttachmentDepth() const;
66
67 scoped_refptr<cc::Layer> edge_;
68 scoped_refptr<cc::Layer> glow_;
69
70 float edge_alpha_;
71 float edge_scale_y_;
72 float glow_alpha_;
73 float glow_scale_y_;
74
75 float edge_alpha_start_;
76 float edge_alpha_finish_;
77 float edge_scale_y_start_;
78 float edge_scale_y_finish_;
79 float glow_alpha_start_;
80 float glow_alpha_finish_;
81 float glow_scale_y_start_;
82 float glow_scale_y_finish_;
83
84 base::TimeTicks start_time_;
85 base::TimeDelta duration_;
86
87 State state_;
88
89 float pull_distance_;
90
91 int base_attachment_depth_;
92
93 DISALLOW_COPY_AND_ASSIGN(EdgeEffect);
94 };
95
96 } // namespace content
97
98 #endif // CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/edge_effect.cc » ('j') | content/browser/android/edge_effect.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698