| OLD | NEW |
| 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/insets_f.h" |
| 12 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/views/views_export.h" | 14 #include "ui/views/views_export.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 | 17 |
| 18 // 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 |
| 19 // ui::Layer that can be set as the mask layer for ink drop layer. Note that the | 19 // ui::Layer that can be set as the mask layer for ink drop layer. Note that the |
| 20 // mask's layer size (passed in the constructor) should always match size of the | 20 // mask's layer size (passed in the constructor) should always match size of the |
| 21 // layer it is masking. | 21 // layer it is masking. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 ui::Layer layer_; | 41 ui::Layer layer_; |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(InkDropMask); | 43 DISALLOW_COPY_AND_ASSIGN(InkDropMask); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // A rectangular ink drop mask with rounded corners. | 46 // A rectangular ink drop mask with rounded corners. |
| 47 class VIEWS_EXPORT RoundRectInkDropMask : public InkDropMask { | 47 class VIEWS_EXPORT RoundRectInkDropMask : public InkDropMask { |
| 48 public: | 48 public: |
| 49 RoundRectInkDropMask(const gfx::Size& layer_size, | 49 RoundRectInkDropMask(const gfx::Size& layer_size, |
| 50 const gfx::Insets& mask_insets, | 50 const gfx::InsetsF& mask_insets, |
| 51 int corner_radius); | 51 int corner_radius); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 // Overriden from InkDropMask: | 54 // Overriden from InkDropMask: |
| 55 void OnPaintLayer(const ui::PaintContext& context) override; | 55 void OnPaintLayer(const ui::PaintContext& context) override; |
| 56 | 56 |
| 57 gfx::Insets mask_insets_; | 57 gfx::InsetsF mask_insets_; |
| 58 int corner_radius_; | 58 int corner_radius_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(RoundRectInkDropMask); | 60 DISALLOW_COPY_AND_ASSIGN(RoundRectInkDropMask); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // A circular ink drop mask. | 63 // A circular ink drop mask. |
| 64 class VIEWS_EXPORT CircleInkDropMask : public InkDropMask { | 64 class VIEWS_EXPORT CircleInkDropMask : public InkDropMask { |
| 65 public: | 65 public: |
| 66 CircleInkDropMask(const gfx::Size& layer_size, | 66 CircleInkDropMask(const gfx::Size& layer_size, |
| 67 const gfx::Point& mask_center, | 67 const gfx::Point& mask_center, |
| 68 int mask_radius); | 68 int mask_radius); |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // Overriden from InkDropMask: | 71 // Overriden from InkDropMask: |
| 72 void OnPaintLayer(const ui::PaintContext& context) override; | 72 void OnPaintLayer(const ui::PaintContext& context) override; |
| 73 | 73 |
| 74 gfx::Point mask_center_; | 74 gfx::Point mask_center_; |
| 75 int mask_radius_; | 75 int mask_radius_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(CircleInkDropMask); | 77 DISALLOW_COPY_AND_ASSIGN(CircleInkDropMask); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace views | 80 } // namespace views |
| 81 | 81 |
| 82 #endif // UI_VIEWS_ANIMATION_INK_DROP_MASK_H_ | 82 #endif // UI_VIEWS_ANIMATION_INK_DROP_MASK_H_ |
| OLD | NEW |