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

Side by Side Diff: ui/views/controls/button/toggle_button.cc

Issue 2733363002: Update last few users of deprecated CreateShadowDrawLooper and remove (Closed)
Patch Set: Created 3 years, 9 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/views/bubble/bubble_border.cc ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/button/toggle_button.h" 5 #include "ui/views/controls/button/toggle_button.h"
6 6
7 #include "cc/paint/paint_flags.h" 7 #include "cc/paint/paint_flags.h"
8 #include "third_party/skia/include/core/SkDrawLooper.h" 8 #include "third_party/skia/include/core/SkDrawLooper.h"
9 #include "ui/accessibility/ax_node_data.h" 9 #include "ui/accessibility/ax_node_data.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void OnPaint(gfx::Canvas* canvas) override { 72 void OnPaint(gfx::Canvas* canvas) override {
73 const float dsf = canvas->UndoDeviceScaleFactor(); 73 const float dsf = canvas->UndoDeviceScaleFactor();
74 std::vector<gfx::ShadowValue> shadows; 74 std::vector<gfx::ShadowValue> shadows;
75 gfx::ShadowValue shadow( 75 gfx::ShadowValue shadow(
76 gfx::Vector2d(kShadowOffsetX, kShadowOffsetY), 2 * kShadowBlur, 76 gfx::Vector2d(kShadowOffsetX, kShadowOffsetY), 2 * kShadowBlur,
77 SkColorSetA(GetNativeTheme()->GetSystemColor( 77 SkColorSetA(GetNativeTheme()->GetSystemColor(
78 ui::NativeTheme::kColorId_LabelEnabledColor), 78 ui::NativeTheme::kColorId_LabelEnabledColor),
79 0x99)); 79 0x99));
80 shadows.push_back(shadow.Scale(dsf)); 80 shadows.push_back(shadow.Scale(dsf));
81 cc::PaintFlags thumb_flags; 81 cc::PaintFlags thumb_flags;
82 thumb_flags.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadows)); 82 thumb_flags.setLooper(gfx::CreateShadowDrawLooper(shadows));
83 thumb_flags.setAntiAlias(true); 83 thumb_flags.setAntiAlias(true);
84 const SkColor thumb_on_color = GetNativeTheme()->GetSystemColor( 84 const SkColor thumb_on_color = GetNativeTheme()->GetSystemColor(
85 ui::NativeTheme::kColorId_ProminentButtonColor); 85 ui::NativeTheme::kColorId_ProminentButtonColor);
86 const SkColor thumb_off_color = GetNativeTheme()->GetSystemColor( 86 const SkColor thumb_off_color = GetNativeTheme()->GetSystemColor(
87 ui::NativeTheme::kColorId_DialogBackground); 87 ui::NativeTheme::kColorId_DialogBackground);
88 const SkAlpha blend = static_cast<SkAlpha>(SK_AlphaOPAQUE * color_ratio_); 88 const SkAlpha blend = static_cast<SkAlpha>(SK_AlphaOPAQUE * color_ratio_);
89 thumb_flags.setColor( 89 thumb_flags.setColor(
90 color_utils::AlphaBlend(thumb_on_color, thumb_off_color, blend)); 90 color_utils::AlphaBlend(thumb_on_color, thumb_off_color, blend));
91 91
92 // We want the circle to have an integer pixel diameter and to be aligned 92 // We want the circle to have an integer pixel diameter and to be aligned
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // TODO(varkha, estade): The thumb is using its own view. Investigate if 272 // TODO(varkha, estade): The thumb is using its own view. Investigate if
273 // repainting in every animation step to update colors could be avoided. 273 // repainting in every animation step to update colors could be avoided.
274 UpdateThumb(); 274 UpdateThumb();
275 SchedulePaint(); 275 SchedulePaint();
276 return; 276 return;
277 } 277 }
278 CustomButton::AnimationProgressed(animation); 278 CustomButton::AnimationProgressed(animation);
279 } 279 }
280 280
281 } // namespace views 281 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_border.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698