OLD | NEW |
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/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 gfx::PointF GetCenterPoint() const override; | 74 gfx::PointF GetCenterPoint() const override; |
75 void OnPaintLayer(const ui::PaintContext& context) override; | 75 void OnPaintLayer(const ui::PaintContext& context) override; |
76 | 76 |
77 private: | 77 private: |
78 // The size of the rectangle. | 78 // The size of the rectangle. |
79 gfx::Size size_; | 79 gfx::Size size_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(RectangleLayerDelegate); | 81 DISALLOW_COPY_AND_ASSIGN(RectangleLayerDelegate); |
82 }; | 82 }; |
83 | 83 |
| 84 // A BasePaintedLayerDelegate that paints a rounded rectangle of a specified |
| 85 // color, size and corner radius. |
| 86 class RoundedRectangleLayerDelegate : public BasePaintedLayerDelegate { |
| 87 public: |
| 88 RoundedRectangleLayerDelegate(SkColor color, |
| 89 gfx::Size size, |
| 90 int corner_radius); |
| 91 ~RoundedRectangleLayerDelegate() override; |
| 92 |
| 93 const gfx::Size& size() const { return size_; } |
| 94 |
| 95 // ui::LayerDelegate: |
| 96 gfx::PointF GetCenterPoint() const override; |
| 97 void OnPaintLayer(const ui::PaintContext& context) override; |
| 98 |
| 99 private: |
| 100 // The size of the rectangle. |
| 101 gfx::Size size_; |
| 102 |
| 103 // The radius of the corners. |
| 104 int corner_radius_; |
| 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(RoundedRectangleLayerDelegate); |
| 107 }; |
| 108 |
84 } // namespace views | 109 } // namespace views |
85 | 110 |
86 #endif // UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_ | 111 #endif // UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_ |
OLD | NEW |