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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 children_[i]->NoteLayerPropertyChangedForDescendantsInternal(); | 736 children_[i]->NoteLayerPropertyChangedForDescendantsInternal(); |
737 } | 737 } |
738 | 738 |
739 void LayerImpl::NoteLayerPropertyChangedForDescendants() { | 739 void LayerImpl::NoteLayerPropertyChangedForDescendants() { |
740 layer_tree_impl()->set_needs_update_draw_properties(); | 740 layer_tree_impl()->set_needs_update_draw_properties(); |
741 for (size_t i = 0; i < children_.size(); ++i) | 741 for (size_t i = 0; i < children_.size(); ++i) |
742 children_[i]->NoteLayerPropertyChangedForDescendantsInternal(); | 742 children_[i]->NoteLayerPropertyChangedForDescendantsInternal(); |
743 SetNeedsPushProperties(); | 743 SetNeedsPushProperties(); |
744 } | 744 } |
745 | 745 |
746 #if DCHECK_IS_ON() | |
747 // Verify that the resource id is valid. | |
748 static ResourceId ValidateResource(const ResourceProvider* provider, | |
749 ResourceId id) { | |
750 provider->ValidateResource(id); | |
751 return id; | |
752 } | |
753 #endif | |
754 | |
755 void LayerImpl::ValidateQuadResourcesInternal(DrawQuad* quad) const { | 746 void LayerImpl::ValidateQuadResourcesInternal(DrawQuad* quad) const { |
756 #if DCHECK_IS_ON() | 747 #if DCHECK_IS_ON() |
757 quad->IterateResources( | 748 const ResourceProvider* resource_provider = |
758 base::Bind(&ValidateResource, layer_tree_impl_->resource_provider())); | 749 layer_tree_impl_->resource_provider(); |
| 750 for (ResourceId resource_id : quad->resources) |
| 751 resource_provider->ValidateResource(resource_id); |
759 #endif | 752 #endif |
760 } | 753 } |
761 | 754 |
762 const char* LayerImpl::LayerTypeAsString() const { | 755 const char* LayerImpl::LayerTypeAsString() const { |
763 return "cc::LayerImpl"; | 756 return "cc::LayerImpl"; |
764 } | 757 } |
765 | 758 |
766 void LayerImpl::ResetAllChangeTrackingForSubtree() { | 759 void LayerImpl::ResetAllChangeTrackingForSubtree() { |
767 layer_property_changed_ = false; | 760 layer_property_changed_ = false; |
768 | 761 |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 gfx::Transform scaled_draw_transform = | 1675 gfx::Transform scaled_draw_transform = |
1683 draw_properties_.target_space_transform; | 1676 draw_properties_.target_space_transform; |
1684 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); | 1677 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); |
1685 gfx::Size scaled_content_bounds = | 1678 gfx::Size scaled_content_bounds = |
1686 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); | 1679 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); |
1687 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, | 1680 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, |
1688 gfx::Rect(scaled_content_bounds)); | 1681 gfx::Rect(scaled_content_bounds)); |
1689 } | 1682 } |
1690 | 1683 |
1691 } // namespace cc | 1684 } // namespace cc |
OLD | NEW |