OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/trees/draw_property_utils.h" | 5 #include "cc/trees/draw_property_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
881 << " layer: " << layer->id() << " clip id: " << layer->clip_tree_index() | 881 << " layer: " << layer->id() << " clip id: " << layer->clip_tree_index() |
882 << " layer clip: " << layer->clip_rect().ToString() << " v.s. " | 882 << " layer clip: " << layer->clip_rect().ToString() << " v.s. " |
883 << gfx::ToEnclosingRect(accumulated_clip).ToString() | 883 << gfx::ToEnclosingRect(accumulated_clip).ToString() |
884 << " and clip node clip: " | 884 << " and clip node clip: " |
885 << gfx::ToEnclosingRect(clip_tree->Node(layer->clip_tree_index()) | 885 << gfx::ToEnclosingRect(clip_tree->Node(layer->clip_tree_index()) |
886 ->data.clip_in_target_space) | 886 ->data.clip_in_target_space) |
887 .ToString(); | 887 .ToString(); |
888 } | 888 } |
889 } | 889 } |
890 | 890 |
891 static int FindTargetTransformTreeIndexFromEffectTree( | |
892 const EffectTree& effect_tree, | |
893 const int effect_tree_index) { | |
894 const EffectNode* node = effect_tree.Node(effect_tree_index); | |
895 if (node->data.has_render_surface) | |
896 return node->data.transform_id; | |
897 node = effect_tree.Node(node->data.target_id); | |
898 return node->data.transform_id; | |
899 } | |
900 | |
901 static void VerifyDrawTransformsMatch(LayerImpl* layer, | |
902 PropertyTrees* property_trees) { | |
903 const int source_id = layer->transform_tree_index(); | |
904 int destination_id = FindTargetTransformTreeIndexFromEffectTree( | |
905 property_trees->effect_tree, layer->effect_tree_index()); | |
906 if (destination_id == 0 || destination_id == 1) | |
ajuma
2016/06/30 23:59:28
Please leave a TODO here about sorting out these c
| |
907 return; | |
908 gfx::Transform draw_transform; | |
909 property_trees->transform_tree.ComputeTransform(source_id, destination_id, | |
910 &draw_transform); | |
911 TransformNode* target_node = | |
912 property_trees->transform_tree.Node(destination_id); | |
913 draw_transform.matrix().postScale(target_node->data.sublayer_scale.x(), | |
914 target_node->data.sublayer_scale.y(), 1.f); | |
915 if (layer->should_flatten_transform_from_property_tree()) | |
916 draw_transform.FlattenTo2d(); | |
917 draw_transform.Translate(layer->offset_to_transform_parent().x(), | |
918 layer->offset_to_transform_parent().y()); | |
919 DCHECK(draw_transform.ApproximatelyEqual( | |
920 DrawTransform(layer, property_trees->transform_tree))) | |
921 << " layer: " << layer->id() << " source transform id: " << source_id | |
922 << " destination transform id: " << destination_id | |
923 << " draw transform from transform tree: " | |
924 << DrawTransform(layer, property_trees->transform_tree).ToString() | |
925 << " v.s." << draw_transform.ToString(); | |
926 } | |
927 | |
891 static void ComputeVisibleRectsInternal( | 928 static void ComputeVisibleRectsInternal( |
892 LayerImpl* root_layer, | 929 LayerImpl* root_layer, |
893 PropertyTrees* property_trees, | 930 PropertyTrees* property_trees, |
894 bool can_render_to_separate_surface, | 931 bool can_render_to_separate_surface, |
895 std::vector<LayerImpl*>* visible_layer_list) { | 932 std::vector<LayerImpl*>* visible_layer_list) { |
896 if (property_trees->non_root_surfaces_enabled != | 933 if (property_trees->non_root_surfaces_enabled != |
897 can_render_to_separate_surface) { | 934 can_render_to_separate_surface) { |
898 property_trees->non_root_surfaces_enabled = can_render_to_separate_surface; | 935 property_trees->non_root_surfaces_enabled = can_render_to_separate_surface; |
899 property_trees->transform_tree.set_needs_update(true); | 936 property_trees->transform_tree.set_needs_update(true); |
900 } | 937 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
973 | 1010 |
974 void VerifyClipTreeCalculations(const LayerImplList& layer_list, | 1011 void VerifyClipTreeCalculations(const LayerImplList& layer_list, |
975 PropertyTrees* property_trees) { | 1012 PropertyTrees* property_trees) { |
976 if (property_trees->non_root_surfaces_enabled) { | 1013 if (property_trees->non_root_surfaces_enabled) { |
977 ComputeClipsWithEffectTree(property_trees); | 1014 ComputeClipsWithEffectTree(property_trees); |
978 } | 1015 } |
979 for (auto layer : layer_list) | 1016 for (auto layer : layer_list) |
980 ComputeLayerClipRect(property_trees, layer); | 1017 ComputeLayerClipRect(property_trees, layer); |
981 } | 1018 } |
982 | 1019 |
1020 void VerifyTransformTreeCalculations(const LayerImplList& layer_list, | |
1021 PropertyTrees* property_trees) { | |
1022 for (auto layer : layer_list) | |
1023 VerifyDrawTransformsMatch(layer, property_trees); | |
1024 } | |
1025 | |
983 void ComputeVisibleRects(LayerImpl* root_layer, | 1026 void ComputeVisibleRects(LayerImpl* root_layer, |
984 PropertyTrees* property_trees, | 1027 PropertyTrees* property_trees, |
985 bool can_render_to_separate_surface, | 1028 bool can_render_to_separate_surface, |
986 LayerImplList* visible_layer_list) { | 1029 LayerImplList* visible_layer_list) { |
987 for (auto* layer : *root_layer->layer_tree_impl()) { | 1030 for (auto* layer : *root_layer->layer_tree_impl()) { |
988 UpdateRenderSurfaceForLayer(&property_trees->effect_tree, | 1031 UpdateRenderSurfaceForLayer(&property_trees->effect_tree, |
989 can_render_to_separate_surface, layer); | 1032 can_render_to_separate_surface, layer); |
990 EffectNode* node = | 1033 EffectNode* node = |
991 property_trees->effect_tree.Node(layer->effect_tree_index()); | 1034 property_trees->effect_tree.Node(layer->effect_tree_index()); |
992 if (node->owner_id == layer->id()) | 1035 if (node->owner_id == layer->id()) |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1372 void UpdateElasticOverscroll(PropertyTrees* property_trees, | 1415 void UpdateElasticOverscroll(PropertyTrees* property_trees, |
1373 const Layer* overscroll_elasticity_layer, | 1416 const Layer* overscroll_elasticity_layer, |
1374 const gfx::Vector2dF& elastic_overscroll) { | 1417 const gfx::Vector2dF& elastic_overscroll) { |
1375 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, | 1418 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, |
1376 elastic_overscroll); | 1419 elastic_overscroll); |
1377 } | 1420 } |
1378 | 1421 |
1379 } // namespace draw_property_utils | 1422 } // namespace draw_property_utils |
1380 | 1423 |
1381 } // namespace cc | 1424 } // namespace cc |
OLD | NEW |