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

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

Issue 1430153003: Moved the *PaintedLayerDelegates from ink_drop_animation.cc to ink_drop_painted_layer_delegates.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added use of BasePaintedLayerDelegate::GetCenterPoint(). Created 5 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
« no previous file with comments | « ui/views/animation/ink_drop_animation.cc ('k') | ui/views/animation/ink_drop_painted_layer_delegates.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_painted_layer_delegates.h
diff --git a/ui/views/animation/ink_drop_painted_layer_delegates.h b/ui/views/animation/ink_drop_painted_layer_delegates.h
new file mode 100644
index 0000000000000000000000000000000000000000..feb2921b8a6a34fde7b136edb5b4487a9dc7a935
--- /dev/null
+++ b/ui/views/animation/ink_drop_painted_layer_delegates.h
@@ -0,0 +1,86 @@
+// Copyright 2015 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_PAINTED_LAYER_DELEGATES_H_
+#define UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/compositor/layer_delegate.h"
+#include "ui/gfx/geometry/point_f.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace views {
+
+// Base ui::LayerDelegate stub that can be extended to paint shapes of a
+// specific color.
+class BasePaintedLayerDelegate : public ui::LayerDelegate {
+ public:
+ ~BasePaintedLayerDelegate() override;
+
+ SkColor color() const { return color_; }
+
+ // Returns the center point of the painted shape.
+ virtual gfx::PointF GetCenterPoint() const = 0;
+
+ // ui::LayerDelegate:
+ void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override;
+ void OnDeviceScaleFactorChanged(float device_scale_factor) override;
+ base::Closure PrepareForLayerBoundsChange() override;
+
+ protected:
+ explicit BasePaintedLayerDelegate(SkColor color);
+
+ private:
+ // The color to paint.
+ SkColor color_;
+
+ DISALLOW_COPY_AND_ASSIGN(BasePaintedLayerDelegate);
+};
+
+// A BasePaintedLayerDelegate that paints a circle of a specified color and
+// radius.
+class CircleLayerDelegate : public BasePaintedLayerDelegate {
+ public:
+ CircleLayerDelegate(SkColor color, int radius);
+ ~CircleLayerDelegate() override;
+
+ int radius() const { return radius_; }
+
+ // BasePaintedLayerDelegate:
+ gfx::PointF GetCenterPoint() const override;
+ void OnPaintLayer(const ui::PaintContext& context) override;
+
+ private:
+ // The radius of the circle.
+ int radius_;
+
+ DISALLOW_COPY_AND_ASSIGN(CircleLayerDelegate);
+};
+
+// A BasePaintedLayerDelegate that paints a rectangle of a specified color and
+// size.
+class RectangleLayerDelegate : public BasePaintedLayerDelegate {
+ public:
+ RectangleLayerDelegate(SkColor color, gfx::Size size);
+ ~RectangleLayerDelegate() override;
+
+ const gfx::Size& size() const { return size_; }
+
+ // BasePaintedLayerDelegate:
+ gfx::PointF GetCenterPoint() const override;
+ void OnPaintLayer(const ui::PaintContext& context) override;
+
+ private:
+ // The size of the rectangle.
+ gfx::Size size_;
+
+ DISALLOW_COPY_AND_ASSIGN(RectangleLayerDelegate);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
« no previous file with comments | « ui/views/animation/ink_drop_animation.cc ('k') | ui/views/animation/ink_drop_painted_layer_delegates.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698