| 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 0c620499eb842021717b7386864a28cd3992e436..50bde651876947bbf548d85391ff9301c239e1f5 100644
|
| --- a/ui/views/animation/ink_drop_painted_layer_delegates.cc
|
| +++ b/ui/views/animation/ink_drop_painted_layer_delegates.cc
|
| @@ -15,7 +15,9 @@
|
| #include "ui/gfx/geometry/point.h"
|
| #include "ui/gfx/geometry/point_conversions.h"
|
| #include "ui/gfx/geometry/rect.h"
|
| +#include "ui/gfx/geometry/rect_conversions.h"
|
| #include "ui/gfx/geometry/rect_f.h"
|
| +#include "ui/gfx/geometry/size_conversions.h"
|
| #include "ui/gfx/skia_paint_util.h"
|
| #include "ui/gfx/skia_util.h"
|
|
|
| @@ -52,9 +54,9 @@ CircleLayerDelegate::CircleLayerDelegate(SkColor color, int radius)
|
|
|
| CircleLayerDelegate::~CircleLayerDelegate() {}
|
|
|
| -gfx::Rect CircleLayerDelegate::GetPaintedBounds() const {
|
| +gfx::RectF CircleLayerDelegate::GetPaintedBounds() const {
|
| const int diameter = radius_ * 2;
|
| - return gfx::Rect(0, 0, diameter, diameter);
|
| + return gfx::RectF(0, 0, diameter, diameter);
|
| }
|
|
|
| void CircleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
|
| @@ -63,7 +65,8 @@ void CircleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
|
| flags.setAntiAlias(true);
|
| flags.setStyle(cc::PaintFlags::kFill_Style);
|
|
|
| - ui::PaintRecorder recorder(context, GetPaintedBounds().size());
|
| + ui::PaintRecorder recorder(context,
|
| + gfx::ToEnclosingRect(GetPaintedBounds()).size());
|
| gfx::Canvas* canvas = recorder.canvas();
|
|
|
| canvas->DrawCircle(GetPaintedBounds().CenterPoint(), radius_, flags);
|
| @@ -74,13 +77,13 @@ void CircleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
|
| // RectangleLayerDelegate
|
| //
|
|
|
| -RectangleLayerDelegate::RectangleLayerDelegate(SkColor color, gfx::Size size)
|
| +RectangleLayerDelegate::RectangleLayerDelegate(SkColor color, gfx::SizeF size)
|
| : BasePaintedLayerDelegate(color), size_(size) {}
|
|
|
| RectangleLayerDelegate::~RectangleLayerDelegate() {}
|
|
|
| -gfx::Rect RectangleLayerDelegate::GetPaintedBounds() const {
|
| - return gfx::Rect(size_);
|
| +gfx::RectF RectangleLayerDelegate::GetPaintedBounds() const {
|
| + return gfx::RectF(size_);
|
| }
|
|
|
| void RectangleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
|
| @@ -89,7 +92,7 @@ void RectangleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
|
| flags.setAntiAlias(true);
|
| flags.setStyle(cc::PaintFlags::kFill_Style);
|
|
|
| - ui::PaintRecorder recorder(context, size_);
|
| + ui::PaintRecorder recorder(context, gfx::ToCeiledSize(size_));
|
| gfx::Canvas* canvas = recorder.canvas();
|
| canvas->DrawRect(GetPaintedBounds(), flags);
|
| }
|
| @@ -101,7 +104,7 @@ void RectangleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
|
|
|
| RoundedRectangleLayerDelegate::RoundedRectangleLayerDelegate(
|
| SkColor color,
|
| - const gfx::Size& size,
|
| + const gfx::SizeF& size,
|
| int corner_radius)
|
| : BasePaintedLayerDelegate(color),
|
| size_(size),
|
| @@ -109,8 +112,8 @@ RoundedRectangleLayerDelegate::RoundedRectangleLayerDelegate(
|
|
|
| RoundedRectangleLayerDelegate::~RoundedRectangleLayerDelegate() {}
|
|
|
| -gfx::Rect RoundedRectangleLayerDelegate::GetPaintedBounds() const {
|
| - return gfx::Rect(size_);
|
| +gfx::RectF RoundedRectangleLayerDelegate::GetPaintedBounds() const {
|
| + return gfx::RectF(size_);
|
| }
|
|
|
| void RoundedRectangleLayerDelegate::OnPaintLayer(
|
| @@ -120,8 +123,12 @@ void RoundedRectangleLayerDelegate::OnPaintLayer(
|
| flags.setAntiAlias(true);
|
| flags.setStyle(cc::PaintFlags::kFill_Style);
|
|
|
| - ui::PaintRecorder recorder(context, size_);
|
| - recorder.canvas()->DrawRoundRect(GetPaintedBounds(), corner_radius_, flags);
|
| + ui::PaintRecorder recorder(context, gfx::ToCeiledSize(size_));
|
| + const float dsf = recorder.canvas()->UndoDeviceScaleFactor();
|
| + gfx::RectF rect = GetPaintedBounds();
|
| + rect.Scale(dsf);
|
| + recorder.canvas()->DrawRoundRect(gfx::ToEnclosingRect(rect),
|
| + dsf * corner_radius_, flags);
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -142,10 +149,10 @@ BorderShadowLayerDelegate::BorderShadowLayerDelegate(
|
|
|
| BorderShadowLayerDelegate::~BorderShadowLayerDelegate() {}
|
|
|
| -gfx::Rect BorderShadowLayerDelegate::GetPaintedBounds() const {
|
| +gfx::RectF BorderShadowLayerDelegate::GetPaintedBounds() const {
|
| gfx::Rect total_rect(bounds_);
|
| total_rect.Inset(gfx::ShadowValue::GetMargin(shadows_));
|
| - return total_rect;
|
| + return gfx::RectF(total_rect);
|
| }
|
|
|
| gfx::Vector2dF BorderShadowLayerDelegate::GetCenteringOffset() const {
|
| @@ -159,12 +166,13 @@ void BorderShadowLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
|
| flags.setColor(fill_color_);
|
|
|
| gfx::RectF rrect_bounds =
|
| - gfx::RectF(bounds_ - GetPaintedBounds().OffsetFromOrigin());
|
| + gfx::RectF(bounds_) - GetPaintedBounds().OffsetFromOrigin();
|
| SkRRect r_rect = SkRRect::MakeRectXY(gfx::RectFToSkRect(rrect_bounds),
|
| corner_radius_, corner_radius_);
|
|
|
| // First the fill color.
|
| - ui::PaintRecorder recorder(context, GetPaintedBounds().size());
|
| + ui::PaintRecorder recorder(context,
|
| + gfx::ToCeiledSize(GetPaintedBounds().size()));
|
| recorder.canvas()->sk_canvas()->drawRRect(r_rect, flags);
|
|
|
| // Now the shadow.
|
|
|