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..7d43b8a5c17881805fa086a5a04a6cf6a2a094fe 100644 |
--- a/ui/views/animation/ink_drop_painted_layer_delegates.cc |
+++ b/ui/views/animation/ink_drop_painted_layer_delegates.cc |
@@ -8,6 +8,7 @@ |
#include "ui/compositor/paint_recorder.h" |
#include "ui/gfx/geometry/point.h" |
#include "ui/gfx/geometry/point_conversions.h" |
+#include "ui/gfx/geometry/rect_f.h" |
namespace views { |
@@ -82,4 +83,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::RectF(gfx::SizeF(size_)).CenterPoint(); |
+} |
+ |
+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 |