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

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

Issue 9562038: ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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
OLDNEW
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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 SkColor text_color = (show_multiple_icon_states_ && 509 SkColor text_color = (show_multiple_icon_states_ &&
510 (state() == BS_HOT || state() == BS_PUSHED)) ? color_hover_ : color_; 510 (state() == BS_HOT || state() == BS_PUSHED)) ? color_hover_ : color_;
511 511
512 int draw_string_flags = gfx::CanvasSkia::DefaultCanvasTextAlignment() | 512 int draw_string_flags = gfx::CanvasSkia::DefaultCanvasTextAlignment() |
513 ComputeCanvasStringFlags(); 513 ComputeCanvasStringFlags();
514 514
515 if (mode == PB_FOR_DRAG) { 515 if (mode == PB_FOR_DRAG) {
516 #if defined(OS_WIN) 516 #if defined(OS_WIN)
517 // TODO(erg): Either port DrawStringWithHalo to linux or find an 517 // TODO(erg): Either port DrawStringWithHalo to linux or find an
518 // alternative here. 518 // alternative here.
519 canvas->AsCanvasSkia()->DrawStringWithHalo( 519 canvas->DrawStringWithHalo(
520 text_, font_, text_color, color_highlight_, text_bounds.x(), 520 text_, font_, text_color, color_highlight_, text_bounds.x(),
521 text_bounds.y(), text_bounds.width(), text_bounds.height(), 521 text_bounds.y(), text_bounds.width(), text_bounds.height(),
522 draw_string_flags); 522 draw_string_flags);
523 #else 523 #else
524 canvas->DrawStringInt(text_, 524 canvas->DrawStringInt(text_,
525 font_, 525 font_,
526 text_color, 526 text_color,
527 text_bounds.x(), 527 text_bounds.x(),
528 text_bounds.y(), 528 text_bounds.y(),
529 text_bounds.width(), 529 text_bounds.width(),
530 text_bounds.height(), 530 text_bounds.height(),
531 draw_string_flags); 531 draw_string_flags);
532 #endif 532 #endif
533 } else if (has_text_halo_) { 533 } else if (has_text_halo_) {
534 canvas->AsCanvasSkia()->DrawStringWithHalo( 534 canvas->DrawStringWithHalo(
535 text_, font_, text_color, text_halo_color_, 535 text_, font_, text_color, text_halo_color_,
536 text_bounds.x(), text_bounds.y(), text_bounds.width(), 536 text_bounds.x(), text_bounds.y(), text_bounds.width(),
537 text_bounds.height(), draw_string_flags); 537 text_bounds.height(), draw_string_flags);
538 } else if (has_shadow_) { 538 } else if (has_shadow_) {
539 SkColor shadow_color = 539 SkColor shadow_color =
540 GetWidget()->IsActive() ? active_text_shadow_color_ : 540 GetWidget()->IsActive() ? active_text_shadow_color_ :
541 inactive_text_shadow_color_; 541 inactive_text_shadow_color_;
542 canvas->DrawStringInt(text_, 542 canvas->DrawStringInt(text_,
543 font_, 543 font_,
544 shadow_color, 544 shadow_color,
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 #endif 834 #endif
835 } 835 }
836 836
837 void NativeTextButton::GetExtraParams( 837 void NativeTextButton::GetExtraParams(
838 gfx::NativeTheme::ExtraParams* params) const { 838 gfx::NativeTheme::ExtraParams* params) const {
839 TextButton::GetExtraParams(params); 839 TextButton::GetExtraParams(params);
840 params->button.has_border = true; 840 params->button.has_border = true;
841 } 841 }
842 842
843 } // namespace views 843 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698