| OLD | NEW |
| (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/memory/scoped_ptr.h" | |
| 9 #include "content/browser/android/edge_effect_base.h" | |
| 10 | |
| 11 namespace cc { | |
| 12 class Layer; | |
| 13 } | |
| 14 | |
| 15 namespace ui { | |
| 16 class ResourceManager; | |
| 17 } | |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 // |EdgeEffect| mirrors its Android counterpart, EdgeEffect.java. | |
| 22 // Conscious tradeoffs were made to align this as closely as possible with the | |
| 23 // the original Android java version. | |
| 24 // All coordinates and dimensions are in device pixels. | |
| 25 class EdgeEffect : public EdgeEffectBase { | |
| 26 public: | |
| 27 explicit EdgeEffect(ui::ResourceManager* resource_manager, | |
| 28 float device_scale_factor); | |
| 29 ~EdgeEffect() override; | |
| 30 | |
| 31 void Pull(base::TimeTicks current_time, | |
| 32 float delta_distance, | |
| 33 float displacement) override; | |
| 34 void Absorb(base::TimeTicks current_time, float velocity) override; | |
| 35 bool Update(base::TimeTicks current_time) override; | |
| 36 void Release(base::TimeTicks current_time) override; | |
| 37 | |
| 38 void Finish() override; | |
| 39 bool IsFinished() const override; | |
| 40 float GetAlpha() const override; | |
| 41 | |
| 42 void ApplyToLayers(Edge edge, | |
| 43 const gfx::SizeF& viewport_size, | |
| 44 float offset) override; | |
| 45 void SetParent(cc::Layer* parent) override; | |
| 46 | |
| 47 // Thread-safe trigger to load resources. | |
| 48 static void PreloadResources(ui::ResourceManager* resource_manager); | |
| 49 | |
| 50 private: | |
| 51 class EffectLayer; | |
| 52 scoped_ptr<EffectLayer> edge_; | |
| 53 scoped_ptr<EffectLayer> glow_; | |
| 54 | |
| 55 float base_edge_height_; | |
| 56 float base_glow_height_; | |
| 57 | |
| 58 float edge_alpha_; | |
| 59 float edge_scale_y_; | |
| 60 float glow_alpha_; | |
| 61 float glow_scale_y_; | |
| 62 | |
| 63 float edge_alpha_start_; | |
| 64 float edge_alpha_finish_; | |
| 65 float edge_scale_y_start_; | |
| 66 float edge_scale_y_finish_; | |
| 67 float glow_alpha_start_; | |
| 68 float glow_alpha_finish_; | |
| 69 float glow_scale_y_start_; | |
| 70 float glow_scale_y_finish_; | |
| 71 | |
| 72 base::TimeTicks start_time_; | |
| 73 base::TimeDelta duration_; | |
| 74 | |
| 75 State state_; | |
| 76 | |
| 77 float pull_distance_; | |
| 78 | |
| 79 DISALLOW_COPY_AND_ASSIGN(EdgeEffect); | |
| 80 }; | |
| 81 | |
| 82 } // namespace content | |
| 83 | |
| 84 #endif // CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_ | |
| OLD | NEW |