Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: ui/views/animation/ink_drop_mask.h

Issue 2499523003: Add ink drop masking to TrayBackgroundView (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/animation/ink_drop_mask.h
diff --git a/ui/views/animation/ink_drop_mask.h b/ui/views/animation/ink_drop_mask.h
new file mode 100644
index 0000000000000000000000000000000000000000..c6a16bc5dfa126d4e934fe71c7739c2ac357a08d
--- /dev/null
+++ b/ui/views/animation/ink_drop_mask.h
@@ -0,0 +1,75 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_ANIMATION_INK_DROP_MASK_H_
+#define UI_VIEWS_ANIMATION_INK_DROP_MASK_H_
+
+#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.
+#include "base/macros.h"
+#include "ui/compositor/layer.h"
+#include "ui/compositor/layer_delegate.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/views/views_export.h"
+
+namespace views {
+
+// Base class for different ink drop masks. It is responsible for creating the
+// ui::Layer that can be set as the mask layer for ink drop layer.
+class VIEWS_EXPORT InkDropMask : public ui::LayerDelegate {
+ public:
+ ~InkDropMask() override;
+
+ ui::Layer* layer() { return &layer_; }
+
+ protected:
+ explicit InkDropMask(const gfx::Rect& layer_bounds);
+
+ private:
+ 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.
+
+ void OnDeviceScaleFactorChanged(float device_scale_factor) override;
+
+ ui::Layer layer_;
+
+ DISALLOW_COPY_AND_ASSIGN(InkDropMask);
+};
+
+// A rectangular ink drop mask with rounded corners.
+class VIEWS_EXPORT RoundRectInkDropMask : public InkDropMask {
+ public:
+ RoundRectInkDropMask(const gfx::Rect& layer_bounds,
+ 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.
+ int corner_radius);
+
+ private:
+ // Overriden from InkDropMask:
+ void OnPaintLayer(const ui::PaintContext& context) override;
+
+ gfx::Rect bounds_;
+ int corner_radius_;
+
+ DISALLOW_COPY_AND_ASSIGN(RoundRectInkDropMask);
+};
+
+// A circular ink drop mask.
+class VIEWS_EXPORT CircleInkDropMask : public InkDropMask {
+ public:
+ CircleInkDropMask(const gfx::Rect& layer_bounds,
+ 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.
+ int radius);
+
+ private:
+ // Overriden from InkDropMask:
+ void OnPaintLayer(const ui::PaintContext& context) override;
+
+ gfx::Point center_;
+ int radius_;
+
+ DISALLOW_COPY_AND_ASSIGN(CircleInkDropMask);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_ANIMATION_INK_DROP_MASK_H_

Powered by Google App Engine
This is Rietveld 408576698