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.
5 #ifndef CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_
6 #define CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h"
11 #include "ui/gfx/size_f.h"
19 /* |EdgeEffect| mirrors its Android counterpart, EdgeEffect.java.
20 * The primary difference is ownership; the Android version manages render
21 * resources directly, while this version simply applies the effect to
22 * existing resources. Conscious tradeoffs were made to align this as closely
23 * as possible with the original Android java version.
24 * All coordinates and dimensions are in device pixels.
36 EdgeEffect(scoped_refptr
<cc::Layer
> edge
, scoped_refptr
<cc::Layer
> glow
);
39 void Pull(base::TimeTicks current_time
, float delta_distance
);
40 void Absorb(base::TimeTicks current_time
, float velocity
);
41 bool Update(base::TimeTicks current_time
);
42 void Release(base::TimeTicks current_time
);
45 bool IsFinished() const;
47 void ApplyToLayers(gfx::SizeF window_size
,
63 scoped_refptr
<cc::Layer
> edge_
;
64 scoped_refptr
<cc::Layer
> glow_
;
71 float edge_alpha_start_
;
72 float edge_alpha_finish_
;
73 float edge_scale_y_start_
;
74 float edge_scale_y_finish_
;
75 float glow_alpha_start_
;
76 float glow_alpha_finish_
;
77 float glow_scale_y_start_
;
78 float glow_scale_y_finish_
;
80 base::TimeTicks start_time_
;
81 base::TimeDelta duration_
;
87 DISALLOW_COPY_AND_ASSIGN(EdgeEffect
);
90 } // namespace content
92 #endif // CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_