Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 | 288 |
| 289 gfx::Point thumb_center(x, content.height() / 2); | 289 gfx::Point thumb_center(x, content.height() / 2); |
| 290 | 290 |
| 291 // Paint the thumb highlight if it exists. | 291 // Paint the thumb highlight if it exists. |
| 292 const int thumb_highlight_radius = | 292 const int thumb_highlight_radius = |
| 293 HasFocus() ? kThumbHighlightRadius : thumb_highlight_radius_; | 293 HasFocus() ? kThumbHighlightRadius : thumb_highlight_radius_; |
| 294 if (is_active_ && thumb_highlight_radius > kThumbRadius) { | 294 if (is_active_ && thumb_highlight_radius > kThumbRadius) { |
| 295 cc::PaintFlags highlight; | 295 cc::PaintFlags highlight; |
| 296 SkColor kHighlightColor = SkColorSetA(kActiveColor, kHighlightColorAlpha); | 296 SkColor kHighlightColor = SkColorSetA(kActiveColor, kHighlightColorAlpha); |
| 297 highlight.setColor(kHighlightColor); | 297 highlight.setColor(kHighlightColor); |
| 298 highlight.setFlags(cc::PaintFlags::kAntiAlias_Flag); | 298 highlight.setAntiAlias(true); |
| 299 canvas->DrawCircle(thumb_center, thumb_highlight_radius, highlight); | 299 canvas->DrawCircle(thumb_center, thumb_highlight_radius, highlight); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // Paint the thumb of the slider. | 302 // Paint the thumb of the slider. |
| 303 cc::PaintFlags flags; | 303 cc::PaintFlags flags; |
| 304 flags.setColor(current_thumb_color); | 304 flags.setColor(current_thumb_color); |
| 305 flags.setFlags(cc::PaintFlags::kAntiAlias_Flag); | 305 flags.setAntiAlias(true); |
|
enne (OOO)
2017/02/27 01:56:21
Antialiasing is the only use of setFlags anywhere,
| |
| 306 | 306 |
| 307 if (!is_active_) { | 307 if (!is_active_) { |
| 308 flags.setStrokeWidth(kThumbStroke); | 308 flags.setStrokeWidth(kThumbStroke); |
| 309 flags.setStyle(cc::PaintFlags::kStroke_Style); | 309 flags.setStyle(cc::PaintFlags::kStroke_Style); |
| 310 } | 310 } |
| 311 canvas->DrawCircle( | 311 canvas->DrawCircle( |
| 312 thumb_center, | 312 thumb_center, |
| 313 is_active_ ? kThumbRadius : (kThumbRadius - kThumbStroke / 2), flags); | 313 is_active_ ? kThumbRadius : (kThumbRadius - kThumbStroke / 2), flags); |
| 314 | 314 |
| 315 OnPaintFocus(canvas); | 315 OnPaintFocus(canvas); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 343 event->SetHandled(); | 343 event->SetHandled(); |
| 344 if (event->details().touch_points() <= 1) | 344 if (event->details().touch_points() <= 1) |
| 345 OnSliderDragEnded(); | 345 OnSliderDragEnded(); |
| 346 break; | 346 break; |
| 347 default: | 347 default: |
| 348 break; | 348 break; |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace views | 352 } // namespace views |
| OLD | NEW |