| 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/views/controls/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 SkPath path; | 850 SkPath path; |
| 851 // This epsilon makes sure that all the aliasing pixels are slightly more | 851 // This epsilon makes sure that all the aliasing pixels are slightly more |
| 852 // than half full. Otherwise, rounding issues cause some to be considered | 852 // than half full. Otherwise, rounding issues cause some to be considered |
| 853 // slightly less than half full and come out a little lighter. | 853 // slightly less than half full and come out a little lighter. |
| 854 const SkScalar kEpsilon = 0.0001f; | 854 const SkScalar kEpsilon = 0.0001f; |
| 855 path.moveTo(x - kEpsilon, y); | 855 path.moveTo(x - kEpsilon, y); |
| 856 path.rLineTo(height, height); | 856 path.rLineTo(height, height); |
| 857 path.rLineTo(2 * kEpsilon, 0); | 857 path.rLineTo(2 * kEpsilon, 0); |
| 858 path.rLineTo(height, -height); | 858 path.rLineTo(height, -height); |
| 859 path.close(); | 859 path.close(); |
| 860 cc::PaintFlags paint; | 860 cc::PaintFlags flags; |
| 861 SkColor arrow_color = GetNativeTheme()->GetSystemColor( | 861 SkColor arrow_color = GetNativeTheme()->GetSystemColor( |
| 862 ui::NativeTheme::kColorId_ButtonEnabledColor); | 862 ui::NativeTheme::kColorId_ButtonEnabledColor); |
| 863 if (!enabled()) | 863 if (!enabled()) |
| 864 arrow_color = SkColorSetA(arrow_color, gfx::kDisabledControlAlpha); | 864 arrow_color = SkColorSetA(arrow_color, gfx::kDisabledControlAlpha); |
| 865 paint.setColor(arrow_color); | 865 flags.setColor(arrow_color); |
| 866 paint.setAntiAlias(true); | 866 flags.setAntiAlias(true); |
| 867 canvas->DrawPath(path, paint); | 867 canvas->DrawPath(path, flags); |
| 868 } else { | 868 } else { |
| 869 canvas->DrawImageInt(arrow_image_, arrow_bounds.x(), arrow_bounds.y()); | 869 canvas->DrawImageInt(arrow_image_, arrow_bounds.x(), arrow_bounds.y()); |
| 870 } | 870 } |
| 871 } | 871 } |
| 872 | 872 |
| 873 void Combobox::PaintButtons(gfx::Canvas* canvas) { | 873 void Combobox::PaintButtons(gfx::Canvas* canvas) { |
| 874 DCHECK(style_ == STYLE_ACTION); | 874 DCHECK(style_ == STYLE_ACTION); |
| 875 | 875 |
| 876 gfx::ScopedRTLFlipCanvas scoped_canvas(canvas, width()); | 876 gfx::ScopedRTLFlipCanvas scoped_canvas(canvas, width()); |
| 877 | 877 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 const int kMdPaddingWidth = 8; | 1009 const int kMdPaddingWidth = 8; |
| 1010 int arrow_pad = UseMd() ? kMdPaddingWidth | 1010 int arrow_pad = UseMd() ? kMdPaddingWidth |
| 1011 : PlatformStyle::kComboboxNormalArrowPadding; | 1011 : PlatformStyle::kComboboxNormalArrowPadding; |
| 1012 int padding = style_ == STYLE_NORMAL | 1012 int padding = style_ == STYLE_NORMAL |
| 1013 ? arrow_pad * 2 | 1013 ? arrow_pad * 2 |
| 1014 : kActionLeftPadding + kActionRightPadding; | 1014 : kActionLeftPadding + kActionRightPadding; |
| 1015 return ArrowSize().width() + padding; | 1015 return ArrowSize().width() + padding; |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 } // namespace views | 1018 } // namespace views |
| OLD | NEW |