Chromium Code Reviews| 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/callback_forward.h" | |
|
bruthig
2016/11/11 20:16:43
Is this needed?
mohsen
2016/11/13 23:31:29
Not sure what it's doing here! Removed.
| |
| 9 #include "base/macros.h" | |
| 10 #include "ui/compositor/layer.h" | |
| 11 #include "ui/compositor/layer_delegate.h" | |
| 12 #include "ui/gfx/geometry/point.h" | |
| 13 #include "ui/gfx/geometry/rect.h" | |
| 14 #include "ui/views/views_export.h" | |
| 15 | |
| 16 namespace views { | |
| 17 | |
| 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. | |
| 20 class VIEWS_EXPORT InkDropMask : public ui::LayerDelegate { | |
| 21 public: | |
| 22 ~InkDropMask() override; | |
| 23 | |
| 24 ui::Layer* layer() { return &layer_; } | |
| 25 | |
| 26 protected: | |
| 27 explicit InkDropMask(const gfx::Rect& layer_bounds); | |
| 28 | |
| 29 private: | |
| 30 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; | |
|
bruthig
2016/11/11 20:16:43
nit: Add '// ui::LayerDelegate:' or '// Overridden
mohsen
2016/11/13 23:31:29
Done.
| |
| 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& bounds, | |
|
bruthig
2016/11/11 20:16:43
nit: |mask_bounds| would be more descriptive than
mohsen
2016/11/13 23:31:29
Done.
| |
| 44 int corner_radius); | |
| 45 | |
| 46 private: | |
| 47 // Overriden from InkDropMask: | |
| 48 void OnPaintLayer(const ui::PaintContext& context) override; | |
| 49 | |
| 50 gfx::Rect 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& center, | |
|
bruthig
2016/11/11 20:16:43
nit: |mask_center|/|mask_radius| would be more des
mohsen
2016/11/13 23:31:29
Done.
| |
| 61 int radius); | |
| 62 | |
| 63 private: | |
| 64 // Overriden from InkDropMask: | |
| 65 void OnPaintLayer(const ui::PaintContext& context) override; | |
| 66 | |
| 67 gfx::Point center_; | |
| 68 int 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 |