Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/layers/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 if (background_filters_ == filters) | 460 if (background_filters_ == filters) |
| 461 return; | 461 return; |
| 462 background_filters_ = filters; | 462 background_filters_ = filters; |
| 463 SetNeedsCommit(); | 463 SetNeedsCommit(); |
| 464 } | 464 } |
| 465 | 465 |
| 466 void Layer::SetOpacity(float opacity) { | 466 void Layer::SetOpacity(float opacity) { |
| 467 DCHECK(IsPropertyChangeAllowed()); | 467 DCHECK(IsPropertyChangeAllowed()); |
| 468 if (opacity_ == opacity) | 468 if (opacity_ == opacity) |
| 469 return; | 469 return; |
| 470 bool force_rebuild = opacity == 1.f || opacity_ == 1.f; | |
|
ajuma
2016/05/16 22:05:20
Please add a comment explaining why we need to unc
jaydasika
2016/05/17 01:40:00
Done.
| |
| 470 opacity_ = opacity; | 471 opacity_ = opacity; |
| 471 SetSubtreePropertyChanged(); | 472 SetSubtreePropertyChanged(); |
|
ajuma
2016/05/16 22:05:20
I think this is only needed if we rebuild (Layer::
jaydasika
2016/05/17 01:40:00
I think we will need to mark both on the layer and
| |
| 473 if (layer_tree_host_ && !force_rebuild) { | |
| 474 PropertyTrees* property_trees = layer_tree_host_->property_trees(); | |
| 475 auto effect_id_to_index = property_trees->effect_id_to_index_map.find(id()); | |
| 476 if (effect_id_to_index != property_trees->effect_id_to_index_map.end()) { | |
| 477 EffectNode* node = | |
| 478 property_trees->effect_tree.Node(effect_id_to_index->second); | |
| 479 node->data.opacity = opacity; | |
| 480 node->data.effect_changed = true; | |
| 481 property_trees->effect_tree.set_needs_update(true); | |
| 482 SetNeedsCommitNoRebuild(); | |
| 483 return; | |
| 484 } | |
| 485 } | |
| 472 SetNeedsCommit(); | 486 SetNeedsCommit(); |
| 473 } | 487 } |
| 474 | 488 |
| 475 float Layer::EffectiveOpacity() const { | 489 float Layer::EffectiveOpacity() const { |
| 476 return hide_layer_and_subtree_ ? 0.f : opacity_; | 490 return hide_layer_and_subtree_ ? 0.f : opacity_; |
| 477 } | 491 } |
| 478 | 492 |
| 479 bool Layer::OpacityIsAnimating() const { | 493 bool Layer::OpacityIsAnimating() const { |
| 480 DCHECK(layer_tree_host_); | 494 DCHECK(layer_tree_host_); |
| 481 return layer_tree_host_->IsAnimatingOpacityProperty(this); | 495 return layer_tree_host_->IsAnimatingOpacityProperty(this); |
| (...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1770 ->data.num_copy_requests_in_subtree; | 1784 ->data.num_copy_requests_in_subtree; |
| 1771 } | 1785 } |
| 1772 | 1786 |
| 1773 gfx::Transform Layer::screen_space_transform() const { | 1787 gfx::Transform Layer::screen_space_transform() const { |
| 1774 DCHECK_NE(transform_tree_index_, -1); | 1788 DCHECK_NE(transform_tree_index_, -1); |
| 1775 return draw_property_utils::ScreenSpaceTransform( | 1789 return draw_property_utils::ScreenSpaceTransform( |
| 1776 this, layer_tree_host_->property_trees()->transform_tree); | 1790 this, layer_tree_host_->property_trees()->transform_tree); |
| 1777 } | 1791 } |
| 1778 | 1792 |
| 1779 } // namespace cc | 1793 } // namespace cc |
| OLD | NEW |