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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |