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

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

Issue 12041085: Fix menu corners: the menu background was being painted as a rect when in fact, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/native_theme/native_theme_base.h ('k') | ui/views/controls/menu/menu_config.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 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 break; 169 break;
170 case kMenuList: 170 case kMenuList:
171 PaintMenuList(canvas, state, rect, extra.menu_list); 171 PaintMenuList(canvas, state, rect, extra.menu_list);
172 break; 172 break;
173 case kMenuCheck: 173 case kMenuCheck:
174 case kMenuCheckBackground: 174 case kMenuCheckBackground:
175 case kMenuPopupArrow: 175 case kMenuPopupArrow:
176 NOTIMPLEMENTED(); 176 NOTIMPLEMENTED();
177 break; 177 break;
178 case kMenuPopupBackground: 178 case kMenuPopupBackground:
179 PaintMenuPopupBackground(canvas, rect.size()); 179 PaintMenuPopupBackground(canvas, rect.size(), extra.menu_background);
180 break; 180 break;
181 case kMenuPopupGutter: 181 case kMenuPopupGutter:
182 case kMenuPopupSeparator: 182 case kMenuPopupSeparator:
183 NOTIMPLEMENTED(); 183 NOTIMPLEMENTED();
184 break; 184 break;
185 case kMenuItemBackground: 185 case kMenuItemBackground:
186 PaintMenuItemBackground(canvas, state, rect, extra.menu_list); 186 PaintMenuItemBackground(canvas, state, rect, extra.menu_list);
187 break; 187 break;
188 case kProgressBar: 188 case kProgressBar:
189 PaintProgressBar(canvas, state, rect, extra.progress_bar); 189 PaintProgressBar(canvas, state, rect, extra.progress_bar);
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 paint.setStyle(SkPaint::kFill_Style); 860 paint.setStyle(SkPaint::kFill_Style);
861 861
862 SkPath path; 862 SkPath path;
863 path.moveTo(menu_list.arrow_x, menu_list.arrow_y - 3); 863 path.moveTo(menu_list.arrow_x, menu_list.arrow_y - 3);
864 path.rLineTo(6, 0); 864 path.rLineTo(6, 0);
865 path.rLineTo(-3, 6); 865 path.rLineTo(-3, 6);
866 path.close(); 866 path.close();
867 canvas->drawPath(path, paint); 867 canvas->drawPath(path, paint);
868 } 868 }
869 869
870 void NativeThemeBase::PaintMenuPopupBackground(SkCanvas* canvas, 870 void NativeThemeBase::PaintMenuPopupBackground(
871 const gfx::Size& size) const { 871 SkCanvas* canvas,
872 const gfx::Size& size,
873 const MenuBackgroundExtraParams& menu_background) const {
872 canvas->drawColor(kMenuPopupBackgroundColor, SkXfermode::kSrc_Mode); 874 canvas->drawColor(kMenuPopupBackgroundColor, SkXfermode::kSrc_Mode);
873 } 875 }
874 876
875 void NativeThemeBase::PaintMenuItemBackground( 877 void NativeThemeBase::PaintMenuItemBackground(
876 SkCanvas* canvas, 878 SkCanvas* canvas,
877 State state, 879 State state,
878 const gfx::Rect& rect, 880 const gfx::Rect& rect,
879 const MenuListExtraParams& menu_list) const { 881 const MenuListExtraParams& menu_list) const {
880 // By default don't draw anything over the normal background. 882 // By default don't draw anything over the normal background.
881 } 883 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 1132 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
1131 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); 1133 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
1132 1134
1133 if (hsv1[2] + hsv2[2] > 1.0) 1135 if (hsv1[2] + hsv2[2] > 1.0)
1134 diff = -diff; 1136 diff = -diff;
1135 1137
1136 return SaturateAndBrighten(hsv2, -0.2f, diff); 1138 return SaturateAndBrighten(hsv2, -0.2f, diff);
1137 } 1139 }
1138 1140
1139 } // namespace ui 1141 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_base.h ('k') | ui/views/controls/menu/menu_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698