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

Side by Side Diff: ui/views/animation/ink_drop_painted_layer_delegates.cc

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed the InkDropAnimationControllerImpl to destroy its timer when not running. Created 4 years, 10 months 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" 5 #include "ui/views/animation/ink_drop_painted_layer_delegates.h"
6 6
7 #include "third_party/skia/include/core/SkPaint.h" 7 #include "third_party/skia/include/core/SkPaint.h"
8 #include "ui/compositor/paint_recorder.h" 8 #include "ui/compositor/paint_recorder.h"
9 #include "ui/gfx/geometry/point.h" 9 #include "ui/gfx/geometry/point.h"
10 #include "ui/gfx/geometry/point_conversions.h" 10 #include "ui/gfx/geometry/point_conversions.h"
11 #include "ui/gfx/geometry/rect_f.h"
11 12
12 namespace views { 13 namespace views {
13 14
14 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
15 // 16 //
16 // BasePaintedLayerDelegate 17 // BasePaintedLayerDelegate
17 // 18 //
18 19
19 BasePaintedLayerDelegate::BasePaintedLayerDelegate(SkColor color) 20 BasePaintedLayerDelegate::BasePaintedLayerDelegate(SkColor color)
20 : color_(color) {} 21 : color_(color) {}
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 SkPaint paint; 76 SkPaint paint;
76 paint.setColor(color()); 77 paint.setColor(color());
77 paint.setFlags(SkPaint::kAntiAlias_Flag); 78 paint.setFlags(SkPaint::kAntiAlias_Flag);
78 paint.setStyle(SkPaint::kFill_Style); 79 paint.setStyle(SkPaint::kFill_Style);
79 80
80 ui::PaintRecorder recorder(context, size_); 81 ui::PaintRecorder recorder(context, size_);
81 gfx::Canvas* canvas = recorder.canvas(); 82 gfx::Canvas* canvas = recorder.canvas();
82 canvas->DrawRect(gfx::Rect(size_), paint); 83 canvas->DrawRect(gfx::Rect(size_), paint);
83 } 84 }
84 85
86 ////////////////////////////////////////////////////////////////////////////////
87 //
88 // RoundedRectangleLayerDelegate
89 //
90
91 RoundedRectangleLayerDelegate::RoundedRectangleLayerDelegate(SkColor color,
92 gfx::Size size,
93 int corner_radius)
94 : BasePaintedLayerDelegate(color),
95 size_(size),
96 corner_radius_(corner_radius) {}
97
98 RoundedRectangleLayerDelegate::~RoundedRectangleLayerDelegate() {}
99
100 gfx::PointF RoundedRectangleLayerDelegate::GetCenterPoint() const {
101 return gfx::RectF(gfx::SizeF(size_)).CenterPoint();
102 }
103
104 void RoundedRectangleLayerDelegate::OnPaintLayer(
105 const ui::PaintContext& context) {
106 SkPaint paint;
107 paint.setColor(color());
108 paint.setFlags(SkPaint::kAntiAlias_Flag);
109 paint.setStyle(SkPaint::kFill_Style);
110
111 ui::PaintRecorder recorder(context, size_);
112 gfx::Canvas* canvas = recorder.canvas();
113 canvas->DrawRoundRect(gfx::Rect(size_), corner_radius_, paint);
114 }
115
85 } // namespace views 116 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_painted_layer_delegates.h ('k') | ui/views/animation/test/test_ink_drop_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698