| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/controls/button/text_button.h" | 5 #include "ui/views/controls/button/text_button.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 const BorderImageSet* set = &normal_set_; | 131 const BorderImageSet* set = &normal_set_; |
| 132 if (button->show_multiple_icon_states() && | 132 if (button->show_multiple_icon_states() && |
| 133 ((state == TextButton::BS_HOT) || (state == TextButton::BS_PUSHED))) | 133 ((state == TextButton::BS_HOT) || (state == TextButton::BS_PUSHED))) |
| 134 set = (state == TextButton::BS_HOT) ? &hot_set_ : &pushed_set_; | 134 set = (state == TextButton::BS_HOT) ? &hot_set_ : &pushed_set_; |
| 135 if (set->top_left) { | 135 if (set->top_left) { |
| 136 if (button->GetAnimation()->is_animating()) { | 136 if (button->GetAnimation()->is_animating()) { |
| 137 // TODO(pkasting): Really this should crossfade between states so it could | 137 // TODO(pkasting): Really this should crossfade between states so it could |
| 138 // handle the case of having a non-NULL |normal_set_|. | 138 // handle the case of having a non-NULL |normal_set_|. |
| 139 canvas->SaveLayerAlpha(static_cast<uint8>( | 139 canvas->SaveLayerAlpha(static_cast<uint8>( |
| 140 button->GetAnimation()->CurrentValueBetween(0, 255))); | 140 button->GetAnimation()->CurrentValueBetween(0, 255))); |
| 141 canvas->sk_canvas()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); | |
| 142 Paint(view, canvas, *set); | 141 Paint(view, canvas, *set); |
| 143 canvas->Restore(); | 142 canvas->Restore(); |
| 144 } else { | 143 } else { |
| 145 Paint(view, canvas, *set); | 144 Paint(view, canvas, *set); |
| 146 } | 145 } |
| 147 } | 146 } |
| 148 } | 147 } |
| 149 | 148 |
| 150 void TextButtonBorder::Paint(const View& view, | 149 void TextButtonBorder::Paint(const View& view, |
| 151 gfx::Canvas* canvas, | 150 gfx::Canvas* canvas, |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 // Windows may paint a dotted focus rect in | 867 // Windows may paint a dotted focus rect in |
| 869 // NativeTextButton::OnPaintFocusBorder. To avoid getting two focus | 868 // NativeTextButton::OnPaintFocusBorder. To avoid getting two focus |
| 870 // indications (A dotted rect and a highlighted border) only set is_focused on | 869 // indications (A dotted rect and a highlighted border) only set is_focused on |
| 871 // non windows platforms. | 870 // non windows platforms. |
| 872 params->button.is_focused = HasFocus() && | 871 params->button.is_focused = HasFocus() && |
| 873 (focusable() || IsAccessibilityFocusable()); | 872 (focusable() || IsAccessibilityFocusable()); |
| 874 #endif | 873 #endif |
| 875 } | 874 } |
| 876 | 875 |
| 877 } // namespace views | 876 } // namespace views |
| OLD | NEW |