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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (host) { | 126 if (host) { |
127 layer_animation_controller_->SetAnimationRegistrar( | 127 layer_animation_controller_->SetAnimationRegistrar( |
128 host->animation_registrar()); | 128 host->animation_registrar()); |
129 | 129 |
130 if (host->settings().layer_transforms_should_scale_layer_contents) | 130 if (host->settings().layer_transforms_should_scale_layer_contents) |
131 reset_raster_scale_to_unknown(); | 131 reset_raster_scale_to_unknown(); |
132 } | 132 } |
133 | 133 |
134 if (host && layer_animation_controller_->has_any_animation()) | 134 if (host && layer_animation_controller_->has_any_animation()) |
135 host->SetNeedsCommit(); | 135 host->SetNeedsCommit(); |
136 SetNeedsFilterContextIfNeeded(); | |
137 } | 136 } |
138 | 137 |
139 void Layer::SetNeedsUpdate() { | 138 void Layer::SetNeedsUpdate() { |
140 if (layer_tree_host_ && !ignore_set_needs_commit_) | 139 if (layer_tree_host_ && !ignore_set_needs_commit_) |
141 layer_tree_host_->SetNeedsUpdateLayers(); | 140 layer_tree_host_->SetNeedsUpdateLayers(); |
142 } | 141 } |
143 | 142 |
144 void Layer::SetNeedsCommit() { | 143 void Layer::SetNeedsCommit() { |
145 if (!layer_tree_host_) | 144 if (!layer_tree_host_) |
146 return; | 145 return; |
(...skipping 13 matching lines...) Expand all Loading... |
160 layer_tree_host_->SetNeedsFullTreeSync(); | 159 layer_tree_host_->SetNeedsFullTreeSync(); |
161 } | 160 } |
162 | 161 |
163 void Layer::SetNextCommitWaitsForActivation() { | 162 void Layer::SetNextCommitWaitsForActivation() { |
164 if (!layer_tree_host_) | 163 if (!layer_tree_host_) |
165 return; | 164 return; |
166 | 165 |
167 layer_tree_host_->SetNextCommitWaitsForActivation(); | 166 layer_tree_host_->SetNextCommitWaitsForActivation(); |
168 } | 167 } |
169 | 168 |
170 void Layer::SetNeedsFilterContextIfNeeded() { | |
171 if (!layer_tree_host_) | |
172 return; | |
173 | |
174 if (!filters_.IsEmpty() || !background_filters_.IsEmpty() || | |
175 !uses_default_blend_mode()) | |
176 layer_tree_host_->set_needs_filter_context(); | |
177 } | |
178 | |
179 void Layer::SetNeedsPushProperties() { | 169 void Layer::SetNeedsPushProperties() { |
180 if (needs_push_properties_) | 170 if (needs_push_properties_) |
181 return; | 171 return; |
182 if (!parent_should_know_need_push_properties() && parent_) | 172 if (!parent_should_know_need_push_properties() && parent_) |
183 parent_->AddDependentNeedsPushProperties(); | 173 parent_->AddDependentNeedsPushProperties(); |
184 needs_push_properties_ = true; | 174 needs_push_properties_ = true; |
185 } | 175 } |
186 | 176 |
187 void Layer::AddDependentNeedsPushProperties() { | 177 void Layer::AddDependentNeedsPushProperties() { |
188 DCHECK_GE(num_dependents_need_push_properties_, 0); | 178 DCHECK_GE(num_dependents_need_push_properties_, 0); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 470 } |
481 SetNeedsFullTreeSync(); | 471 SetNeedsFullTreeSync(); |
482 } | 472 } |
483 | 473 |
484 void Layer::SetFilters(const FilterOperations& filters) { | 474 void Layer::SetFilters(const FilterOperations& filters) { |
485 DCHECK(IsPropertyChangeAllowed()); | 475 DCHECK(IsPropertyChangeAllowed()); |
486 if (filters_ == filters) | 476 if (filters_ == filters) |
487 return; | 477 return; |
488 filters_ = filters; | 478 filters_ = filters; |
489 SetNeedsCommit(); | 479 SetNeedsCommit(); |
490 SetNeedsFilterContextIfNeeded(); | |
491 } | 480 } |
492 | 481 |
493 bool Layer::FilterIsAnimating() const { | 482 bool Layer::FilterIsAnimating() const { |
494 return layer_animation_controller_->IsAnimatingProperty(Animation::Filter); | 483 return layer_animation_controller_->IsAnimatingProperty(Animation::Filter); |
495 } | 484 } |
496 | 485 |
497 void Layer::SetBackgroundFilters(const FilterOperations& filters) { | 486 void Layer::SetBackgroundFilters(const FilterOperations& filters) { |
498 DCHECK(IsPropertyChangeAllowed()); | 487 DCHECK(IsPropertyChangeAllowed()); |
499 if (background_filters_ == filters) | 488 if (background_filters_ == filters) |
500 return; | 489 return; |
501 background_filters_ = filters; | 490 background_filters_ = filters; |
502 SetNeedsCommit(); | 491 SetNeedsCommit(); |
503 SetNeedsFilterContextIfNeeded(); | |
504 } | 492 } |
505 | 493 |
506 void Layer::SetOpacity(float opacity) { | 494 void Layer::SetOpacity(float opacity) { |
507 DCHECK(IsPropertyChangeAllowed()); | 495 DCHECK(IsPropertyChangeAllowed()); |
508 if (opacity_ == opacity) | 496 if (opacity_ == opacity) |
509 return; | 497 return; |
510 opacity_ = opacity; | 498 opacity_ = opacity; |
511 SetNeedsCommit(); | 499 SetNeedsCommit(); |
512 } | 500 } |
513 | 501 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 case SkXfermode::kPlus_Mode: | 547 case SkXfermode::kPlus_Mode: |
560 case SkXfermode::kModulate_Mode: | 548 case SkXfermode::kModulate_Mode: |
561 // Porter Duff Compositing Operators are not yet supported | 549 // Porter Duff Compositing Operators are not yet supported |
562 // http://dev.w3.org/fxtf/compositing-1/#porterduffcompositingoperators | 550 // http://dev.w3.org/fxtf/compositing-1/#porterduffcompositingoperators |
563 NOTREACHED(); | 551 NOTREACHED(); |
564 return; | 552 return; |
565 } | 553 } |
566 | 554 |
567 blend_mode_ = blend_mode; | 555 blend_mode_ = blend_mode; |
568 SetNeedsCommit(); | 556 SetNeedsCommit(); |
569 SetNeedsFilterContextIfNeeded(); | |
570 } | 557 } |
571 | 558 |
572 void Layer::SetIsRootForIsolatedGroup(bool root) { | 559 void Layer::SetIsRootForIsolatedGroup(bool root) { |
573 DCHECK(IsPropertyChangeAllowed()); | 560 DCHECK(IsPropertyChangeAllowed()); |
574 if (is_root_for_isolated_group_ == root) | 561 if (is_root_for_isolated_group_ == root) |
575 return; | 562 return; |
576 is_root_for_isolated_group_ = root; | 563 is_root_for_isolated_group_ = root; |
577 SetNeedsCommit(); | 564 SetNeedsCommit(); |
578 } | 565 } |
579 | 566 |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 if (clip_parent_) | 1179 if (clip_parent_) |
1193 clip_parent_->RemoveClipChild(this); | 1180 clip_parent_->RemoveClipChild(this); |
1194 | 1181 |
1195 clip_parent_ = NULL; | 1182 clip_parent_ = NULL; |
1196 } | 1183 } |
1197 | 1184 |
1198 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1185 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
1199 benchmark->RunOnLayer(this); | 1186 benchmark->RunOnLayer(this); |
1200 } | 1187 } |
1201 } // namespace cc | 1188 } // namespace cc |
OLD | NEW |