| 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/label_button_border.h" | 5 #include "ui/views/controls/button/label_button_border.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
| 10 #include "third_party/skia/include/effects/SkLerpXfermode.h" | 10 #include "third_party/skia/include/effects/SkLerpXfermode.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const ui::NativeTheme::ExtraParams& extra) { | 51 const ui::NativeTheme::ExtraParams& extra) { |
| 52 if (border->style() == Button::STYLE_NATIVE_TEXTBUTTON) { | 52 if (border->style() == Button::STYLE_NATIVE_TEXTBUTTON) { |
| 53 theme->Paint(canvas->sk_canvas(), part, state, rect, extra); | 53 theme->Paint(canvas->sk_canvas(), part, state, rect, extra); |
| 54 } else { | 54 } else { |
| 55 Painter* painter = | 55 Painter* painter = |
| 56 border->GetPainter(extra.button.is_focused, GetButtonState(state)); | 56 border->GetPainter(extra.button.is_focused, GetButtonState(state)); |
| 57 // Paint any corresponding unfocused painter if there is no focused painter. | 57 // Paint any corresponding unfocused painter if there is no focused painter. |
| 58 if (!painter && extra.button.is_focused) | 58 if (!painter && extra.button.is_focused) |
| 59 painter = border->GetPainter(false, GetButtonState(state)); | 59 painter = border->GetPainter(false, GetButtonState(state)); |
| 60 if (painter) | 60 if (painter) |
| 61 painter->Paint(canvas, rect.size()); | 61 Painter::PaintPainterAt(canvas, painter, rect); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 LabelButtonBorder::LabelButtonBorder(Button::ButtonStyle style) | 67 LabelButtonBorder::LabelButtonBorder(Button::ButtonStyle style) |
| 68 : style_(style) { | 68 : style_(style) { |
| 69 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 69 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 70 const gfx::Insets insets(kButtonInsets, | 70 const gfx::Insets insets(kButtonInsets, |
| 71 kButtonInsets, | 71 kButtonInsets, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return painters_[focused ? 1 : 0][state].get(); | 174 return painters_[focused ? 1 : 0][state].get(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void LabelButtonBorder::SetPainter(bool focused, | 177 void LabelButtonBorder::SetPainter(bool focused, |
| 178 Button::ButtonState state, | 178 Button::ButtonState state, |
| 179 Painter* painter) { | 179 Painter* painter) { |
| 180 painters_[focused ? 1 : 0][state].reset(painter); | 180 painters_[focused ? 1 : 0][state].reset(painter); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace views | 183 } // namespace views |
| OLD | NEW |