Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc |
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
index 3bf5e0739eae6f389b5d0a32cc618fa588114ed9..f7657694c93fb6556d735a302535400fc8268fc9 100644 |
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
@@ -372,12 +372,6 @@ class EditableProfilePhoto : public views::LabelButton { |
SetSize(GetPreferredSize()); |
} |
- // Calculate the circular mask that will be used to display the photo. |
- circular_mask_.addCircle( |
- SkIntToScalar(icon_image_side() / 2), |
- SkIntToScalar(icon_image_side() / 2) + badge_spacing(), |
- SkIntToScalar(icon_image_side() / 2)); |
- |
if (switches::IsMaterialDesignUserMenu() || !is_editing_allowed) { |
SetEnabled(false); |
return; |
@@ -402,8 +396,6 @@ class EditableProfilePhoto : public views::LabelButton { |
void OnPaint(gfx::Canvas* canvas) override { |
sky
2016/08/29 22:38:09
AFAICT this override isn't necessary. Am I missing
anthonyvd
2016/08/30 14:31:31
You're absolutely right, thanks!
Done.
|
canvas->Save(); |
- // Display the profile picture as a circle. |
- canvas->ClipPath(circular_mask_, true); |
views::LabelButton::OnPaint(canvas); |
canvas->Restore(); |
} |
@@ -412,7 +404,13 @@ class EditableProfilePhoto : public views::LabelButton { |
{ |
// Display any children (the "change photo" overlay) as a circle. |
ui::ClipRecorder clip_recorder(context); |
- clip_recorder.ClipPathWithAntiAliasing(circular_mask_); |
+ gfx::Rect clip_bounds = image()->GetMirroredBounds(); |
+ gfx::Path clip_mask; |
+ clip_mask.addCircle( |
+ clip_bounds.x() + clip_bounds.width() / 2, |
+ clip_bounds.y() + clip_bounds.height() / 2, |
+ clip_bounds.width() / 2); |
+ clip_recorder.ClipPathWithAntiAliasing(clip_mask); |
View::PaintChildren(context); |
} |
@@ -424,10 +422,11 @@ class EditableProfilePhoto : public views::LabelButton { |
int badge_offset = |
icon_image_side() + badge_spacing() - GetProfileBadgeSize(); |
gfx::Vector2d badge_offset_vector = gfx::Vector2d( |
- badge_offset, |
+ GetMirroredXWithWidthInView(badge_offset, GetProfileBadgeSize()), |
badge_offset + (switches::IsMaterialDesignUserMenu() |
? views::kRelatedControlSmallVerticalSpacing |
: 0)); |
+ |
gfx::Point center_point = bounds.CenterPoint() + badge_offset_vector; |
// Paint the circular background. |
@@ -503,7 +502,6 @@ class EditableProfilePhoto : public views::LabelButton { |
} |
bool interactive_; |
- gfx::Path circular_mask_; |
// Image that is shown when hovering over the image button. Can be NULL if |
// the photo isn't allowed to be edited (e.g. for guest profiles). |