| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_MASK_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_MASK_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "ui/compositor/layer.h" |
| 10 #include "ui/compositor/layer_delegate.h" |
| 11 #include "ui/gfx/geometry/point.h" |
| 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/views/views_export.h" |
| 14 |
| 15 namespace views { |
| 16 |
| 17 // 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 class VIEWS_EXPORT InkDropMask : public ui::LayerDelegate { |
| 20 public: |
| 21 ~InkDropMask() override; |
| 22 |
| 23 ui::Layer* layer() { return &layer_; } |
| 24 |
| 25 protected: |
| 26 explicit InkDropMask(const gfx::Rect& layer_bounds); |
| 27 |
| 28 private: |
| 29 // Overriden from ui::LayerDelegate: |
| 30 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |
| 31 |
| 32 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 33 |
| 34 ui::Layer layer_; |
| 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(InkDropMask); |
| 37 }; |
| 38 |
| 39 // A rectangular ink drop mask with rounded corners. |
| 40 class VIEWS_EXPORT RoundRectInkDropMask : public InkDropMask { |
| 41 public: |
| 42 RoundRectInkDropMask(const gfx::Rect& layer_bounds, |
| 43 const gfx::Rect& mask_bounds, |
| 44 int corner_radius); |
| 45 |
| 46 private: |
| 47 // Overriden from InkDropMask: |
| 48 void OnPaintLayer(const ui::PaintContext& context) override; |
| 49 |
| 50 gfx::Rect mask_bounds_; |
| 51 int corner_radius_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(RoundRectInkDropMask); |
| 54 }; |
| 55 |
| 56 // A circular ink drop mask. |
| 57 class VIEWS_EXPORT CircleInkDropMask : public InkDropMask { |
| 58 public: |
| 59 CircleInkDropMask(const gfx::Rect& layer_bounds, |
| 60 const gfx::Point& mask_center, |
| 61 int mask_radius); |
| 62 |
| 63 private: |
| 64 // Overriden from InkDropMask: |
| 65 void OnPaintLayer(const ui::PaintContext& context) override; |
| 66 |
| 67 gfx::Point mask_center_; |
| 68 int mask_radius_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(CircleInkDropMask); |
| 71 }; |
| 72 |
| 73 } // namespace views |
| 74 |
| 75 #endif // UI_VIEWS_ANIMATION_INK_DROP_MASK_H_ |
| OLD | NEW |