| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/controls/focusable_rounded_border_mac.h" | 5 #include "ui/views/controls/focusable_rounded_border_mac.h" |
| 6 | 6 |
| 7 #include "ui/gfx/canvas.h" | 7 #include "ui/gfx/canvas.h" |
| 8 #include "ui/native_theme/native_theme_mac.h" | 8 #include "ui/native_theme/native_theme_mac.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // padding. Why is that? | 21 // padding. Why is that? |
| 22 SetInsets(kThickness, kThickness, kThickness, kThickness); | 22 SetInsets(kThickness, kThickness, kThickness, kThickness); |
| 23 } | 23 } |
| 24 | 24 |
| 25 FocusableRoundedBorder::~FocusableRoundedBorder() {} | 25 FocusableRoundedBorder::~FocusableRoundedBorder() {} |
| 26 | 26 |
| 27 // For now, this is similar to RoundedRectBorder::Paint(), but this method will | 27 // For now, this is similar to RoundedRectBorder::Paint(), but this method will |
| 28 // likely diverge in future. | 28 // likely diverge in future. |
| 29 // TODO(ellyjones): Diverge it by adding soft focus rings. | 29 // TODO(ellyjones): Diverge it by adding soft focus rings. |
| 30 void FocusableRoundedBorder::Paint(const View& view, gfx::Canvas* canvas) { | 30 void FocusableRoundedBorder::Paint(const View& view, gfx::Canvas* canvas) { |
| 31 SkPaint paint; | 31 CdlPaint paint; |
| 32 paint.setStyle(SkPaint::kStroke_Style); | 32 paint.setStyle(CdlPaint::kStroke_Style); |
| 33 paint.setStrokeWidth(kThickness); | 33 paint.setStrokeWidth(kThickness); |
| 34 paint.setColor(GetCurrentColor(view)); | 34 paint.setColor(GetCurrentColor(view)); |
| 35 paint.setAntiAlias(true); | 35 paint.setAntiAlias(true); |
| 36 | 36 |
| 37 float half_thickness = kThickness / 2.0f; | 37 float half_thickness = kThickness / 2.0f; |
| 38 gfx::RectF bounds(view.GetLocalBounds()); | 38 gfx::RectF bounds(view.GetLocalBounds()); |
| 39 bounds.Inset(half_thickness, half_thickness); | 39 bounds.Inset(half_thickness, half_thickness); |
| 40 canvas->DrawRoundRect(bounds, ui::NativeThemeMac::kButtonCornerRadius, | 40 canvas->DrawRoundRect(bounds, ui::NativeThemeMac::kButtonCornerRadius, |
| 41 paint); | 41 paint); |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace views | 44 } // namespace views |
| OLD | NEW |