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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 SkColor text_color = (show_multiple_icon_states_ && | 466 SkColor text_color = (show_multiple_icon_states_ && |
467 (state() == STATE_HOVERED || state() == STATE_PRESSED)) ? | 467 (state() == STATE_HOVERED || state() == STATE_PRESSED)) ? |
468 color_hover_ : color_; | 468 color_hover_ : color_; |
469 | 469 |
470 int draw_string_flags = gfx::Canvas::DefaultCanvasTextAlignment() | | 470 int draw_string_flags = gfx::Canvas::DefaultCanvasTextAlignment() | |
471 ComputeCanvasStringFlags(); | 471 ComputeCanvasStringFlags(); |
472 | 472 |
473 if (mode == PB_FOR_DRAG) { | 473 if (mode == PB_FOR_DRAG) { |
474 // Disable sub-pixel rendering as background is transparent. | 474 // Disable sub-pixel rendering as background is transparent. |
475 draw_string_flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; | 475 draw_string_flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; |
476 } | |
477 | 476 |
478 if (draw_string_flags & gfx::Canvas::NO_SUBPIXEL_RENDERING) { | |
479 #if defined(OS_WIN) | 477 #if defined(OS_WIN) |
480 // TODO(erg): Either port DrawStringWithHalo to linux or find an | 478 // TODO(erg): Either port DrawStringWithHalo to linux or find an |
481 // alternative here. | 479 // alternative here. |
482 canvas->DrawStringWithHalo(text_, font_, text_color, color_highlight_, | 480 canvas->DrawStringWithHalo(text_, font_, text_color, color_highlight_, |
483 text_bounds.x(), text_bounds.y(), text_bounds.width(), | 481 text_bounds.x(), text_bounds.y(), text_bounds.width(), |
484 text_bounds.height(), draw_string_flags); | 482 text_bounds.height(), draw_string_flags); |
485 #else | 483 #else |
486 canvas->DrawStringInt(text_, | 484 canvas->DrawStringInt(text_, |
487 font_, | 485 font_, |
488 text_color, | 486 text_color, |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 // when not using NativeThemeWin. | 811 // when not using NativeThemeWin. |
814 #if defined(OS_WIN) | 812 #if defined(OS_WIN) |
815 if (GetNativeTheme() == ui::NativeThemeWin::instance()) | 813 if (GetNativeTheme() == ui::NativeThemeWin::instance()) |
816 return; | 814 return; |
817 #endif | 815 #endif |
818 params->button.is_focused = HasFocus() && | 816 params->button.is_focused = HasFocus() && |
819 (focusable() || IsAccessibilityFocusable()); | 817 (focusable() || IsAccessibilityFocusable()); |
820 } | 818 } |
821 | 819 |
822 } // namespace views | 820 } // namespace views |
OLD | NEW |