OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1753 data_from_ancestor.full_hierarchy_matrix; | 1753 data_from_ancestor.full_hierarchy_matrix; |
1754 | 1754 |
1755 bool render_to_separate_surface = | 1755 bool render_to_separate_surface = |
1756 IsRootLayer(layer) || | 1756 IsRootLayer(layer) || |
1757 (globals.can_render_to_separate_surface && layer->render_surface()); | 1757 (globals.can_render_to_separate_surface && layer->render_surface()); |
1758 | 1758 |
1759 if (render_to_separate_surface) { | 1759 if (render_to_separate_surface) { |
1760 DCHECK(layer->render_surface()); | 1760 DCHECK(layer->render_surface()); |
1761 // Check back-face visibility before continuing with this surface and its | 1761 // Check back-face visibility before continuing with this surface and its |
1762 // subtree | 1762 // subtree |
1763 RenderSurfaceImpl* render_surface = layer->render_surface(); | |
1763 if (!layer->double_sided() && | 1764 if (!layer->double_sided() && |
1764 IsSurfaceBackFaceVisible(layer, combined_transform)) { | 1765 IsSurfaceBackFaceVisible(layer, combined_transform)) { |
1766 gfx::Transform draw_transform = combined_transform; | |
ajuma
2015/11/10 00:17:15
Please add a comment that we need this logic since
| |
1767 draw_transform.Scale(1.0 / combined_transform_scales.x(), | |
1768 1.0 / combined_transform_scales.y()); | |
1769 render_surface->SetDrawTransform(draw_transform); | |
jaydasika
2015/11/09 22:56:45
CDP and PT render surface draw transform don't mat
ajuma
2015/11/09 23:31:21
Is this because the "skipped" surface is still win
| |
1765 return; | 1770 return; |
1766 } | 1771 } |
1767 | 1772 |
1768 RenderSurfaceImpl* render_surface = layer->render_surface(); | |
1769 | |
1770 if (IsRootLayer(layer)) { | 1773 if (IsRootLayer(layer)) { |
1771 // The root layer's render surface size is predetermined and so the root | 1774 // The root layer's render surface size is predetermined and so the root |
1772 // layer can't directly support non-identity transforms. It should just | 1775 // layer can't directly support non-identity transforms. It should just |
1773 // forward top-level transforms to the rest of the tree. | 1776 // forward top-level transforms to the rest of the tree. |
1774 data_for_children.parent_matrix = combined_transform; | 1777 data_for_children.parent_matrix = combined_transform; |
1775 } else { | 1778 } else { |
1776 // The owning layer's draw transform has a scale from content to layer | 1779 // The owning layer's draw transform has a scale from content to layer |
1777 // space which we do not want; so here we use the combined_transform | 1780 // space which we do not want; so here we use the combined_transform |
1778 // instead of the draw_transform. However, we do need to add a different | 1781 // instead of the draw_transform. However, we do need to add a different |
1779 // scale factor that accounts for the surface's pixel dimensions. | 1782 // scale factor that accounts for the surface's pixel dimensions. |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2471 layer->draw_properties().render_target = nullptr; | 2474 layer->draw_properties().render_target = nullptr; |
2472 return; | 2475 return; |
2473 } | 2476 } |
2474 | 2477 |
2475 bool render_to_separate_surface = | 2478 bool render_to_separate_surface = |
2476 IsRootLayer(layer) || | 2479 IsRootLayer(layer) || |
2477 (can_render_to_separate_surface && layer->render_surface()); | 2480 (can_render_to_separate_surface && layer->render_surface()); |
2478 | 2481 |
2479 if (render_to_separate_surface) { | 2482 if (render_to_separate_surface) { |
2480 DCHECK(layer->render_surface()); | 2483 DCHECK(layer->render_surface()); |
2481 if (!layer->double_sided() && | |
2482 IsSurfaceBackFaceVisible(layer, layer->draw_transform())) { | |
2483 layer->ClearRenderSurfaceLayerList(); | |
2484 layer->draw_properties().render_target = nullptr; | |
2485 return; | |
2486 } | |
2487 | 2484 |
2488 if (use_property_trees) { | 2485 if (use_property_trees) { |
2489 RenderSurfaceDrawProperties draw_properties; | 2486 RenderSurfaceDrawProperties draw_properties; |
2490 ComputeSurfaceDrawPropertiesUsingPropertyTrees( | 2487 ComputeSurfaceDrawPropertiesUsingPropertyTrees( |
2491 layer->render_surface(), property_trees, &draw_properties); | 2488 layer->render_surface(), property_trees, &draw_properties); |
2492 // TODO(ajuma): Once property tree verification is removed, make the above | 2489 // TODO(ajuma): Once property tree verification is removed, make the above |
2493 // call directly set the surface's properties, so that the copying below | 2490 // call directly set the surface's properties, so that the copying below |
2494 // is no longer needed. | 2491 // is no longer needed. |
2495 layer->render_surface()->SetIsClipped(draw_properties.is_clipped); | 2492 layer->render_surface()->SetIsClipped(draw_properties.is_clipped); |
2496 layer->render_surface()->SetDrawOpacity(draw_properties.draw_opacity); | 2493 layer->render_surface()->SetDrawOpacity(draw_properties.draw_opacity); |
2497 layer->render_surface()->SetDrawTransform(draw_properties.draw_transform); | 2494 layer->render_surface()->SetDrawTransform(draw_properties.draw_transform); |
2498 layer->render_surface()->SetScreenSpaceTransform( | 2495 layer->render_surface()->SetScreenSpaceTransform( |
2499 draw_properties.screen_space_transform); | 2496 draw_properties.screen_space_transform); |
2500 layer->render_surface()->SetReplicaDrawTransform( | 2497 layer->render_surface()->SetReplicaDrawTransform( |
2501 draw_properties.replica_draw_transform); | 2498 draw_properties.replica_draw_transform); |
2502 layer->render_surface()->SetReplicaScreenSpaceTransform( | 2499 layer->render_surface()->SetReplicaScreenSpaceTransform( |
2503 draw_properties.replica_screen_space_transform); | 2500 draw_properties.replica_screen_space_transform); |
2504 layer->render_surface()->SetClipRect(draw_properties.clip_rect); | 2501 layer->render_surface()->SetClipRect(draw_properties.clip_rect); |
2505 } | 2502 } |
2506 | 2503 |
2504 if (!layer->double_sided() && | |
2505 IsSurfaceBackFaceVisible(layer, | |
2506 layer->render_surface()->draw_transform())) { | |
2507 layer->ClearRenderSurfaceLayerList(); | |
2508 layer->draw_properties().render_target = nullptr; | |
ajuma
2015/11/09 23:31:21
Would calling RemoveSurfaceForEarlyExit here fix t
jaydasika
2015/11/10 00:06:40
No that won't still fix the mismatch. We either ne
ajuma
2015/11/10 00:17:15
Oh, I think I understand: the old code relied on t
| |
2509 return; | |
2510 } | |
2511 | |
2507 if (IsRootLayer(layer)) { | 2512 if (IsRootLayer(layer)) { |
2508 // The root surface does not contribute to any other surface, it has no | 2513 // The root surface does not contribute to any other surface, it has no |
2509 // target. | 2514 // target. |
2510 layer->render_surface()->set_contributes_to_drawn_surface(false); | 2515 layer->render_surface()->set_contributes_to_drawn_surface(false); |
2511 } else { | 2516 } else { |
2512 // Even if the |layer_is_drawn|, it only contributes to a drawn surface | 2517 // Even if the |layer_is_drawn|, it only contributes to a drawn surface |
2513 // when the |layer_is_visible|. | 2518 // when the |layer_is_visible|. |
2514 layer->render_surface()->set_contributes_to_drawn_surface( | 2519 layer->render_surface()->set_contributes_to_drawn_surface( |
2515 layer_is_visible); | 2520 layer_is_visible); |
2516 } | 2521 } |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2842 | 2847 |
2843 PropertyTrees* GetPropertyTrees(Layer* layer) { | 2848 PropertyTrees* GetPropertyTrees(Layer* layer) { |
2844 return layer->layer_tree_host()->property_trees(); | 2849 return layer->layer_tree_host()->property_trees(); |
2845 } | 2850 } |
2846 | 2851 |
2847 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { | 2852 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { |
2848 return layer->layer_tree_impl()->property_trees(); | 2853 return layer->layer_tree_impl()->property_trees(); |
2849 } | 2854 } |
2850 | 2855 |
2851 } // namespace cc | 2856 } // namespace cc |
OLD | NEW |