OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 #ifndef UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_ | |
sadrul
2015/11/06 17:39:14
newline before
bruthig
2015/11/06 18:51:21
Done.
| |
5 #define UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_ | |
6 | |
7 #include "base/callback.h" | |
8 #include "base/macros.h" | |
9 #include "third_party/skia/include/core/SkColor.h" | |
10 #include "ui/compositor/layer_delegate.h" | |
11 #include "ui/gfx/geometry/point_f.h" | |
12 #include "ui/gfx/geometry/rect.h" | |
13 #include "ui/gfx/geometry/size.h" | |
14 | |
15 namespace views { | |
16 | |
17 // Base ui::LayerDelegate stub that can be extended to paint shapes of a | |
18 // specific color. | |
19 class BasePaintedLayerDelegate : public ui::LayerDelegate { | |
20 public: | |
21 ~BasePaintedLayerDelegate() override; | |
22 | |
23 SkColor color() const { return color_; } | |
24 | |
25 // Returns the center point of the painted shape. | |
26 virtual gfx::PointF GetCenterPoint() const = 0; | |
sadrul
2015/11/06 17:39:14
This looks new that doesn't exist in current code.
bruthig
2015/11/06 18:51:21
I've added the use of it.
| |
27 | |
28 // ui::LayerDelegate: | |
29 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; | |
30 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | |
31 base::Closure PrepareForLayerBoundsChange() override; | |
32 | |
33 protected: | |
34 explicit BasePaintedLayerDelegate(SkColor color); | |
35 | |
36 private: | |
37 // The color to paint. | |
38 SkColor color_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(BasePaintedLayerDelegate); | |
41 }; | |
42 | |
43 // A BasePaintedLayerDelegate that paints a circle of a specified color and | |
44 // radius. | |
45 class CircleLayerDelegate : public BasePaintedLayerDelegate { | |
46 public: | |
47 CircleLayerDelegate(SkColor color, int radius); | |
48 ~CircleLayerDelegate() override; | |
49 | |
50 int radius() const { return radius_; } | |
51 | |
52 // BasePaintedLayerDelegate: | |
53 gfx::PointF GetCenterPoint() const override; | |
54 void OnPaintLayer(const ui::PaintContext& context) override; | |
55 | |
56 private: | |
57 // The radius of the circle. | |
58 int radius_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(CircleLayerDelegate); | |
61 }; | |
62 | |
63 // A BasePaintedLayerDelegate that paints a rectangle of a specified color and | |
64 // size. | |
65 class RectangleLayerDelegate : public BasePaintedLayerDelegate { | |
66 public: | |
67 RectangleLayerDelegate(SkColor color, gfx::Size size); | |
68 ~RectangleLayerDelegate() override; | |
69 | |
70 const gfx::Size& size() const { return size_; } | |
71 | |
72 // BasePaintedLayerDelegate: | |
73 gfx::PointF GetCenterPoint() const override; | |
74 void OnPaintLayer(const ui::PaintContext& context) override; | |
75 | |
76 private: | |
77 // The size of the rectangle. | |
78 gfx::Size size_; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(RectangleLayerDelegate); | |
81 }; | |
82 | |
83 } // namespace views | |
84 | |
85 #endif // UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_ | |
OLD | NEW |