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; |