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

Side by Side Diff: ui/views/animation/ink_drop_mask.h

Issue 2510603003: Add ink drop ripple to status tray (Closed)
Patch Set: Created 4 years, 1 month 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_MASK_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_MASK_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_MASK_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_MASK_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/compositor/layer.h" 9 #include "ui/compositor/layer.h"
10 #include "ui/compositor/layer_delegate.h" 10 #include "ui/compositor/layer_delegate.h"
11 #include "ui/gfx/geometry/insets.h"
11 #include "ui/gfx/geometry/point.h" 12 #include "ui/gfx/geometry/point.h"
12 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
13 #include "ui/views/views_export.h" 14 #include "ui/views/views_export.h"
14 15
15 namespace views { 16 namespace views {
16 17
17 // Base class for different ink drop masks. It is responsible for creating the 18 // Base class for different ink drop masks. It is responsible for creating the
18 // ui::Layer that can be set as the mask layer for ink drop layer. 19 // ui::Layer that can be set as the mask layer for ink drop layer.
19 class VIEWS_EXPORT InkDropMask : public ui::LayerDelegate { 20 class VIEWS_EXPORT InkDropMask : public ui::LayerDelegate {
bruthig 2016/11/17 06:31:21 Somewhere we should document that the mask size sh
mohsen 2016/11/17 20:10:12 Done.
20 public: 21 public:
21 ~InkDropMask() override; 22 ~InkDropMask() override;
22 23
24 void UpdateLayerSize(const gfx::Size& new_layer_size);
bruthig 2016/11/17 06:31:21 A comment here saying why/when this should be call
mohsen 2016/11/17 20:10:12 Done.
25
23 ui::Layer* layer() { return &layer_; } 26 ui::Layer* layer() { return &layer_; }
24 27
25 protected: 28 protected:
26 explicit InkDropMask(const gfx::Size& layer_size); 29 explicit InkDropMask(const gfx::Size& layer_size);
27 30
28 private: 31 private:
29 // Overriden from ui::LayerDelegate: 32 // Overriden from ui::LayerDelegate:
30 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; 33 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override;
31 34
32 void OnDeviceScaleFactorChanged(float device_scale_factor) override; 35 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
33 36
34 ui::Layer layer_; 37 ui::Layer layer_;
35 38
36 DISALLOW_COPY_AND_ASSIGN(InkDropMask); 39 DISALLOW_COPY_AND_ASSIGN(InkDropMask);
37 }; 40 };
38 41
39 // A rectangular ink drop mask with rounded corners. 42 // A rectangular ink drop mask with rounded corners.
40 class VIEWS_EXPORT RoundRectInkDropMask : public InkDropMask { 43 class VIEWS_EXPORT RoundRectInkDropMask : public InkDropMask {
41 public: 44 public:
42 RoundRectInkDropMask(const gfx::Size& layer_size, 45 RoundRectInkDropMask(const gfx::Size& layer_size,
43 const gfx::Rect& mask_bounds, 46 const gfx::Insets& mask_insets,
44 int corner_radius); 47 int corner_radius);
45 48
46 private: 49 private:
47 // Overriden from InkDropMask: 50 // Overriden from InkDropMask:
48 void OnPaintLayer(const ui::PaintContext& context) override; 51 void OnPaintLayer(const ui::PaintContext& context) override;
49 52
50 gfx::Rect mask_bounds_; 53 gfx::Insets mask_insets_;
51 int corner_radius_; 54 int corner_radius_;
52 55
53 DISALLOW_COPY_AND_ASSIGN(RoundRectInkDropMask); 56 DISALLOW_COPY_AND_ASSIGN(RoundRectInkDropMask);
54 }; 57 };
55 58
56 // A circular ink drop mask. 59 // A circular ink drop mask.
57 class VIEWS_EXPORT CircleInkDropMask : public InkDropMask { 60 class VIEWS_EXPORT CircleInkDropMask : public InkDropMask {
58 public: 61 public:
59 CircleInkDropMask(const gfx::Size& layer_size, 62 CircleInkDropMask(const gfx::Size& layer_size,
60 const gfx::Point& mask_center, 63 const gfx::Point& mask_center,
61 int mask_radius); 64 int mask_radius);
62 65
63 private: 66 private:
64 // Overriden from InkDropMask: 67 // Overriden from InkDropMask:
65 void OnPaintLayer(const ui::PaintContext& context) override; 68 void OnPaintLayer(const ui::PaintContext& context) override;
66 69
67 gfx::Point mask_center_; 70 gfx::Point mask_center_;
68 int mask_radius_; 71 int mask_radius_;
69 72
70 DISALLOW_COPY_AND_ASSIGN(CircleInkDropMask); 73 DISALLOW_COPY_AND_ASSIGN(CircleInkDropMask);
71 }; 74 };
72 75
73 } // namespace views 76 } // namespace views
74 77
75 #endif // UI_VIEWS_ANIMATION_INK_DROP_MASK_H_ 78 #endif // UI_VIEWS_ANIMATION_INK_DROP_MASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698