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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 // but in either case, we'll be clipping to the projected clip rect of our | 1938 // but in either case, we'll be clipping to the projected clip rect of our |
1939 // ancestor. | 1939 // ancestor. |
1940 gfx::Transform inverse_surface_draw_transform( | 1940 gfx::Transform inverse_surface_draw_transform( |
1941 gfx::Transform::kSkipInitialization); | 1941 gfx::Transform::kSkipInitialization); |
1942 if (!render_surface->draw_transform().GetInverse( | 1942 if (!render_surface->draw_transform().GetInverse( |
1943 &inverse_surface_draw_transform)) { | 1943 &inverse_surface_draw_transform)) { |
1944 // TODO(shawnsingh): Either we need to handle uninvertible transforms | 1944 // TODO(shawnsingh): Either we need to handle uninvertible transforms |
1945 // here, or DCHECK that the transform is invertible. | 1945 // here, or DCHECK that the transform is invertible. |
1946 } | 1946 } |
1947 | 1947 |
| 1948 gfx::Rect surface_clip_rect_in_target_space = gfx::IntersectRects( |
| 1949 data_from_ancestor.clip_rect_of_target_surface_in_target_space, |
| 1950 ancestor_clip_rect_in_target_space); |
1948 gfx::Rect projected_surface_rect = MathUtil::ProjectEnclosingClippedRect( | 1951 gfx::Rect projected_surface_rect = MathUtil::ProjectEnclosingClippedRect( |
1949 inverse_surface_draw_transform, ancestor_clip_rect_in_target_space); | 1952 inverse_surface_draw_transform, surface_clip_rect_in_target_space); |
1950 | 1953 |
1951 if (layer_draw_properties.num_unclipped_descendants > 0) { | 1954 if (layer_draw_properties.num_unclipped_descendants > 0) { |
1952 // If we have unclipped descendants, we cannot count on the render | 1955 // If we have unclipped descendants, we cannot count on the render |
1953 // surface's bounds clipping our subtree: the unclipped descendants | 1956 // surface's bounds clipping our subtree: the unclipped descendants |
1954 // could cause us to expand our bounds. In this case, we must rely on | 1957 // could cause us to expand our bounds. In this case, we must rely on |
1955 // layer clipping for correctess. NB: since we can only encounter | 1958 // layer clipping for correctess. NB: since we can only encounter |
1956 // translations between a clip child and its clip parent, clipping is | 1959 // translations between a clip child and its clip parent, clipping is |
1957 // guaranteed to be exact in this case. | 1960 // guaranteed to be exact in this case. |
1958 layer_or_ancestor_clips_descendants = true; | 1961 layer_or_ancestor_clips_descendants = true; |
1959 clip_rect_in_target_space = projected_surface_rect; | 1962 clip_rect_in_target_space = projected_surface_rect; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 globals.layer_sorter); | 2323 globals.layer_sorter); |
2321 } | 2324 } |
2322 | 2325 |
2323 UpdateAccumulatedSurfaceState<LayerType>( | 2326 UpdateAccumulatedSurfaceState<LayerType>( |
2324 layer, local_drawable_content_rect_of_subtree, accumulated_surface_state); | 2327 layer, local_drawable_content_rect_of_subtree, accumulated_surface_state); |
2325 | 2328 |
2326 if (layer->HasContributingDelegatedRenderPasses()) { | 2329 if (layer->HasContributingDelegatedRenderPasses()) { |
2327 layer->render_target()->render_surface()-> | 2330 layer->render_target()->render_surface()-> |
2328 AddContributingDelegatedRenderPassLayer(layer); | 2331 AddContributingDelegatedRenderPassLayer(layer); |
2329 } | 2332 } |
2330 } | 2333 } // NOLINT(readability/fn_size) |
2331 | 2334 |
2332 template <typename LayerType, typename RenderSurfaceLayerListType> | 2335 template <typename LayerType, typename RenderSurfaceLayerListType> |
2333 static void ProcessCalcDrawPropsInputs( | 2336 static void ProcessCalcDrawPropsInputs( |
2334 const LayerTreeHostCommon::CalcDrawPropsInputs<LayerType, | 2337 const LayerTreeHostCommon::CalcDrawPropsInputs<LayerType, |
2335 RenderSurfaceLayerListType>& | 2338 RenderSurfaceLayerListType>& |
2336 inputs, | 2339 inputs, |
2337 SubtreeGlobals<LayerType>* globals, | 2340 SubtreeGlobals<LayerType>* globals, |
2338 DataForRecursion<LayerType>* data_for_recursion) { | 2341 DataForRecursion<LayerType>* data_for_recursion) { |
2339 DCHECK(inputs.root_layer); | 2342 DCHECK(inputs.root_layer); |
2340 DCHECK(IsRootLayer(inputs.root_layer)); | 2343 DCHECK(IsRootLayer(inputs.root_layer)); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 inputs->current_render_surface_layer_list_id); | 2436 inputs->current_render_surface_layer_list_id); |
2434 | 2437 |
2435 // The dummy layer list should not have been used. | 2438 // The dummy layer list should not have been used. |
2436 DCHECK_EQ(0u, dummy_layer_list.size()); | 2439 DCHECK_EQ(0u, dummy_layer_list.size()); |
2437 // A root layer render_surface should always exist after | 2440 // A root layer render_surface should always exist after |
2438 // CalculateDrawProperties. | 2441 // CalculateDrawProperties. |
2439 DCHECK(inputs->root_layer->render_surface()); | 2442 DCHECK(inputs->root_layer->render_surface()); |
2440 } | 2443 } |
2441 | 2444 |
2442 } // namespace cc | 2445 } // namespace cc |
OLD | NEW |