Commit bfd30be3 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[MdTextButton] Apply rounded rectangle to background painting

In the final OnPaintBackground() method, it currently uses a standard
rectangle to "dim" the background on hover (or animation). This
resulted in some dimming outside a rounded button. This change uses a
rounded rectangle instead, using the existing corner radius.

Bug: 866136
Change-Id: Ifb8ad476e231049efbf73e1dc64c0c1f0f113897
Reviewed-on: https://chromium-review.googlesource.com/1156877
Commit-Queue: Kevin Bailey <krb@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579819}
parent e1a0219c
......@@ -106,7 +106,11 @@ void MdTextButton::OnPaintBackground(gfx::Canvas* canvas) {
if (hover_animation().is_animating() || state() == STATE_HOVERED) {
const int kHoverAlpha = is_prominent_ ? 0x0c : 0x05;
SkScalar alpha = hover_animation().CurrentValueBetween(0, kHoverAlpha);
canvas->FillRect(GetLocalBounds(), SkColorSetA(SK_ColorBLACK, alpha));
cc::PaintFlags flags;
flags.setColor(SkColorSetA(SK_ColorBLACK, alpha));
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setAntiAlias(true);
canvas->DrawRoundRect(gfx::RectF(GetLocalBounds()), corner_radius_, flags);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment