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

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

Issue 2628043002: Gtk3: Render a GtkHeaderBar as the background of the tab strip (Closed)
Patch Set: Guard kFrameTopArea with #if defined(OS_LINUX) && !defined(OS_CHROMEOS) Created 3 years, 11 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/views/window/custom_frame_view.cc » ('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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return; 165 return;
166 166
167 canvas->save(); 167 canvas->save();
168 canvas->clipRect(gfx::RectToSkRect(rect)); 168 canvas->clipRect(gfx::RectToSkRect(rect));
169 169
170 switch (part) { 170 switch (part) {
171 // Please keep these in the order of NativeTheme::Part. 171 // Please keep these in the order of NativeTheme::Part.
172 case kCheckbox: 172 case kCheckbox:
173 PaintCheckbox(canvas, state, rect, extra.button); 173 PaintCheckbox(canvas, state, rect, extra.button);
174 break; 174 break;
175 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
176 case kFrameTopArea:
177 PaintFrameTopArea(canvas, state, rect, extra.frame_top_area);
178 break;
179 #endif
175 case kInnerSpinButton: 180 case kInnerSpinButton:
176 PaintInnerSpinButton(canvas, state, rect, extra.inner_spin); 181 PaintInnerSpinButton(canvas, state, rect, extra.inner_spin);
177 break; 182 break;
178 case kMenuList: 183 case kMenuList:
179 PaintMenuList(canvas, state, rect, extra.menu_list); 184 PaintMenuList(canvas, state, rect, extra.menu_list);
180 break; 185 break;
181 case kMenuPopupBackground: 186 case kMenuPopupBackground:
182 PaintMenuPopupBackground(canvas, rect.size(), extra.menu_background); 187 PaintMenuPopupBackground(canvas, rect.size(), extra.menu_background);
183 break; 188 break;
184 case kMenuItemBackground: 189 case kMenuItemBackground:
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 progress_paint.setStyle(SkPaint::kFill_Style); 896 progress_paint.setStyle(SkPaint::kFill_Style);
892 canvas->drawRect(gfx::RectToSkRect(progress_rect), progress_paint); 897 canvas->drawRect(gfx::RectToSkRect(progress_rect), progress_paint);
893 898
894 // Draw the border. 899 // Draw the border.
895 gfx::RectF border_rect(rect); 900 gfx::RectF border_rect(rect);
896 border_rect.Inset(stroke_width / 2.0f, stroke_width / 2.0f); 901 border_rect.Inset(stroke_width / 2.0f, stroke_width / 2.0f);
897 stroke_paint.setColor(kProgressBorderColor); 902 stroke_paint.setColor(kProgressBorderColor);
898 canvas->drawRect(gfx::RectFToSkRect(border_rect), stroke_paint); 903 canvas->drawRect(gfx::RectFToSkRect(border_rect), stroke_paint);
899 } 904 }
900 905
906 void NativeThemeBase::PaintFrameTopArea(
907 SkCanvas* canvas,
908 State state,
909 const gfx::Rect& rect,
910 const FrameTopAreaExtraParams& frame_top_area) const {
911 SkPaint paint;
912 paint.setColor(frame_top_area.default_background_color);
913 canvas->drawRect(gfx::RectToSkRect(rect), paint);
914 }
915
901 void NativeThemeBase::AdjustCheckboxRadioRectForPadding(SkRect* rect) const { 916 void NativeThemeBase::AdjustCheckboxRadioRectForPadding(SkRect* rect) const {
902 // By default we only take 1px from right and bottom for the drop shadow. 917 // By default we only take 1px from right and bottom for the drop shadow.
903 rect->iset(rect->x(), rect->y(), rect->right() - 1, rect->bottom() - 1); 918 rect->iset(rect->x(), rect->y(), rect->right() - 1, rect->bottom() - 1);
904 } 919 }
905 920
906 SkColor NativeThemeBase::SaturateAndBrighten(SkScalar* hsv, 921 SkColor NativeThemeBase::SaturateAndBrighten(SkScalar* hsv,
907 SkScalar saturate_amount, 922 SkScalar saturate_amount,
908 SkScalar brighten_amount) const { 923 SkScalar brighten_amount) const {
909 SkScalar color[3]; 924 SkScalar color[3];
910 color[0] = hsv[0]; 925 color[0] = hsv[0];
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 1007 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
993 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); 1008 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
994 1009
995 if (hsv1[2] + hsv2[2] > 1.0) 1010 if (hsv1[2] + hsv2[2] > 1.0)
996 diff = -diff; 1011 diff = -diff;
997 1012
998 return SaturateAndBrighten(hsv2, -0.2f, diff); 1013 return SaturateAndBrighten(hsv2, -0.2f, diff);
999 } 1014 }
1000 1015
1001 } // namespace ui 1016 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_base.h ('k') | ui/views/window/custom_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698