OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/button/text_button.h" | 5 #include "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 "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "ui/base/animation/throb_animation.h" | 11 #include "ui/base/animation/throb_animation.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 void TextButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { | 283 void TextButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
284 if (mode == PB_NORMAL) { | 284 if (mode == PB_NORMAL) { |
285 OnPaintBackground(canvas); | 285 OnPaintBackground(canvas); |
286 | 286 |
287 if (show_multiple_icon_states_ && hover_animation_->is_animating()) { | 287 if (show_multiple_icon_states_ && hover_animation_->is_animating()) { |
288 // Draw the hover bitmap into an offscreen buffer, then blend it | 288 // Draw the hover bitmap into an offscreen buffer, then blend it |
289 // back into the current canvas. | 289 // back into the current canvas. |
290 canvas->SaveLayerAlpha( | 290 canvas->SaveLayerAlpha( |
291 static_cast<int>(hover_animation_->GetCurrentValue() * 255)); | 291 static_cast<int>(hover_animation_->GetCurrentValue() * 255)); |
292 canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, | 292 canvas->AsCanvasSkia()->skia_canvas()->drawARGB( |
293 SkXfermode::kClear_Mode); | 293 0, 255, 255, 255, SkXfermode::kClear_Mode); |
294 OnPaintBorder(canvas); | 294 OnPaintBorder(canvas); |
295 canvas->Restore(); | 295 canvas->Restore(); |
296 } else if ((show_multiple_icon_states_ && | 296 } else if ((show_multiple_icon_states_ && |
297 (state_ == BS_HOT || state_ == BS_PUSHED)) || | 297 (state_ == BS_HOT || state_ == BS_PUSHED)) || |
298 (state_ == BS_NORMAL && normal_has_border_)) { | 298 (state_ == BS_NORMAL && normal_has_border_)) { |
299 OnPaintBorder(canvas); | 299 OnPaintBorder(canvas); |
300 } | 300 } |
301 | 301 |
302 OnPaintFocusBorder(canvas); | 302 OnPaintFocusBorder(canvas); |
303 } | 303 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 486 |
487 std::string TextButton::GetClassName() const { | 487 std::string TextButton::GetClassName() const { |
488 return kViewClassName; | 488 return kViewClassName; |
489 } | 489 } |
490 | 490 |
491 void TextButton::OnPaint(gfx::Canvas* canvas) { | 491 void TextButton::OnPaint(gfx::Canvas* canvas) { |
492 PaintButton(canvas, PB_NORMAL); | 492 PaintButton(canvas, PB_NORMAL); |
493 } | 493 } |
494 | 494 |
495 } // namespace views | 495 } // namespace views |
OLD | NEW |