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

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

Issue 238723004: Paint state transition for overlay 9 patch scrollbars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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 | « ui/native_theme/native_theme_base.h ('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 (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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 case kWindowResizeGripper: 149 case kWindowResizeGripper:
150 NOTIMPLEMENTED(); 150 NOTIMPLEMENTED();
151 break; 151 break;
152 default: 152 default:
153 NOTREACHED() << "Unknown theme part: " << part; 153 NOTREACHED() << "Unknown theme part: " << part;
154 break; 154 break;
155 } 155 }
156 return gfx::Size(); 156 return gfx::Size();
157 } 157 }
158 158
159 void NativeThemeBase::PaintStateTransition(SkCanvas* canvas,
160 Part part,
161 State startState,
162 State endState,
163 double progress,
164 const gfx::Rect& rect) const {
165 if (rect.IsEmpty())
166 return;
167
168 // Currently state transition is animation only working for overlay scrollbars
169 // on Aura platforms.
170 switch (part) {
171 case kScrollbarHorizontalThumb:
172 case kScrollbarVerticalThumb:
173 PaintScrollbarThumbStateTransition(
174 canvas, startState, endState, progress, rect);
175 break;
176 default:
177 NOTREACHED() << "Does not support state transition for this part:"
178 << part;
179 break;
180 }
181 return;
182 }
183
159 void NativeThemeBase::Paint(SkCanvas* canvas, 184 void NativeThemeBase::Paint(SkCanvas* canvas,
160 Part part, 185 Part part,
161 State state, 186 State state,
162 const gfx::Rect& rect, 187 const gfx::Rect& rect,
163 const ExtraParams& extra) const { 188 const ExtraParams& extra) const {
164 if (rect.IsEmpty()) 189 if (rect.IsEmpty())
165 return; 190 return;
166 191
167 switch (part) { 192 switch (part) {
168 // Please keep these in the order of NativeTheme::Part. 193 // Please keep these in the order of NativeTheme::Part.
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 1087 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
1063 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); 1088 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
1064 1089
1065 if (hsv1[2] + hsv2[2] > 1.0) 1090 if (hsv1[2] + hsv2[2] > 1.0)
1066 diff = -diff; 1091 diff = -diff;
1067 1092
1068 return SaturateAndBrighten(hsv2, -0.2f, diff); 1093 return SaturateAndBrighten(hsv2, -0.2f, diff);
1069 } 1094 }
1070 1095
1071 } // namespace ui 1096 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698