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

Side by Side Diff: ash/common/shelf/shelf_background_animator.cc

Issue 2744493002: [ash-md] Added darkness blending to the colorized shelf. (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 | « no previous file | ash/common/shelf/shelf_constants.h » ('j') | 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 "ash/common/shelf/shelf_background_animator.h" 5 #include "ash/common/shelf/shelf_background_animator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/animation/animation_change_type.h" 9 #include "ash/animation/animation_change_type.h"
10 #include "ash/common/shelf/shelf_background_animator_observer.h" 10 #include "ash/common/shelf/shelf_background_animator_observer.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 void ShelfBackgroundAnimator::SetTargetValues( 196 void ShelfBackgroundAnimator::SetTargetValues(
197 ShelfBackgroundType background_type) { 197 ShelfBackgroundType background_type) {
198 GetTargetValues(background_type, &shelf_background_values_, 198 GetTargetValues(background_type, &shelf_background_values_,
199 &item_background_values_); 199 &item_background_values_);
200 } 200 }
201 201
202 void ShelfBackgroundAnimator::GetTargetValues( 202 void ShelfBackgroundAnimator::GetTargetValues(
203 ShelfBackgroundType background_type, 203 ShelfBackgroundType background_type,
204 AnimationValues* shelf_background_values, 204 AnimationValues* shelf_background_values,
205 AnimationValues* item_background_values) const { 205 AnimationValues* item_background_values) const {
206 int target_shelf_background_alpha = 0; 206 int target_shelf_color_alpha = 0;
207 int target_shelf_item_background_alpha = 0; 207 int target_item_color_alpha = 0;
208 208
209 switch (background_type) { 209 switch (background_type) {
210 case SHELF_BACKGROUND_DEFAULT: 210 case SHELF_BACKGROUND_DEFAULT:
211 target_shelf_background_alpha = 0; 211 target_shelf_color_alpha = 0;
212 target_shelf_item_background_alpha = kShelfTranslucentAlpha; 212 target_item_color_alpha = kShelfTranslucentAlpha;
213 break; 213 break;
214 case SHELF_BACKGROUND_OVERLAP: 214 case SHELF_BACKGROUND_OVERLAP:
215 target_shelf_background_alpha = kShelfTranslucentAlpha; 215 target_shelf_color_alpha = kShelfTranslucentAlpha;
216 target_shelf_item_background_alpha = 0; 216 target_item_color_alpha = 0;
217 break; 217 break;
218 case SHELF_BACKGROUND_MAXIMIZED: 218 case SHELF_BACKGROUND_MAXIMIZED:
219 target_shelf_background_alpha = kMaxAlpha; 219 target_shelf_color_alpha = kMaxAlpha;
220 target_shelf_item_background_alpha = 0; 220 target_item_color_alpha = 0;
221 break; 221 break;
222 } 222 }
223 223
224 SkColor target_color = wallpaper_controller_ 224 SkColor target_color = wallpaper_controller_
225 ? wallpaper_controller_->prominent_color() 225 ? wallpaper_controller_->prominent_color()
226 : kShelfDefaultBaseColor; 226 : kShelfDefaultBaseColor;
227 if (target_color == SK_ColorTRANSPARENT) {
228 target_color = kShelfDefaultBaseColor;
229 } else {
230 int darkening_alpha = 0;
227 231
228 if (target_color == SK_ColorTRANSPARENT) 232 switch (background_type) {
229 target_color = kShelfDefaultBaseColor; 233 case SHELF_BACKGROUND_DEFAULT:
234 case SHELF_BACKGROUND_OVERLAP:
235 darkening_alpha = kShelfTranslucentColorDarkenAlpha;
236 break;
237 case SHELF_BACKGROUND_MAXIMIZED:
238 darkening_alpha = kShelfOpaqueColorDarkenAlpha;
239 break;
240 }
241 target_color = color_utils::GetResultingPaintColor(
242 SkColorSetA(kShelfDefaultBaseColor, darkening_alpha), target_color);
243 }
230 244
231 shelf_background_values->SetTargetValues( 245 shelf_background_values->SetTargetValues(
232 SkColorSetA(target_color, target_shelf_background_alpha)); 246 SkColorSetA(target_color, target_shelf_color_alpha));
233 item_background_values->SetTargetValues( 247 item_background_values->SetTargetValues(
234 SkColorSetA(target_color, target_shelf_item_background_alpha)); 248 SkColorSetA(target_color, target_item_color_alpha));
235 } 249 }
236 250
237 void ShelfBackgroundAnimator::SetAnimationValues(double t) { 251 void ShelfBackgroundAnimator::SetAnimationValues(double t) {
238 DCHECK_GE(t, 0.0); 252 DCHECK_GE(t, 0.0);
239 DCHECK_LE(t, 1.0); 253 DCHECK_LE(t, 1.0);
240 shelf_background_values_.UpdateCurrentValues(t); 254 shelf_background_values_.UpdateCurrentValues(t);
241 item_background_values_.UpdateCurrentValues(t); 255 item_background_values_.UpdateCurrentValues(t);
242 NotifyObservers(); 256 NotifyObservers();
243 } 257 }
244 258
245 } // namespace ash 259 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/shelf/shelf_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698