| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" | 5 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/core/SkPaint.h" | 7 #include "third_party/skia/include/core/SkPaint.h" |
| 8 #include "ui/compositor/paint_recorder.h" | 8 #include "ui/compositor/paint_recorder.h" |
| 9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
| 10 #include "ui/gfx/geometry/point_conversions.h" | 10 #include "ui/gfx/geometry/point_conversions.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 gfx::PointF CircleLayerDelegate::GetCenterPoint() const { | 45 gfx::PointF CircleLayerDelegate::GetCenterPoint() const { |
| 46 return gfx::PointF(radius_, radius_); | 46 return gfx::PointF(radius_, radius_); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void CircleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) { | 49 void CircleLayerDelegate::OnPaintLayer(const ui::PaintContext& context) { |
| 50 SkPaint paint; | 50 SkPaint paint; |
| 51 paint.setColor(color()); | 51 paint.setColor(color()); |
| 52 paint.setFlags(SkPaint::kAntiAlias_Flag); | 52 paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 53 paint.setStyle(SkPaint::kFill_Style); | 53 paint.setStyle(SkPaint::kFill_Style); |
| 54 | 54 |
| 55 ui::PaintRecorder recorder(context, gfx::Size(radius_, radius_)); | 55 ui::PaintRecorder recorder(context, gfx::Size(2 * radius_, 2 * radius_)); |
| 56 gfx::Canvas* canvas = recorder.canvas(); | 56 gfx::Canvas* canvas = recorder.canvas(); |
| 57 | 57 |
| 58 canvas->DrawCircle(ToRoundedPoint(GetCenterPoint()), radius_, paint); | 58 canvas->DrawCircle(ToRoundedPoint(GetCenterPoint()), radius_, paint); |
| 59 } | 59 } |
| 60 | 60 |
| 61 //////////////////////////////////////////////////////////////////////////////// | 61 //////////////////////////////////////////////////////////////////////////////// |
| 62 // | 62 // |
| 63 // RectangleLayerDelegate | 63 // RectangleLayerDelegate |
| 64 // | 64 // |
| 65 | 65 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 paint.setColor(color()); | 107 paint.setColor(color()); |
| 108 paint.setFlags(SkPaint::kAntiAlias_Flag); | 108 paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 109 paint.setStyle(SkPaint::kFill_Style); | 109 paint.setStyle(SkPaint::kFill_Style); |
| 110 | 110 |
| 111 ui::PaintRecorder recorder(context, size_); | 111 ui::PaintRecorder recorder(context, size_); |
| 112 gfx::Canvas* canvas = recorder.canvas(); | 112 gfx::Canvas* canvas = recorder.canvas(); |
| 113 canvas->DrawRoundRect(gfx::Rect(size_), corner_radius_, paint); | 113 canvas->DrawRoundRect(gfx::Rect(size_), corner_radius_, paint); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace views | 116 } // namespace views |
| OLD | NEW |