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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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_PAINTED_LAYER_DELEGATES_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/compositor/layer_delegate.h"
12 #include "ui/gfx/geometry/point_f.h"
13 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gfx/geometry/size.h"
15
16 namespace views {
17
18 // Base ui::LayerDelegate stub that can be extended to paint shapes of a
19 // specific color.
20 class BasePaintedLayerDelegate : public ui::LayerDelegate {
21 public:
22 ~BasePaintedLayerDelegate() override;
23
24 SkColor color() const { return color_; }
25
26 // Returns the center point of the painted shape.
27 virtual gfx::PointF GetCenterPoint() const = 0;
28
29 // ui::LayerDelegate:
30 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override;
31 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
32 base::Closure PrepareForLayerBoundsChange() override;
33
34 protected:
35 explicit BasePaintedLayerDelegate(SkColor color);
36
37 private:
38 // The color to paint.
39 SkColor color_;
40
41 DISALLOW_COPY_AND_ASSIGN(BasePaintedLayerDelegate);
42 };
43
44 // A BasePaintedLayerDelegate that paints a circle of a specified color and
45 // radius.
46 class CircleLayerDelegate : public BasePaintedLayerDelegate {
47 public:
48 CircleLayerDelegate(SkColor color, int radius);
49 ~CircleLayerDelegate() override;
50
51 int radius() const { return radius_; }
52
53 // BasePaintedLayerDelegate:
54 gfx::PointF GetCenterPoint() const override;
55 void OnPaintLayer(const ui::PaintContext& context) override;
56
57 private:
58 // The radius of the circle.
59 int radius_;
60
61 DISALLOW_COPY_AND_ASSIGN(CircleLayerDelegate);
62 };
63
64 // A BasePaintedLayerDelegate that paints a rectangle of a specified color and
65 // size.
66 class RectangleLayerDelegate : public BasePaintedLayerDelegate {
67 public:
68 RectangleLayerDelegate(SkColor color, gfx::Size size);
69 ~RectangleLayerDelegate() override;
70
71 const gfx::Size& size() const { return size_; }
72
73 // BasePaintedLayerDelegate:
74 gfx::PointF GetCenterPoint() const override;
75 void OnPaintLayer(const ui::PaintContext& context) override;
76
77 private:
78 // The size of the rectangle.
79 gfx::Size size_;
80
81 DISALLOW_COPY_AND_ASSIGN(RectangleLayerDelegate);
82 };
83
84 } // namespace views
85
86 #endif // UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
OLDNEW
« 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