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

Side by Side Diff: ui/views/controls/slider.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix step one more time Created 8 years, 1 month 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/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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698