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

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: Addressed pkasting@'s comments from patch set 13. 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
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"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 SkPaint paint; 75 SkPaint paint;
76 paint.setColor(color()); 76 paint.setColor(color());
77 paint.setFlags(SkPaint::kAntiAlias_Flag); 77 paint.setFlags(SkPaint::kAntiAlias_Flag);
78 paint.setStyle(SkPaint::kFill_Style); 78 paint.setStyle(SkPaint::kFill_Style);
79 79
80 ui::PaintRecorder recorder(context, size_); 80 ui::PaintRecorder recorder(context, size_);
81 gfx::Canvas* canvas = recorder.canvas(); 81 gfx::Canvas* canvas = recorder.canvas();
82 canvas->DrawRect(gfx::Rect(size_), paint); 82 canvas->DrawRect(gfx::Rect(size_), paint);
83 } 83 }
84 84
85 ////////////////////////////////////////////////////////////////////////////////
86 //
87 // RoundedRectangleLayerDelegate
88 //
89
90 RoundedRectangleLayerDelegate::RoundedRectangleLayerDelegate(SkColor color,
91 gfx::Size size,
92 int corner_radius)
93 : BasePaintedLayerDelegate(color),
94 size_(size),
95 corner_radius_(corner_radius) {}
96
97 RoundedRectangleLayerDelegate::~RoundedRectangleLayerDelegate() {}
98
99 gfx::PointF RoundedRectangleLayerDelegate::GetCenterPoint() const {
100 return gfx::PointF(size_.width() / 2.0f, size_.height() / 2.0f);
101 }
102
103 void RoundedRectangleLayerDelegate::OnPaintLayer(
104 const ui::PaintContext& context) {
105 SkPaint paint;
106 paint.setColor(color());
107 paint.setFlags(SkPaint::kAntiAlias_Flag);
108 paint.setStyle(SkPaint::kFill_Style);
109
110 ui::PaintRecorder recorder(context, size_);
111 gfx::Canvas* canvas = recorder.canvas();
112 canvas->DrawRoundRect(gfx::Rect(size_), corner_radius_, paint);
113 }
114
85 } // namespace views 115 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698