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

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

Issue 1187503002: Constrain native theme menu list arrow to the paint rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typeo Created 5 years, 6 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 | « no previous file | no next file » | 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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 button.background_color = menu_list.background_color; 765 button.background_color = menu_list.background_color;
766 button.has_border = menu_list.has_border; 766 button.has_border = menu_list.has_border;
767 PaintButton(canvas, state, rect, button); 767 PaintButton(canvas, state, rect, button);
768 } 768 }
769 769
770 SkPaint paint; 770 SkPaint paint;
771 paint.setColor(SK_ColorBLACK); 771 paint.setColor(SK_ColorBLACK);
772 paint.setAntiAlias(true); 772 paint.setAntiAlias(true);
773 paint.setStyle(SkPaint::kFill_Style); 773 paint.setStyle(SkPaint::kFill_Style);
774 774
775 static const int arrow_width = 6;
776 static const int arrow_height = 6;
sadrul 2015/06/16 14:25:52 This should be like: const int kArrowWidth = 6;
777
778 gfx::Rect arrow(
779 menu_list.arrow_x,
780 menu_list.arrow_y - (arrow_height / 2),
781 arrow_width,
782 arrow_height);
783
784 // Constrain to the paint rect.
785 arrow.Intersect(rect);
786
775 SkPath path; 787 SkPath path;
776 path.moveTo(menu_list.arrow_x, menu_list.arrow_y - 3); 788 path.moveTo(arrow.x(), arrow.y());
777 path.rLineTo(6, 0); 789 path.lineTo(arrow.right(), arrow.y());
778 path.rLineTo(-3, 6); 790 path.lineTo(arrow.x() + arrow.width() / 2, arrow.bottom());
779 path.close(); 791 path.close();
780 canvas->drawPath(path, paint); 792 canvas->drawPath(path, paint);
781 } 793 }
782 794
783 void NativeThemeBase::PaintMenuPopupBackground( 795 void NativeThemeBase::PaintMenuPopupBackground(
784 SkCanvas* canvas, 796 SkCanvas* canvas,
785 const gfx::Size& size, 797 const gfx::Size& size,
786 const MenuBackgroundExtraParams& menu_background) const { 798 const MenuBackgroundExtraParams& menu_background) const {
787 canvas->drawColor(kMenuPopupBackgroundColor, SkXfermode::kSrc_Mode); 799 canvas->drawColor(kMenuPopupBackgroundColor, SkXfermode::kSrc_Mode);
788 } 800 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 1093 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
1082 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); 1094 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
1083 1095
1084 if (hsv1[2] + hsv2[2] > 1.0) 1096 if (hsv1[2] + hsv2[2] > 1.0)
1085 diff = -diff; 1097 diff = -diff;
1086 1098
1087 return SaturateAndBrighten(hsv2, -0.2f, diff); 1099 return SaturateAndBrighten(hsv2, -0.2f, diff);
1088 } 1100 }
1089 1101
1090 } // namespace ui 1102 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698