Chromium Code Reviews| Index: ui/views/controls/label.cc |
| diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc |
| index cadd40bdbed69ddacebe9587d1bd9aa5ca4cf5dd..73ed7af94ff609efe7aca245301ae65bd19c77f5 100644 |
| --- a/ui/views/controls/label.cc |
| +++ b/ui/views/controls/label.cc |
| @@ -115,6 +115,14 @@ void Label::SetShadowOffset(int x, int y) { |
| shadow_offset_.SetPoint(x, y); |
| } |
| +void Label::SetMirrorShadow(bool mirror_shadow) { |
| + mirror_shadow_ = mirror_shadow; |
| +} |
| + |
| +void Label::SetShadowBlur(double shadow_blur) { |
| + shadow_blur_ = shadow_blur; |
| +} |
| + |
| void Label::ClearEmbellishing() { |
| has_shadow_ = false; |
| } |
| @@ -322,9 +330,22 @@ void Label::PaintText(gfx::Canvas* canvas, |
| const gfx::Rect& text_bounds, |
| int flags) { |
| gfx::ShadowValues shadows; |
| - if (has_shadow_) |
| - shadows.push_back(gfx::ShadowValue(shadow_offset_, 0, |
| + if (has_shadow_) { |
| + shadows.push_back(gfx::ShadowValue(shadow_offset_, shadow_blur_, |
| enabled() ? enabled_shadow_color_ : disabled_shadow_color_)); |
| + if (mirror_shadow_) { |
| + gfx::Point shadow_point = shadow_offset_; |
| + shadow_point.set_x(-shadow_point.x()); |
| + shadows.push_back(gfx::ShadowValue(shadow_point, shadow_blur_, |
| + enabled() ? enabled_shadow_color_ : disabled_shadow_color_)); |
| + shadow_point.set_y(-shadow_point.y()); |
| + shadows.push_back(gfx::ShadowValue(shadow_point, shadow_blur_, |
| + enabled() ? enabled_shadow_color_ : disabled_shadow_color_)); |
| + shadow_point.set_x(-shadow_point.x()); |
| + shadows.push_back(gfx::ShadowValue(shadow_point, shadow_blur_, |
| + enabled() ? enabled_shadow_color_ : disabled_shadow_color_)); |
|
flackr
2014/04/14 20:31:18
I'm concerned that this effect may not be necessar
Nina
2014/04/15 15:15:03
Good point! Yes, it works that way, so I removed t
|
| + } |
| + } |
| canvas->DrawStringRectWithShadows(text, font_list_, |
| enabled() ? actual_enabled_color_ : actual_disabled_color_, |
| text_bounds, line_height_, flags, shadows); |
| @@ -398,6 +419,8 @@ void Label::Init(const base::string16& text, const gfx::FontList& font_list) { |
| disabled_shadow_color_ = 0; |
| shadow_offset_.SetPoint(1, 1); |
| has_shadow_ = false; |
| + shadow_blur_ = 0; |
| + mirror_shadow_ = false; |
| cached_heights_.resize(kCachedSizeLimit); |
| ResetCachedSize(); |