OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 is_container_for_fixed_position_layers_(false), | 71 is_container_for_fixed_position_layers_(false), |
72 background_color_(0), | 72 background_color_(0), |
73 opacity_(1.0), | 73 opacity_(1.0), |
74 blend_mode_(SkXfermode::kSrcOver_Mode), | 74 blend_mode_(SkXfermode::kSrcOver_Mode), |
75 num_descendants_that_draw_content_(0), | 75 num_descendants_that_draw_content_(0), |
76 transform_tree_index_(-1), | 76 transform_tree_index_(-1), |
77 opacity_tree_index_(-1), | 77 opacity_tree_index_(-1), |
78 clip_tree_index_(-1), | 78 clip_tree_index_(-1), |
79 draw_depth_(0.f), | 79 draw_depth_(0.f), |
80 needs_push_properties_(false), | 80 needs_push_properties_(false), |
81 num_dependents_need_push_properties_(0), | 81 num_dependents_need_push_properties_(0u), |
82 sorting_context_id_(0), | 82 sorting_context_id_(0), |
83 current_draw_mode_(DRAW_MODE_NONE), | 83 current_draw_mode_(DRAW_MODE_NONE), |
84 frame_timing_requests_dirty_(false), | 84 frame_timing_requests_dirty_(false), |
85 visited_(false), | 85 visited_(false), |
86 layer_or_descendant_is_drawn_(false), | 86 layer_or_descendant_is_drawn_(false), |
87 sorted_for_recursion_(false) { | 87 sorted_for_recursion_(false) { |
88 DCHECK_GT(layer_id_, 0); | 88 DCHECK_GT(layer_id_, 0); |
89 DCHECK(layer_tree_impl_); | 89 DCHECK(layer_tree_impl_); |
90 layer_tree_impl_->RegisterLayer(this); | 90 layer_tree_impl_->RegisterLayer(this); |
91 AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar(); | 91 AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar(); |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 | 1473 |
1474 void LayerImpl::SetNeedsPushProperties() { | 1474 void LayerImpl::SetNeedsPushProperties() { |
1475 if (needs_push_properties_) | 1475 if (needs_push_properties_) |
1476 return; | 1476 return; |
1477 if (!parent_should_know_need_push_properties() && parent_) | 1477 if (!parent_should_know_need_push_properties() && parent_) |
1478 parent_->AddDependentNeedsPushProperties(); | 1478 parent_->AddDependentNeedsPushProperties(); |
1479 needs_push_properties_ = true; | 1479 needs_push_properties_ = true; |
1480 } | 1480 } |
1481 | 1481 |
1482 void LayerImpl::AddDependentNeedsPushProperties() { | 1482 void LayerImpl::AddDependentNeedsPushProperties() { |
1483 DCHECK_GE(num_dependents_need_push_properties_, 0); | |
1484 | |
1485 if (!parent_should_know_need_push_properties() && parent_) | 1483 if (!parent_should_know_need_push_properties() && parent_) |
1486 parent_->AddDependentNeedsPushProperties(); | 1484 parent_->AddDependentNeedsPushProperties(); |
1487 | 1485 |
1488 num_dependents_need_push_properties_++; | 1486 num_dependents_need_push_properties_++; |
1489 } | 1487 } |
1490 | 1488 |
1491 void LayerImpl::RemoveDependentNeedsPushProperties() { | 1489 void LayerImpl::RemoveDependentNeedsPushProperties() { |
| 1490 DCHECK_GT(num_dependents_need_push_properties_, 0u); |
1492 num_dependents_need_push_properties_--; | 1491 num_dependents_need_push_properties_--; |
1493 DCHECK_GE(num_dependents_need_push_properties_, 0); | |
1494 | 1492 |
1495 if (!parent_should_know_need_push_properties() && parent_) | 1493 if (!parent_should_know_need_push_properties() && parent_) |
1496 parent_->RemoveDependentNeedsPushProperties(); | 1494 parent_->RemoveDependentNeedsPushProperties(); |
1497 } | 1495 } |
1498 | 1496 |
1499 void LayerImpl::GetAllPrioritizedTilesForTracing( | 1497 void LayerImpl::GetAllPrioritizedTilesForTracing( |
1500 std::vector<PrioritizedTile>* prioritized_tiles) const { | 1498 std::vector<PrioritizedTile>* prioritized_tiles) const { |
1501 } | 1499 } |
1502 | 1500 |
1503 void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { | 1501 void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 gfx::Transform scaled_draw_transform = | 1673 gfx::Transform scaled_draw_transform = |
1676 draw_properties_.target_space_transform; | 1674 draw_properties_.target_space_transform; |
1677 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); | 1675 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); |
1678 gfx::Size scaled_content_bounds = | 1676 gfx::Size scaled_content_bounds = |
1679 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); | 1677 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); |
1680 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, | 1678 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, |
1681 gfx::Rect(scaled_content_bounds)); | 1679 gfx::Rect(scaled_content_bounds)); |
1682 } | 1680 } |
1683 | 1681 |
1684 } // namespace cc | 1682 } // namespace cc |
OLD | NEW |