| 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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "cc/animation/animation.h" | 10 #include "cc/animation/animation.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 layer_animation_controller_->SetAnimationRegistrar( | 102 layer_animation_controller_->SetAnimationRegistrar( |
| 103 host->animation_registrar()); | 103 host->animation_registrar()); |
| 104 | 104 |
| 105 if (host->settings().layer_transforms_should_scale_layer_contents) | 105 if (host->settings().layer_transforms_should_scale_layer_contents) |
| 106 reset_raster_scale_to_unknown(); | 106 reset_raster_scale_to_unknown(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 if (host && layer_animation_controller_->has_any_animation()) | 109 if (host && layer_animation_controller_->has_any_animation()) |
| 110 host->SetNeedsCommit(); | 110 host->SetNeedsCommit(); |
| 111 if (host && | 111 if (host && |
| 112 (!filters_.isEmpty() || !background_filters_.isEmpty() || filter_)) | 112 (!filters_.IsEmpty() || !background_filters_.IsEmpty() || filter_)) |
| 113 layer_tree_host_->set_needs_filter_context(); | 113 layer_tree_host_->set_needs_filter_context(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void Layer::SetNeedsCommit() { | 116 void Layer::SetNeedsCommit() { |
| 117 if (ignore_set_needs_commit_) | 117 if (ignore_set_needs_commit_) |
| 118 return; | 118 return; |
| 119 if (layer_tree_host_) | 119 if (layer_tree_host_) |
| 120 layer_tree_host_->SetNeedsCommit(); | 120 layer_tree_host_->SetNeedsCommit(); |
| 121 } | 121 } |
| 122 | 122 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 412 } |
| 413 replica_layer_ = layer; | 413 replica_layer_ = layer; |
| 414 if (replica_layer_.get()) { | 414 if (replica_layer_.get()) { |
| 415 DCHECK(!replica_layer_->parent()); | 415 DCHECK(!replica_layer_->parent()); |
| 416 replica_layer_->RemoveFromParent(); | 416 replica_layer_->RemoveFromParent(); |
| 417 replica_layer_->SetParent(this); | 417 replica_layer_->SetParent(this); |
| 418 } | 418 } |
| 419 SetNeedsFullTreeSync(); | 419 SetNeedsFullTreeSync(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void Layer::SetFilters(const WebKit::WebFilterOperations& filters) { | 422 void Layer::SetFilters(const FilterOperations& filters) { |
| 423 DCHECK(IsPropertyChangeAllowed()); | 423 DCHECK(IsPropertyChangeAllowed()); |
| 424 if (filters_ == filters) | 424 if (filters_ == filters) |
| 425 return; | 425 return; |
| 426 DCHECK(!filter_); | 426 DCHECK(!filter_); |
| 427 filters_ = filters; | 427 filters_ = filters; |
| 428 SetNeedsCommit(); | 428 SetNeedsCommit(); |
| 429 if (!filters.isEmpty() && layer_tree_host_) | 429 if (!filters.IsEmpty() && layer_tree_host_) |
| 430 layer_tree_host_->set_needs_filter_context(); | 430 layer_tree_host_->set_needs_filter_context(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void Layer::SetFilter(const skia::RefPtr<SkImageFilter>& filter) { | 433 void Layer::SetFilter(const skia::RefPtr<SkImageFilter>& filter) { |
| 434 DCHECK(IsPropertyChangeAllowed()); | 434 DCHECK(IsPropertyChangeAllowed()); |
| 435 if (filter_.get() == filter.get()) | 435 if (filter_.get() == filter.get()) |
| 436 return; | 436 return; |
| 437 DCHECK(filters_.isEmpty()); | 437 DCHECK(filters_.IsEmpty()); |
| 438 filter_ = filter; | 438 filter_ = filter; |
| 439 SetNeedsCommit(); | 439 SetNeedsCommit(); |
| 440 if (filter && layer_tree_host_) | 440 if (filter && layer_tree_host_) |
| 441 layer_tree_host_->set_needs_filter_context(); | 441 layer_tree_host_->set_needs_filter_context(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void Layer::SetBackgroundFilters(const WebKit::WebFilterOperations& filters) { | 444 void Layer::SetBackgroundFilters(const FilterOperations& filters) { |
| 445 DCHECK(IsPropertyChangeAllowed()); | 445 DCHECK(IsPropertyChangeAllowed()); |
| 446 if (background_filters_ == filters) | 446 if (background_filters_ == filters) |
| 447 return; | 447 return; |
| 448 background_filters_ = filters; | 448 background_filters_ = filters; |
| 449 SetNeedsCommit(); | 449 SetNeedsCommit(); |
| 450 if (!filters.isEmpty() && layer_tree_host_) | 450 if (!filters.IsEmpty() && layer_tree_host_) |
| 451 layer_tree_host_->set_needs_filter_context(); | 451 layer_tree_host_->set_needs_filter_context(); |
| 452 } | 452 } |
| 453 | 453 |
| 454 void Layer::SetOpacity(float opacity) { | 454 void Layer::SetOpacity(float opacity) { |
| 455 DCHECK(IsPropertyChangeAllowed()); | 455 DCHECK(IsPropertyChangeAllowed()); |
| 456 if (opacity_ == opacity) | 456 if (opacity_ == opacity) |
| 457 return; | 457 return; |
| 458 opacity_ = opacity; | 458 opacity_ = opacity; |
| 459 SetNeedsCommit(); | 459 SetNeedsCommit(); |
| 460 } | 460 } |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 | 882 |
| 883 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 883 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
| 884 return layer_tree_host_->rendering_stats_instrumentation(); | 884 return layer_tree_host_->rendering_stats_instrumentation(); |
| 885 } | 885 } |
| 886 | 886 |
| 887 bool Layer::SupportsLCDText() const { | 887 bool Layer::SupportsLCDText() const { |
| 888 return false; | 888 return false; |
| 889 } | 889 } |
| 890 | 890 |
| 891 } // namespace cc | 891 } // namespace cc |
| OLD | NEW |