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

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

Issue 1422593003: Made material design ink drop QUICK_ACTION animation more visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added varkha@'s behavioural changes 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
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 05065ee02d4d8a74815b517b8758b2b955d9927b..d5f610aa0ec8f3781f84755a7242051f0faa0306 100644
--- a/ui/views/animation/ink_drop_painted_layer_delegates.cc
+++ b/ui/views/animation/ink_drop_painted_layer_delegates.cc
@@ -7,6 +7,7 @@
#include "third_party/skia/include/core/SkPaint.h"
#include "ui/compositor/paint_recorder.h"
#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/point_conversions.h"
namespace views {
@@ -40,6 +41,10 @@ CircleLayerDelegate::CircleLayerDelegate(SkColor color, int radius)
CircleLayerDelegate::~CircleLayerDelegate() {}
+gfx::PointF CircleLayerDelegate::GetCenterPoint() const {
+ return gfx::PointF(radius_, radius_);
+}
+
void CircleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
SkPaint paint;
paint.setColor(color());
@@ -49,8 +54,7 @@ void CircleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
ui::PaintRecorder recorder(context, gfx::Size(radius_, radius_));
gfx::Canvas* canvas = recorder.canvas();
- gfx::Point center_point = gfx::Point(radius_, radius_);
- canvas->DrawCircle(center_point, radius_, paint);
+ canvas->DrawCircle(ToRoundedPoint(GetCenterPoint()), radius_, paint);
}
////////////////////////////////////////////////////////////////////////////////
@@ -63,6 +67,10 @@ RectangleLayerDelegate::RectangleLayerDelegate(SkColor color, gfx::Size size)
RectangleLayerDelegate::~RectangleLayerDelegate() {}
+gfx::PointF RectangleLayerDelegate::GetCenterPoint() const {
+ return gfx::PointF(size_.width() / 2.0f, size_.height() / 2.0f);
+}
+
void RectangleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
SkPaint paint;
paint.setColor(color());
@@ -88,6 +96,10 @@ RoundedRectangleLayerDelegate::RoundedRectangleLayerDelegate(SkColor color,
RoundedRectangleLayerDelegate::~RoundedRectangleLayerDelegate() {}
+gfx::PointF RoundedRectangleLayerDelegate::GetCenterPoint() const {
+ return gfx::PointF(size_.width() / 2.0f, size_.height() / 2.0f);
+}
+
void RoundedRectangleLayerDelegate::OnPaintLayer(
const ui::PaintContext& context) {
SkPaint paint;

Powered by Google App Engine
This is Rietveld 408576698