Index: views/controls/button/text_button.cc |
=================================================================== |
--- views/controls/button/text_button.cc (revision 88685) |
+++ views/controls/button/text_button.cc (working copy) |
@@ -653,7 +653,13 @@ |
void TextButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
TextButtonBase::PaintButton(canvas, mode); |
- const SkBitmap& icon = GetImageToPaint(); |
+ SkBitmap icon = icon_; |
+ if (show_multiple_icon_states_) { |
+ if (has_hover_icon_ && (state() == BS_HOT)) |
+ icon = icon_hover_; |
+ else if (has_pushed_icon_ && (state() == BS_PUSHED)) |
+ icon = icon_pushed_; |
+ } |
if (icon.width() > 0) { |
gfx::Rect text_bounds = GetTextBounds(); |
@@ -696,7 +702,14 @@ |
gfx::Rect TextButton::GetTextBounds() const { |
int extra_width = 0; |
- const SkBitmap& icon = GetImageToPaint(); |
+ SkBitmap icon = icon_; |
+ if (show_multiple_icon_states_) { |
+ if (has_hover_icon_ && (state() == BS_HOT)) |
+ icon = icon_hover_; |
+ else if (has_pushed_icon_ && (state() == BS_PUSHED)) |
+ icon = icon_pushed_; |
+ } |
+ |
if (icon.width() > 0) |
extra_width = icon.width() + (text_.empty() ? 0 : icon_text_spacing_); |
@@ -714,14 +727,4 @@ |
return bounds; |
} |
-const SkBitmap& TextButton::GetImageToPaint() const { |
- if (show_multiple_icon_states_) { |
- if (has_hover_icon_ && (state() == BS_HOT)) |
- return icon_hover_; |
- if (has_pushed_icon_ && (state() == BS_PUSHED)) |
- return icon_pushed_; |
- } |
- return icon_; |
-} |
- |
} // namespace views |