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

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

Issue 2786543002: Make updates to InkDropHighlight to pave the way for improved ink drops (Closed)
Patch Set: improved docs Created 3 years, 8 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_PAINTED_LAYER_DELEGATES_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/compositor/layer_delegate.h" 10 #include "ui/compositor/layer_delegate.h"
11 #include "ui/gfx/geometry/rect.h" 11 #include "ui/gfx/geometry/rect_f.h"
12 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size_f.h"
13 #include "ui/gfx/geometry/vector2d_f.h" 13 #include "ui/gfx/geometry/vector2d_f.h"
14 #include "ui/gfx/shadow_value.h" 14 #include "ui/gfx/shadow_value.h"
15 #include "ui/views/views_export.h" 15 #include "ui/views/views_export.h"
16 16
17 namespace views { 17 namespace views {
18 18
19 // Base ui::LayerDelegate stub that can be extended to paint shapes of a 19 // Base ui::LayerDelegate stub that can be extended to paint shapes of a
20 // specific color. 20 // specific color.
21 class VIEWS_EXPORT BasePaintedLayerDelegate : public ui::LayerDelegate { 21 class VIEWS_EXPORT BasePaintedLayerDelegate : public ui::LayerDelegate {
22 public: 22 public:
23 ~BasePaintedLayerDelegate() override; 23 ~BasePaintedLayerDelegate() override;
24 24
25 // Defines the bounds of the layer that the delegate will paint into. 25 // Defines the bounds of the layer that the delegate will paint into.
26 virtual gfx::Rect GetPaintedBounds() const = 0; 26 virtual gfx::RectF GetPaintedBounds() const = 0;
27 27
28 // Defines how to place the layer by providing an offset from the origin of 28 // Defines how to place the layer by providing an offset from the origin of
29 // the parent to the visual center of the layer. 29 // the parent to the visual center of the layer.
30 virtual gfx::Vector2dF GetCenteringOffset() const; 30 virtual gfx::Vector2dF GetCenteringOffset() const;
31 31
32 // ui::LayerDelegate: 32 // ui::LayerDelegate:
33 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; 33 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override;
34 void OnDeviceScaleFactorChanged(float device_scale_factor) override; 34 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
35 35
36 protected: 36 protected:
(...skipping 11 matching lines...) Expand all
48 // A BasePaintedLayerDelegate that paints a circle of a specified color and 48 // A BasePaintedLayerDelegate that paints a circle of a specified color and
49 // radius. 49 // radius.
50 class VIEWS_EXPORT CircleLayerDelegate : public BasePaintedLayerDelegate { 50 class VIEWS_EXPORT CircleLayerDelegate : public BasePaintedLayerDelegate {
51 public: 51 public:
52 CircleLayerDelegate(SkColor color, int radius); 52 CircleLayerDelegate(SkColor color, int radius);
53 ~CircleLayerDelegate() override; 53 ~CircleLayerDelegate() override;
54 54
55 int radius() const { return radius_; } 55 int radius() const { return radius_; }
56 56
57 // BasePaintedLayerDelegate: 57 // BasePaintedLayerDelegate:
58 gfx::Rect GetPaintedBounds() const override; 58 gfx::RectF GetPaintedBounds() const override;
59 void OnPaintLayer(const ui::PaintContext& context) override; 59 void OnPaintLayer(const ui::PaintContext& context) override;
60 60
61 private: 61 private:
62 // The radius of the circle. 62 // The radius of the circle.
63 int radius_; 63 int radius_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(CircleLayerDelegate); 65 DISALLOW_COPY_AND_ASSIGN(CircleLayerDelegate);
66 }; 66 };
67 67
68 // A BasePaintedLayerDelegate that paints a rectangle of a specified color and 68 // A BasePaintedLayerDelegate that paints a rectangle of a specified color and
69 // size. 69 // size.
70 class VIEWS_EXPORT RectangleLayerDelegate : public BasePaintedLayerDelegate { 70 class VIEWS_EXPORT RectangleLayerDelegate : public BasePaintedLayerDelegate {
71 public: 71 public:
72 RectangleLayerDelegate(SkColor color, gfx::Size size); 72 RectangleLayerDelegate(SkColor color, gfx::SizeF size);
73 ~RectangleLayerDelegate() override; 73 ~RectangleLayerDelegate() override;
74 74
75 const gfx::Size& size() const { return size_; } 75 const gfx::SizeF& size() const { return size_; }
76 76
77 // BasePaintedLayerDelegate: 77 // BasePaintedLayerDelegate:
78 gfx::Rect GetPaintedBounds() const override; 78 gfx::RectF GetPaintedBounds() const override;
79 void OnPaintLayer(const ui::PaintContext& context) override; 79 void OnPaintLayer(const ui::PaintContext& context) override;
80 80
81 private: 81 private:
82 // The size of the rectangle. 82 // The size of the rectangle.
83 gfx::Size size_; 83 gfx::SizeF size_;
84 84
85 DISALLOW_COPY_AND_ASSIGN(RectangleLayerDelegate); 85 DISALLOW_COPY_AND_ASSIGN(RectangleLayerDelegate);
86 }; 86 };
87 87
88 // A BasePaintedLayerDelegate that paints a rounded rectangle of a specified 88 // A BasePaintedLayerDelegate that paints a rounded rectangle of a specified
89 // color, size and corner radius. 89 // color, size and corner radius.
90 class VIEWS_EXPORT RoundedRectangleLayerDelegate 90 class VIEWS_EXPORT RoundedRectangleLayerDelegate
91 : public BasePaintedLayerDelegate { 91 : public BasePaintedLayerDelegate {
92 public: 92 public:
93 RoundedRectangleLayerDelegate(SkColor color, 93 RoundedRectangleLayerDelegate(SkColor color,
94 const gfx::Size& size, 94 const gfx::SizeF& size,
95 int corner_radius); 95 int corner_radius);
96 ~RoundedRectangleLayerDelegate() override; 96 ~RoundedRectangleLayerDelegate() override;
97 97
98 const gfx::Size& size() const { return size_; } 98 const gfx::SizeF& size() const { return size_; }
99 99
100 // BasePaintedLayerDelegate: 100 // BasePaintedLayerDelegate:
101 gfx::Rect GetPaintedBounds() const override; 101 gfx::RectF GetPaintedBounds() const override;
102 void OnPaintLayer(const ui::PaintContext& context) override; 102 void OnPaintLayer(const ui::PaintContext& context) override;
103 103
104 private: 104 private:
105 // The size of the rectangle. 105 // The size of the rectangle.
106 gfx::Size size_; 106 gfx::SizeF size_;
107 107
108 // The radius of the corners. 108 // The radius of the corners.
109 int corner_radius_; 109 int corner_radius_;
110 110
111 DISALLOW_COPY_AND_ASSIGN(RoundedRectangleLayerDelegate); 111 DISALLOW_COPY_AND_ASSIGN(RoundedRectangleLayerDelegate);
112 }; 112 };
113 113
114 // A BasePaintedLayerDelegate that paints a shadow around the outside of a 114 // A BasePaintedLayerDelegate that paints a shadow around the outside of a
115 // specified roundrect, and also fills the round rect. 115 // specified roundrect, and also fills the round rect.
116 class VIEWS_EXPORT BorderShadowLayerDelegate : public BasePaintedLayerDelegate { 116 class VIEWS_EXPORT BorderShadowLayerDelegate : public BasePaintedLayerDelegate {
117 public: 117 public:
118 BorderShadowLayerDelegate(const std::vector<gfx::ShadowValue>& shadows, 118 BorderShadowLayerDelegate(const std::vector<gfx::ShadowValue>& shadows,
119 const gfx::Rect& shadowed_area_bounds, 119 const gfx::Rect& shadowed_area_bounds,
120 SkColor fill_color, 120 SkColor fill_color,
121 int corner_radius); 121 int corner_radius);
122 ~BorderShadowLayerDelegate() override; 122 ~BorderShadowLayerDelegate() override;
123 123
124 // BasePaintedLayerDelegate: 124 // BasePaintedLayerDelegate:
125 gfx::Rect GetPaintedBounds() const override; 125 gfx::RectF GetPaintedBounds() const override;
126 gfx::Vector2dF GetCenteringOffset() const override; 126 gfx::Vector2dF GetCenteringOffset() const override;
127 void OnPaintLayer(const ui::PaintContext& context) override; 127 void OnPaintLayer(const ui::PaintContext& context) override;
128 128
129 private: 129 private:
130 gfx::Rect GetTotalRect() const; 130 gfx::Rect GetTotalRect() const;
131 131
132 const std::vector<gfx::ShadowValue> shadows_; 132 const std::vector<gfx::ShadowValue> shadows_;
133 133
134 // The bounds of the shadowed area. 134 // The bounds of the shadowed area.
135 const gfx::Rect bounds_; 135 const gfx::Rect bounds_;
136 136
137 const SkColor fill_color_; 137 const SkColor fill_color_;
138 138
139 const int corner_radius_; 139 const int corner_radius_;
140 140
141 DISALLOW_COPY_AND_ASSIGN(BorderShadowLayerDelegate); 141 DISALLOW_COPY_AND_ASSIGN(BorderShadowLayerDelegate);
142 }; 142 };
143 143
144 } // namespace views 144 } // namespace views
145 145
146 #endif // UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_ 146 #endif // UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698