| 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/slider.h" | 5 #include "ui/views/controls/slider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // button slides to the left most or right most position. | 192 // button slides to the left most or right most position. |
| 193 const int kBarInsetX = 2; | 193 const int kBarInsetX = 2; |
| 194 int bar_width = content.width() - kBarInsetX * 2; | 194 int bar_width = content.width() - kBarInsetX * 2; |
| 195 int bar_cy = content.height() / 2 - bar_height_ / 2; | 195 int bar_cy = content.height() / 2 - bar_height_ / 2; |
| 196 | 196 |
| 197 int w = content.width() - thumb_->width(); | 197 int w = content.width() - thumb_->width(); |
| 198 int full = value * w; | 198 int full = value * w; |
| 199 int middle = std::max(full, images_[LEFT]->width()); | 199 int middle = std::max(full, images_[LEFT]->width()); |
| 200 | 200 |
| 201 canvas->Save(); | 201 canvas->Save(); |
| 202 canvas->Translate(gfx::Point(kBarInsetX, bar_cy)); | 202 canvas->Translate(gfx::Vector2d(kBarInsetX, bar_cy)); |
| 203 canvas->DrawImageInt(*images_[LEFT], 0, 0); | 203 canvas->DrawImageInt(*images_[LEFT], 0, 0); |
| 204 canvas->DrawImageInt(*images_[RIGHT], | 204 canvas->DrawImageInt(*images_[RIGHT], |
| 205 bar_width - images_[RIGHT]->width(), | 205 bar_width - images_[RIGHT]->width(), |
| 206 0); | 206 0); |
| 207 canvas->TileImageInt(*images_[CENTER_LEFT], | 207 canvas->TileImageInt(*images_[CENTER_LEFT], |
| 208 images_[LEFT]->width(), | 208 images_[LEFT]->width(), |
| 209 0, | 209 0, |
| 210 middle - images_[LEFT]->width(), | 210 middle - images_[LEFT]->width(), |
| 211 bar_height_); | 211 bar_height_); |
| 212 canvas->TileImageInt(*images_[CENTER_RIGHT], | 212 canvas->TileImageInt(*images_[CENTER_RIGHT], |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) { | 321 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) { |
| 322 if (!focus_border_color_) { | 322 if (!focus_border_color_) { |
| 323 View::OnPaintFocusBorder(canvas); | 323 View::OnPaintFocusBorder(canvas); |
| 324 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 324 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
| 325 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), | 325 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), |
| 326 focus_border_color_); | 326 focus_border_color_); |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace views | 330 } // namespace views |
| OLD | NEW |