| 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/native_theme/native_theme_base.h" | 5 #include "ui/native_theme/native_theme_base.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 break; | 226 break; |
| 227 case kScrollbarDownArrow: | 227 case kScrollbarDownArrow: |
| 228 case kScrollbarUpArrow: | 228 case kScrollbarUpArrow: |
| 229 case kScrollbarLeftArrow: | 229 case kScrollbarLeftArrow: |
| 230 case kScrollbarRightArrow: | 230 case kScrollbarRightArrow: |
| 231 if (scrollbar_button_length_ > 0) | 231 if (scrollbar_button_length_ > 0) |
| 232 PaintArrowButton(canvas, rect, part, state); | 232 PaintArrowButton(canvas, rect, part, state); |
| 233 break; | 233 break; |
| 234 case kScrollbarHorizontalThumb: | 234 case kScrollbarHorizontalThumb: |
| 235 case kScrollbarVerticalThumb: | 235 case kScrollbarVerticalThumb: |
| 236 PaintScrollbarThumb(canvas, part, state, rect); | 236 PaintScrollbarThumb(canvas, part, state, extra.scrollbar_thumb, rect); |
| 237 break; | 237 break; |
| 238 case kScrollbarHorizontalTrack: | 238 case kScrollbarHorizontalTrack: |
| 239 case kScrollbarVerticalTrack: | 239 case kScrollbarVerticalTrack: |
| 240 PaintScrollbarTrack(canvas, part, state, extra.scrollbar_track, rect); | 240 PaintScrollbarTrack(canvas, part, state, extra.scrollbar_track, rect); |
| 241 break; | 241 break; |
| 242 case kScrollbarHorizontalGripper: | 242 case kScrollbarHorizontalGripper: |
| 243 case kScrollbarVerticalGripper: | 243 case kScrollbarVerticalGripper: |
| 244 // Invoked by views scrollbar code, don't care about for non-win | 244 // Invoked by views scrollbar code, don't care about for non-win |
| 245 // implementations, so no NOTIMPLEMENTED. | 245 // implementations, so no NOTIMPLEMENTED. |
| 246 break; | 246 break; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 paint.setColor(SaturateAndBrighten(track_hsv, 0, 0)); | 425 paint.setColor(SaturateAndBrighten(track_hsv, 0, 0)); |
| 426 canvas->drawIRect(skrect, paint); | 426 canvas->drawIRect(skrect, paint); |
| 427 | 427 |
| 428 SkScalar thumb_hsv[3]; | 428 SkScalar thumb_hsv[3]; |
| 429 SkColorToHSV(thumb_inactive_color_, thumb_hsv); | 429 SkColorToHSV(thumb_inactive_color_, thumb_hsv); |
| 430 | 430 |
| 431 paint.setColor(OutlineColor(track_hsv, thumb_hsv)); | 431 paint.setColor(OutlineColor(track_hsv, thumb_hsv)); |
| 432 DrawBox(canvas, rect, paint); | 432 DrawBox(canvas, rect, paint); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void NativeThemeBase::PaintScrollbarThumb(SkCanvas* canvas, | 435 void NativeThemeBase::PaintScrollbarThumb( |
| 436 Part part, | 436 SkCanvas* canvas, |
| 437 State state, | 437 Part part, |
| 438 const gfx::Rect& rect) const { | 438 State state, |
| 439 const ScrollbarThumbExtraParams& extra_params, |
| 440 const gfx::Rect& rect) const { |
| 439 const bool hovered = state == kHovered; | 441 const bool hovered = state == kHovered; |
| 440 const int midx = rect.x() + rect.width() / 2; | 442 const int midx = rect.x() + rect.width() / 2; |
| 441 const int midy = rect.y() + rect.height() / 2; | 443 const int midy = rect.y() + rect.height() / 2; |
| 442 const bool vertical = part == kScrollbarVerticalThumb; | 444 const bool vertical = part == kScrollbarVerticalThumb; |
| 443 | 445 |
| 444 SkScalar thumb[3]; | 446 SkScalar thumb[3]; |
| 445 SkColorToHSV(hovered ? thumb_active_color_ : thumb_inactive_color_, thumb); | 447 SkColorToHSV(hovered ? thumb_active_color_ : thumb_inactive_color_, thumb); |
| 446 | 448 |
| 447 SkPaint paint; | 449 SkPaint paint; |
| 448 paint.setColor(SaturateAndBrighten(thumb, 0, 0.02f)); | 450 paint.setColor(SaturateAndBrighten(thumb, 0, 0.02f)); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); | 1037 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); |
| 1036 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); | 1038 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); |
| 1037 | 1039 |
| 1038 if (hsv1[2] + hsv2[2] > 1.0) | 1040 if (hsv1[2] + hsv2[2] > 1.0) |
| 1039 diff = -diff; | 1041 diff = -diff; |
| 1040 | 1042 |
| 1041 return SaturateAndBrighten(hsv2, -0.2f, diff); | 1043 return SaturateAndBrighten(hsv2, -0.2f, diff); |
| 1042 } | 1044 } |
| 1043 | 1045 |
| 1044 } // namespace ui | 1046 } // namespace ui |
| OLD | NEW |