OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/android/edge_effect.h" | 5 #include "content/browser/android/edge_effect.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "cc/layers/ui_resource_layer.h" | 8 #include "cc/layers/ui_resource_layer.h" |
9 #include "content/browser/android/animation_utils.h" | 9 #include "content/browser/android/animation_utils.h" |
10 #include "ui/android/resources/resource_manager.h" | 10 #include "ui/android/resources/resource_manager.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 break; | 298 break; |
299 } | 299 } |
300 } | 300 } |
301 | 301 |
302 if (state_ == STATE_RECEDE && glow_scale_y_ <= 0 && edge_scale_y_ <= 0) | 302 if (state_ == STATE_RECEDE && glow_scale_y_ <= 0 && edge_scale_y_ <= 0) |
303 Finish(); | 303 Finish(); |
304 | 304 |
305 return !IsFinished(); | 305 return !IsFinished(); |
306 } | 306 } |
307 | 307 |
| 308 float EdgeEffect::GetAlpha() const { |
| 309 return IsFinished() ? 0.f : std::max(glow_alpha_, edge_alpha_); |
| 310 } |
| 311 |
308 void EdgeEffect::ApplyToLayers(const gfx::SizeF& size, | 312 void EdgeEffect::ApplyToLayers(const gfx::SizeF& size, |
309 const gfx::Transform& transform) { | 313 const gfx::Transform& transform) { |
310 if (IsFinished()) | 314 if (IsFinished()) |
311 return; | 315 return; |
312 | 316 |
313 // An empty window size, while meaningless, is also relatively harmless, and | 317 // An empty window size, while meaningless, is also relatively harmless, and |
314 // will simply prevent any drawing of the layers. | 318 // will simply prevent any drawing of the layers. |
315 if (size.IsEmpty()) { | 319 if (size.IsEmpty()) { |
316 edge_->Disable(); | 320 edge_->Disable(); |
317 glow_->Disable(); | 321 glow_->Disable(); |
(...skipping 23 matching lines...) Expand all Loading... |
341 // static | 345 // static |
342 void EdgeEffect::PreloadResources(ui::ResourceManager* resource_manager) { | 346 void EdgeEffect::PreloadResources(ui::ResourceManager* resource_manager) { |
343 DCHECK(resource_manager); | 347 DCHECK(resource_manager); |
344 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, | 348 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, |
345 kEdgeResourceId); | 349 kEdgeResourceId); |
346 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, | 350 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, |
347 kGlowResourceId); | 351 kGlowResourceId); |
348 } | 352 } |
349 | 353 |
350 } // namespace content | 354 } // namespace content |
OLD | NEW |