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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 | 470 |
| 471 void Layer::SetBackgroundFilters(const FilterOperations& filters) { | 471 void Layer::SetBackgroundFilters(const FilterOperations& filters) { |
| 472 DCHECK(IsPropertyChangeAllowed()); | 472 DCHECK(IsPropertyChangeAllowed()); |
| 473 if (inputs_.background_filters == filters) | 473 if (inputs_.background_filters == filters) |
| 474 return; | 474 return; |
| 475 inputs_.background_filters = filters; | 475 inputs_.background_filters = filters; |
| 476 SetLayerPropertyChanged(); | 476 SetLayerPropertyChanged(); |
| 477 SetNeedsCommit(); | 477 SetNeedsCommit(); |
| 478 } | 478 } |
| 479 | 479 |
| 480 void Layer::SetFiltersOrigin(const gfx::PointF& filters_origin) { | |
| 481 DCHECK(IsPropertyChangeAllowed()); | |
| 482 if (inputs_.filters_origin == filters_origin) | |
| 483 return; | |
| 484 inputs_.filters_origin = filters_origin; | |
| 485 SetSubtreePropertyChanged(); // TODO(senorblanco) or SetLayerPropertyChanged? | |
|
Stephen White
2016/08/29 21:10:54
Ali: any comment on this TODO? I notice that SetFi
ajuma
2016/08/29 21:39:30
It should be SetSubtreePropertyChanged (since the
Stephen White
2016/08/29 21:43:11
Thanks! TODO removed.
| |
| 486 SetNeedsCommit(); | |
| 487 } | |
| 488 | |
| 480 void Layer::SetOpacity(float opacity) { | 489 void Layer::SetOpacity(float opacity) { |
| 481 DCHECK(IsPropertyChangeAllowed()); | 490 DCHECK(IsPropertyChangeAllowed()); |
| 482 DCHECK_GE(opacity, 0.f); | 491 DCHECK_GE(opacity, 0.f); |
| 483 DCHECK_LE(opacity, 1.f); | 492 DCHECK_LE(opacity, 1.f); |
| 484 | 493 |
| 485 if (inputs_.opacity == opacity) | 494 if (inputs_.opacity == opacity) |
| 486 return; | 495 return; |
| 487 // We need to force a property tree rebuild when opacity changes from 1 to a | 496 // We need to force a property tree rebuild when opacity changes from 1 to a |
| 488 // non-1 value or vice-versa as render surfaces can change. | 497 // non-1 value or vice-versa as render surfaces can change. |
| 489 bool force_rebuild = opacity == 1.f || inputs_.opacity == 1.f; | 498 bool force_rebuild = opacity == 1.f || inputs_.opacity == 1.f; |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1119 void Layer::PushPropertiesTo(LayerImpl* layer) { | 1128 void Layer::PushPropertiesTo(LayerImpl* layer) { |
| 1120 TRACE_EVENT0("cc", "Layer::PushPropertiesTo"); | 1129 TRACE_EVENT0("cc", "Layer::PushPropertiesTo"); |
| 1121 DCHECK(layer_tree_host_); | 1130 DCHECK(layer_tree_host_); |
| 1122 | 1131 |
| 1123 // If we did not SavePaintProperties() for the layer this frame, then push the | 1132 // If we did not SavePaintProperties() for the layer this frame, then push the |
| 1124 // real property values, not the paint property values. | 1133 // real property values, not the paint property values. |
| 1125 bool use_paint_properties = paint_properties_.source_frame_number == | 1134 bool use_paint_properties = paint_properties_.source_frame_number == |
| 1126 layer_tree_host_->source_frame_number(); | 1135 layer_tree_host_->source_frame_number(); |
| 1127 | 1136 |
| 1128 layer->SetBackgroundColor(inputs_.background_color); | 1137 layer->SetBackgroundColor(inputs_.background_color); |
| 1138 layer->SetFiltersOrigin(inputs_.filters_origin); | |
|
ajuma
2016/08/29 20:28:43
This shouldn't be needed (since filters_origin wil
Stephen White
2016/08/29 21:10:54
Removed.
| |
| 1129 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); | 1139 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); |
| 1130 layer->SetBounds(use_paint_properties ? paint_properties_.bounds | 1140 layer->SetBounds(use_paint_properties ? paint_properties_.bounds |
| 1131 : inputs_.bounds); | 1141 : inputs_.bounds); |
| 1132 | 1142 |
| 1133 #if defined(NDEBUG) | 1143 #if defined(NDEBUG) |
| 1134 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots()) | 1144 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots()) |
| 1135 layer->SetDebugInfo(TakeDebugInfo()); | 1145 layer->SetDebugInfo(TakeDebugInfo()); |
| 1136 #else | 1146 #else |
| 1137 layer->SetDebugInfo(TakeDebugInfo()); | 1147 layer->SetDebugInfo(TakeDebugInfo()); |
| 1138 #endif | 1148 #endif |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1873 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1883 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
| 1874 return draw_property_utils::ScreenSpaceTransform( | 1884 return draw_property_utils::ScreenSpaceTransform( |
| 1875 this, layer_tree_->property_trees()->transform_tree); | 1885 this, layer_tree_->property_trees()->transform_tree); |
| 1876 } | 1886 } |
| 1877 | 1887 |
| 1878 LayerTree* Layer::GetLayerTree() const { | 1888 LayerTree* Layer::GetLayerTree() const { |
| 1879 return layer_tree_; | 1889 return layer_tree_; |
| 1880 } | 1890 } |
| 1881 | 1891 |
| 1882 } // namespace cc | 1892 } // namespace cc |
| OLD | NEW |