blob: cb1d1e23b69496f8da8bc5578071b6569a57e01c [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2012 The Chromium Authors
[email protected]b4db9372011-10-24 14:44:192// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]116302fc2012-05-05 21:45:415#ifndef UI_COMPOSITOR_LAYER_ANIMATION_DELEGATE_H_
6#define UI_COMPOSITOR_LAYER_ANIMATION_DELEGATE_H_
[email protected]b4db9372011-10-24 14:44:197
Arthur Sonzogni3eb9fd512024-02-09 12:20:438#include <optional>
9
[email protected]e81480f1f2012-10-11 23:06:4510#include "third_party/skia/include/core/SkColor.h"
[email protected]116302fc2012-05-05 21:45:4111#include "ui/compositor/compositor_export.h"
Francois Doray91e63fb72017-11-08 14:21:5212#include "ui/compositor/property_change_reason.h"
Sasha McIntosh93a0e962022-03-31 20:02:4113#include "ui/gfx/geometry/linear_gradient.h"
tfarina3b0452d2014-12-31 15:20:0914#include "ui/gfx/geometry/rect.h"
Jun Mukaia343db33b2019-07-17 23:25:5015#include "ui/gfx/geometry/rounded_corners_f.h"
Xianzhu Wang65ef1ad32021-10-07 03:12:3316#include "ui/gfx/geometry/transform.h"
[email protected]b4db9372011-10-24 14:44:1917
loyso1fbd9f92015-12-17 07:43:1318namespace cc {
19class Layer;
20}
21
[email protected]b4db9372011-10-24 14:44:1922namespace ui {
23
wutao52217d12017-08-18 02:40:3124class Layer;
[email protected]9034a282014-06-05 03:11:4725class LayerAnimatorCollection;
loyso1fe980f2016-01-18 23:58:1526class LayerThreadedAnimationDelegate;
[email protected]9034a282014-06-05 03:11:4727
[email protected]fe7074c62011-10-28 15:22:5428// Layer animations interact with the layers using this interface.
[email protected]b4db9372011-10-24 14:44:1929class COMPOSITOR_EXPORT LayerAnimationDelegate {
30 public:
Francois Doray91e63fb72017-11-08 14:21:5231 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 Naeem3abbe3d2024-12-06 00:06:5943 virtual void SetColorFromAnimation(SkColor4f color,
Francois Doray91e63fb72017-11-08 14:21:5244 PropertyChangeReason reason) = 0;
Malay Keshavb8ac9e572019-07-03 00:26:5545 virtual void SetClipRectFromAnimation(const gfx::Rect& clip_rect,
46 PropertyChangeReason reason) = 0;
Jun Mukaia343db33b2019-07-17 23:25:5047 virtual void SetRoundedCornersFromAnimation(
48 const gfx::RoundedCornersF& rounded_corners,
49 PropertyChangeReason reason) = 0;
Sasha McIntosh93a0e962022-03-31 20:02:4150 virtual void SetGradientMaskFromAnimation(
51 const gfx::LinearGradient& gradient_mask,
52 PropertyChangeReason reason) = 0;
[email protected]b4db9372011-10-24 14:44:1953 virtual void ScheduleDrawForAnimation() = 0;
54 virtual const gfx::Rect& GetBoundsForAnimation() const = 0;
[email protected]712f4b642013-03-14 07:09:1555 virtual gfx::Transform GetTransformForAnimation() const = 0;
[email protected]b4db9372011-10-24 14:44:1956 virtual float GetOpacityForAnimation() const = 0;
[email protected]a67935f2012-02-10 14:26:2457 virtual bool GetVisibilityForAnimation() const = 0;
[email protected]815d0c382012-07-21 08:13:4458 virtual float GetBrightnessForAnimation() const = 0;
59 virtual float GetGrayscaleForAnimation() const = 0;
Zoraiz Naeem3abbe3d2024-12-06 00:06:5960 virtual SkColor4f GetColorForAnimation() const = 0;
Malay Keshavb8ac9e572019-07-03 00:26:5561 virtual gfx::Rect GetClipRectForAnimation() const = 0;
Jun Mukaia343db33b2019-07-17 23:25:5062 virtual gfx::RoundedCornersF GetRoundedCornersForAnimation() const = 0;
Sasha McIntosh2270a622022-06-27 21:19:3163 virtual const gfx::LinearGradient& GetGradientMaskForAnimation() const = 0;
[email protected]712f4b642013-03-14 07:09:1564 virtual float GetDeviceScaleFactor() const = 0;
wutao52217d12017-08-18 02:40:3165 virtual ui::Layer* GetLayer() = 0;
loyso1fbd9f92015-12-17 07:43:1366 virtual cc::Layer* GetCcLayer() const = 0;
loyso841229002015-12-21 10:03:2467 virtual LayerAnimatorCollection* GetLayerAnimatorCollection() = 0;
loyso1fe980f2016-01-18 23:58:1568 virtual LayerThreadedAnimationDelegate* GetThreadedAnimationDelegate() = 0;
varkha62ba671d2017-01-25 19:09:4669 virtual float GetRefreshRate() const = 0;
loyso841229002015-12-21 10:03:2470
[email protected]b4db9372011-10-24 14:44:1971 protected:
72 virtual ~LayerAnimationDelegate() {}
73};
74
75} // namespace ui
76
[email protected]116302fc2012-05-05 21:45:4177#endif // UI_COMPOSITOR_LAYER_ANIMATION_DELEGATE_H_