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

Unified 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: Moved MouseEntered/Exit() to hover handling in to the ButtonInkDropDelegate. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/animation/ink_drop_painted_layer_delegates.cc
diff --git a/ui/views/animation/ink_drop_painted_layer_delegates.cc b/ui/views/animation/ink_drop_painted_layer_delegates.cc
index bdb79460e4964608ee017d113e685e212c9c0585..d5f610aa0ec8f3781f84755a7242051f0faa0306 100644
--- a/ui/views/animation/ink_drop_painted_layer_delegates.cc
+++ b/ui/views/animation/ink_drop_painted_layer_delegates.cc
@@ -82,4 +82,34 @@ void RectangleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
canvas->DrawRect(gfx::Rect(size_), paint);
}
+////////////////////////////////////////////////////////////////////////////////
+//
+// RoundedRectangleLayerDelegate
+//
+
+RoundedRectangleLayerDelegate::RoundedRectangleLayerDelegate(SkColor color,
+ gfx::Size size,
+ int corner_radius)
+ : BasePaintedLayerDelegate(color),
+ size_(size),
+ corner_radius_(corner_radius) {}
+
+RoundedRectangleLayerDelegate::~RoundedRectangleLayerDelegate() {}
+
+gfx::PointF RoundedRectangleLayerDelegate::GetCenterPoint() const {
+ return gfx::PointF(size_.width() / 2.0f, size_.height() / 2.0f);
varkha 2016/01/22 15:45:32 Could use gfx::Rect(size_)::CenterPoint().
bruthig 2016/01/25 22:39:17 Done.
+}
+
+void RoundedRectangleLayerDelegate::OnPaintLayer(
+ const ui::PaintContext& context) {
+ SkPaint paint;
+ paint.setColor(color());
+ paint.setFlags(SkPaint::kAntiAlias_Flag);
+ paint.setStyle(SkPaint::kFill_Style);
+
+ ui::PaintRecorder recorder(context, size_);
+ gfx::Canvas* canvas = recorder.canvas();
+ canvas->DrawRoundRect(gfx::Rect(size_), corner_radius_, paint);
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698