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

Side by Side Diff: views/controls/button/text_button.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/background.cc ('k') | views/controls/menu/menu_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « views/background.cc ('k') | views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698