Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | b4db937 | 2011-10-24 14:44:19 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 116302fc | 2012-05-05 21:45:41 | [diff] [blame] | 5 | #ifndef UI_COMPOSITOR_LAYER_ANIMATION_DELEGATE_H_ |
| 6 | #define UI_COMPOSITOR_LAYER_ANIMATION_DELEGATE_H_ |
[email protected] | b4db937 | 2011-10-24 14:44:19 | [diff] [blame] | 7 | |
Arthur Sonzogni | 3eb9fd51 | 2024-02-09 12:20:43 | [diff] [blame] | 8 | #include <optional> |
| 9 | |
[email protected] | e81480f1f | 2012-10-11 23:06:45 | [diff] [blame] | 10 | #include "third_party/skia/include/core/SkColor.h" |
[email protected] | 116302fc | 2012-05-05 21:45:41 | [diff] [blame] | 11 | #include "ui/compositor/compositor_export.h" |
Francois Doray | 91e63fb7 | 2017-11-08 14:21:52 | [diff] [blame] | 12 | #include "ui/compositor/property_change_reason.h" |
Sasha McIntosh | 93a0e96 | 2022-03-31 20:02:41 | [diff] [blame] | 13 | #include "ui/gfx/geometry/linear_gradient.h" |
tfarina | 3b0452d | 2014-12-31 15:20:09 | [diff] [blame] | 14 | #include "ui/gfx/geometry/rect.h" |
Jun Mukai | a343db33b | 2019-07-17 23:25:50 | [diff] [blame] | 15 | #include "ui/gfx/geometry/rounded_corners_f.h" |
Xianzhu Wang | 65ef1ad3 | 2021-10-07 03:12:33 | [diff] [blame] | 16 | #include "ui/gfx/geometry/transform.h" |
[email protected] | b4db937 | 2011-10-24 14:44:19 | [diff] [blame] | 17 | |
loyso | 1fbd9f9 | 2015-12-17 07:43:13 | [diff] [blame] | 18 | namespace cc { |
| 19 | class Layer; |
| 20 | } |
| 21 | |
[email protected] | b4db937 | 2011-10-24 14:44:19 | [diff] [blame] | 22 | namespace ui { |
| 23 | |
wutao | 52217d1 | 2017-08-18 02:40:31 | [diff] [blame] | 24 | class Layer; |
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 25 | class LayerAnimatorCollection; |
loyso | 1fe980f | 2016-01-18 23:58:15 | [diff] [blame] | 26 | class LayerThreadedAnimationDelegate; |
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 27 | |
[email protected] | fe7074c6 | 2011-10-28 15:22:54 | [diff] [blame] | 28 | // Layer animations interact with the layers using this interface. |
[email protected] | b4db937 | 2011-10-24 14:44:19 | [diff] [blame] | 29 | class COMPOSITOR_EXPORT LayerAnimationDelegate { |
| 30 | public: |
Francois Doray | 91e63fb7 | 2017-11-08 14:21:52 | [diff] [blame] | 31 | virtual void SetBoundsFromAnimation(const gfx::Rect& bounds, |
| 32 | PropertyChangeReason reason) = 0; |
| 33 | virtual void SetTransformFromAnimation(const gfx::Transform& transform, |
| 34 | PropertyChangeReason reason) = 0; |
| 35 | virtual void SetOpacityFromAnimation(float opacity, |
| 36 | PropertyChangeReason reason) = 0; |
| 37 | virtual void SetVisibilityFromAnimation(bool visibility, |
| 38 | PropertyChangeReason reason) = 0; |
| 39 | virtual void SetBrightnessFromAnimation(float brightnes, |
| 40 | PropertyChangeReason reasons) = 0; |
| 41 | virtual void SetGrayscaleFromAnimation(float grayscale, |
| 42 | PropertyChangeReason reason) = 0; |
Zoraiz Naeem | 3abbe3d | 2024-12-06 00:06:59 | [diff] [blame] | 43 | virtual void SetColorFromAnimation(SkColor4f color, |
Francois Doray | 91e63fb7 | 2017-11-08 14:21:52 | [diff] [blame] | 44 | PropertyChangeReason reason) = 0; |
Malay Keshav | b8ac9e57 | 2019-07-03 00:26:55 | [diff] [blame] | 45 | virtual void SetClipRectFromAnimation(const gfx::Rect& clip_rect, |
| 46 | PropertyChangeReason reason) = 0; |
Jun Mukai | a343db33b | 2019-07-17 23:25:50 | [diff] [blame] | 47 | virtual void SetRoundedCornersFromAnimation( |
| 48 | const gfx::RoundedCornersF& rounded_corners, |
| 49 | PropertyChangeReason reason) = 0; |
Sasha McIntosh | 93a0e96 | 2022-03-31 20:02:41 | [diff] [blame] | 50 | virtual void SetGradientMaskFromAnimation( |
| 51 | const gfx::LinearGradient& gradient_mask, |
| 52 | PropertyChangeReason reason) = 0; |
[email protected] | b4db937 | 2011-10-24 14:44:19 | [diff] [blame] | 53 | virtual void ScheduleDrawForAnimation() = 0; |
| 54 | virtual const gfx::Rect& GetBoundsForAnimation() const = 0; |
[email protected] | 712f4b64 | 2013-03-14 07:09:15 | [diff] [blame] | 55 | virtual gfx::Transform GetTransformForAnimation() const = 0; |
[email protected] | b4db937 | 2011-10-24 14:44:19 | [diff] [blame] | 56 | virtual float GetOpacityForAnimation() const = 0; |
[email protected] | a67935f | 2012-02-10 14:26:24 | [diff] [blame] | 57 | virtual bool GetVisibilityForAnimation() const = 0; |
[email protected] | 815d0c38 | 2012-07-21 08:13:44 | [diff] [blame] | 58 | virtual float GetBrightnessForAnimation() const = 0; |
| 59 | virtual float GetGrayscaleForAnimation() const = 0; |
Zoraiz Naeem | 3abbe3d | 2024-12-06 00:06:59 | [diff] [blame] | 60 | virtual SkColor4f GetColorForAnimation() const = 0; |
Malay Keshav | b8ac9e57 | 2019-07-03 00:26:55 | [diff] [blame] | 61 | virtual gfx::Rect GetClipRectForAnimation() const = 0; |
Jun Mukai | a343db33b | 2019-07-17 23:25:50 | [diff] [blame] | 62 | virtual gfx::RoundedCornersF GetRoundedCornersForAnimation() const = 0; |
Sasha McIntosh | 2270a62 | 2022-06-27 21:19:31 | [diff] [blame] | 63 | virtual const gfx::LinearGradient& GetGradientMaskForAnimation() const = 0; |
[email protected] | 712f4b64 | 2013-03-14 07:09:15 | [diff] [blame] | 64 | virtual float GetDeviceScaleFactor() const = 0; |
wutao | 52217d1 | 2017-08-18 02:40:31 | [diff] [blame] | 65 | virtual ui::Layer* GetLayer() = 0; |
loyso | 1fbd9f9 | 2015-12-17 07:43:13 | [diff] [blame] | 66 | virtual cc::Layer* GetCcLayer() const = 0; |
loyso | 84122900 | 2015-12-21 10:03:24 | [diff] [blame] | 67 | virtual LayerAnimatorCollection* GetLayerAnimatorCollection() = 0; |
loyso | 1fe980f | 2016-01-18 23:58:15 | [diff] [blame] | 68 | virtual LayerThreadedAnimationDelegate* GetThreadedAnimationDelegate() = 0; |
varkha | 62ba671d | 2017-01-25 19:09:46 | [diff] [blame] | 69 | virtual float GetRefreshRate() const = 0; |
loyso | 84122900 | 2015-12-21 10:03:24 | [diff] [blame] | 70 | |
[email protected] | b4db937 | 2011-10-24 14:44:19 | [diff] [blame] | 71 | protected: |
| 72 | virtual ~LayerAnimationDelegate() {} |
| 73 | }; |
| 74 | |
| 75 | } // namespace ui |
| 76 | |
[email protected] | 116302fc | 2012-05-05 21:45:41 | [diff] [blame] | 77 | #endif // UI_COMPOSITOR_LAYER_ANIMATION_DELEGATE_H_ |