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