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

Side by Side Diff: ui/native_theme/native_theme_base.cc

Issue 2655553003: Native themes: Add menu separator part (Closed)
Patch Set: item->separator Created 3 years, 10 months 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
« no previous file with comments | « ui/native_theme/native_theme_base.h ('k') | ui/native_theme/native_theme_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/native_theme/native_theme_base.h" 5 #include "ui/native_theme/native_theme_base.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 #endif 179 #endif
180 case kInnerSpinButton: 180 case kInnerSpinButton:
181 PaintInnerSpinButton(canvas, state, rect, extra.inner_spin); 181 PaintInnerSpinButton(canvas, state, rect, extra.inner_spin);
182 break; 182 break;
183 case kMenuList: 183 case kMenuList:
184 PaintMenuList(canvas, state, rect, extra.menu_list); 184 PaintMenuList(canvas, state, rect, extra.menu_list);
185 break; 185 break;
186 case kMenuPopupBackground: 186 case kMenuPopupBackground:
187 PaintMenuPopupBackground(canvas, rect.size(), extra.menu_background); 187 PaintMenuPopupBackground(canvas, rect.size(), extra.menu_background);
188 break; 188 break;
189 case kMenuPopupSeparator:
190 PaintMenuSeparator(canvas, state, rect, extra.menu_separator);
191 break;
189 case kMenuItemBackground: 192 case kMenuItemBackground:
190 PaintMenuItemBackground(canvas, state, rect, extra.menu_item); 193 PaintMenuItemBackground(canvas, state, rect, extra.menu_item);
191 break; 194 break;
192 case kProgressBar: 195 case kProgressBar:
193 PaintProgressBar(canvas, state, rect, extra.progress_bar); 196 PaintProgressBar(canvas, state, rect, extra.progress_bar);
194 break; 197 break;
195 case kPushButton: 198 case kPushButton:
196 PaintButton(canvas, state, rect, extra.button); 199 PaintButton(canvas, state, rect, extra.button);
197 break; 200 break;
198 case kRadio: 201 case kRadio:
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 } 772 }
770 773
771 void NativeThemeBase::PaintMenuItemBackground( 774 void NativeThemeBase::PaintMenuItemBackground(
772 SkCanvas* canvas, 775 SkCanvas* canvas,
773 State state, 776 State state,
774 const gfx::Rect& rect, 777 const gfx::Rect& rect,
775 const MenuItemExtraParams& menu_item) const { 778 const MenuItemExtraParams& menu_item) const {
776 // By default don't draw anything over the normal background. 779 // By default don't draw anything over the normal background.
777 } 780 }
778 781
782 void NativeThemeBase::PaintMenuSeparator(
783 SkCanvas* canvas,
784 State state,
785 const gfx::Rect& rect,
786 const MenuSeparatorExtraParams& menu_separator) const {
787 SkPaint paint;
788 paint.setColor(GetSystemColor(ui::NativeTheme::kColorId_MenuSeparatorColor));
789 canvas->drawRect(gfx::RectToSkRect(*menu_separator.paint_rect), paint);
790 }
791
779 void NativeThemeBase::PaintSliderTrack(SkCanvas* canvas, 792 void NativeThemeBase::PaintSliderTrack(SkCanvas* canvas,
780 State state, 793 State state,
781 const gfx::Rect& rect, 794 const gfx::Rect& rect,
782 const SliderExtraParams& slider) const { 795 const SliderExtraParams& slider) const {
783 const int kMidX = rect.x() + rect.width() / 2; 796 const int kMidX = rect.x() + rect.width() / 2;
784 const int kMidY = rect.y() + rect.height() / 2; 797 const int kMidY = rect.y() + rect.height() / 2;
785 798
786 SkPaint paint; 799 SkPaint paint;
787 paint.setColor(kSliderTrackBackgroundColor); 800 paint.setColor(kSliderTrackBackgroundColor);
788 801
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 1020 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
1008 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); 1021 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
1009 1022
1010 if (hsv1[2] + hsv2[2] > 1.0) 1023 if (hsv1[2] + hsv2[2] > 1.0)
1011 diff = -diff; 1024 diff = -diff;
1012 1025
1013 return SaturateAndBrighten(hsv2, -0.2f, diff); 1026 return SaturateAndBrighten(hsv2, -0.2f, diff);
1014 } 1027 }
1015 1028
1016 } // namespace ui 1029 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_base.h ('k') | ui/native_theme/native_theme_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698