Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1291)

Unified Diff: ui/views/controls/button/md_text_button.cc

Issue 2322653002: Sharpen MdTextButton border for fractional scale factors. (Closed)
Patch Set: always have an opaque bg Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/controls/focusable_border.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/md_text_button.cc
diff --git a/ui/views/controls/button/md_text_button.cc b/ui/views/controls/button/md_text_button.cc
index 44d111c80dff5219baba969b59ba615dc8a2cbe5..6abf68afa43da4a8142a840c2282c93244964ef2 100644
--- a/ui/views/controls/button/md_text_button.cc
+++ b/ui/views/controls/button/md_text_button.cc
@@ -238,6 +238,11 @@ MdTextButton::MdTextButton(ButtonListener* listener)
focus_ring_->SetVisible(false);
set_request_focus_on_press(false);
LabelButton::SetFontList(GetMdFontList());
+
+ // Paint to a layer so that the canvas is snapped to pixel boundaries (useful
+ // for fractional DSF).
+ SetPaintToLayer(true);
sky 2016/09/07 21:22:37 It makes me sad that you have to do this.
Evan Stade 2016/09/07 22:31:25 yea, me too, an angel is losing its wings. Is ther
Evan Stade 2016/09/07 22:43:40 I mean, I assume there isn't currently, but perhap
+ layer()->SetFillsBoundsOpaquely(false);
}
MdTextButton::~MdTextButton() {}
@@ -296,7 +301,8 @@ void MdTextButton::UpdateColors() {
ui::NativeTheme::kColorId_CallToActionColor)
: is_default()
? color_utils::BlendTowardOppositeLuma(text_color, 0xD8)
- : SK_ColorTRANSPARENT;
+ : theme->GetSystemColor(
+ ui::NativeTheme::kColorId_DialogBackground);
bg_color = PlatformStyle::BackgroundColorForMdButton(bg_color, state());
@@ -305,6 +311,7 @@ void MdTextButton::UpdateColors() {
? SkColorSetA(SK_ColorBLACK, kStrokeOpacity)
: SkColorSetA(SK_ColorWHITE, 2 * kStrokeOpacity);
+ DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color)));
set_background(Background::CreateBackgroundPainter(
true, Painter::CreateRoundRectWith1PxBorderPainter(
bg_color, stroke_color, kInkDropSmallCornerRadius)));
« no previous file with comments | « no previous file | ui/views/controls/focusable_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698