Skip to content

Commit

Permalink
Add a 1px border stroke to the shelf button active app indicator.
Browse files Browse the repository at this point in the history
BUG=670970

Review-Url: https://codereview.chromium.org/2724403005
Cr-Commit-Position: refs/heads/master@{#454741}
(cherry picked from commit 7367db2)

Review-Url: https://codereview.chromium.org/2736973003 .
Cr-Commit-Position: refs/branch-heads/3029@{#52}
Cr-Branched-From: 939b32e-refs/heads/master@{#454471}
  • Loading branch information
Evan Stade committed Mar 7, 2017
1 parent 651a2d0 commit c4f321b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ash/common/shelf/shelf_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace {
const int kIconSize = 32;
const int kAttentionThrobDurationMS = 800;
const int kMaxAnimationSeconds = 10;
const int kIndicatorOffsetFromBottom = 2;
const int kIndicatorOffsetFromBottom = 3;
const int kIndicatorRadiusDip = 2;
const SkColor kIndicatorColor = SK_ColorWHITE;

Expand Down Expand Up @@ -146,11 +146,23 @@ class ShelfButton::AppStatusIndicatorView

DCHECK_EQ(width(), height());
DCHECK_EQ(kIndicatorRadiusDip, width() / 2);
const float dsf = canvas->UndoDeviceScaleFactor();
const int kStrokeWidthPx = 1;
gfx::PointF center = gfx::RectF(GetLocalBounds()).CenterPoint();
center.Scale(dsf);

// Fill the center.
cc::PaintFlags flags;
flags.setColor(kIndicatorColor);
flags.setFlags(cc::PaintFlags::kAntiAlias_Flag);
canvas->DrawCircle(gfx::Point(width() / 2, height() / 2),
kIndicatorRadiusDip, flags);
canvas->DrawCircle(center, dsf * kIndicatorRadiusDip - kStrokeWidthPx,
flags);

// Stroke the border.
flags.setColor(SkColorSetA(SK_ColorBLACK, 0x4D));
flags.setStyle(SkPaint::kStroke_Style);
canvas->DrawCircle(
center, dsf * kIndicatorRadiusDip - kStrokeWidthPx / 2.0f, flags);
}

// ShelfButtonAnimation::Observer
Expand Down

0 comments on commit c4f321b

Please sign in to comment.