Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 271533011: cc: Move tiling management out of draw properties calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments + unit/perf test fails addressed Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (target_surface_rect.Contains(layer_rect_in_target_space)) 74 if (target_surface_rect.Contains(layer_rect_in_target_space))
75 return layer_bound_rect; 75 return layer_bound_rect;
76 76
77 // If the layer doesn't fill up the entire surface, then find the part of 77 // If the layer doesn't fill up the entire surface, then find the part of
78 // the surface rect where the layer could be visible. This avoids trying to 78 // the surface rect where the layer could be visible. This avoids trying to
79 // project surface rect points that are behind the projection point. 79 // project surface rect points that are behind the projection point.
80 gfx::Rect minimal_surface_rect = target_surface_rect; 80 gfx::Rect minimal_surface_rect = target_surface_rect;
81 minimal_surface_rect.Intersect(layer_rect_in_target_space); 81 minimal_surface_rect.Intersect(layer_rect_in_target_space);
82 82
83 if (minimal_surface_rect.IsEmpty()) 83 if (minimal_surface_rect.IsEmpty())
84 return gfx::Rect(); 84 return gfx::Rect();
85 85
86 // Project the corners of the target surface rect into the layer space. 86 // Project the corners of the target surface rect into the layer space.
87 // This bounding rectangle may be larger than it needs to be (being 87 // This bounding rectangle may be larger than it needs to be (being
88 // axis-aligned), but is a reasonable filter on the space to consider. 88 // axis-aligned), but is a reasonable filter on the space to consider.
89 // Non-invertible transforms will create an empty rect here. 89 // Non-invertible transforms will create an empty rect here.
90 90
91 gfx::Transform surface_to_layer(gfx::Transform::kSkipInitialization); 91 gfx::Transform surface_to_layer(gfx::Transform::kSkipInitialization);
92 if (!transform.GetInverse(&surface_to_layer)) { 92 if (!transform.GetInverse(&surface_to_layer)) {
93 // Because we cannot use the surface bounds to determine what portion of 93 // Because we cannot use the surface bounds to determine what portion of
94 // the layer is visible, we must conservatively assume the full layer is 94 // the layer is visible, we must conservatively assume the full layer is
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 layer, 1737 layer,
1738 globals.can_adjust_raster_scales, 1738 globals.can_adjust_raster_scales,
1739 ideal_contents_scale, 1739 ideal_contents_scale,
1740 globals.device_scale_factor, 1740 globals.device_scale_factor,
1741 data_from_ancestor.in_subtree_of_page_scale_application_layer 1741 data_from_ancestor.in_subtree_of_page_scale_application_layer
1742 ? globals.page_scale_factor 1742 ? globals.page_scale_factor
1743 : 1.f, 1743 : 1.f,
1744 combined_maximum_animation_contents_scale, 1744 combined_maximum_animation_contents_scale,
1745 animating_transform_to_screen); 1745 animating_transform_to_screen);
1746 1746
1747 layer_draw_properties.ideal_contents_scale = ideal_contents_scale;
danakj 2014/05/21 15:01:00 Can we add a unit test to layer_tree_host_common_u
1748 layer_draw_properties.maximum_animation_contents_scale =
1749 combined_maximum_animation_contents_scale;
1750 layer_draw_properties.page_scale =
1751 data_from_ancestor.in_subtree_of_page_scale_application_layer
1752 ? globals.page_scale_factor
1753 : 1.f;
1754 layer_draw_properties.device_scale = globals.device_scale_factor;
1755
1747 // The draw_transform that gets computed below is effectively the layer's 1756 // The draw_transform that gets computed below is effectively the layer's
1748 // draw_transform, unless the layer itself creates a render_surface. In that 1757 // draw_transform, unless the layer itself creates a render_surface. In that
1749 // case, the render_surface re-parents the transforms. 1758 // case, the render_surface re-parents the transforms.
1750 layer_draw_properties.target_space_transform = combined_transform; 1759 layer_draw_properties.target_space_transform = combined_transform;
1751 // M[draw] = M[parent] * LT * S[layer2content] 1760 // M[draw] = M[parent] * LT * S[layer2content]
1752 layer_draw_properties.target_space_transform.Scale( 1761 layer_draw_properties.target_space_transform.Scale(
1753 SK_MScalar1 / layer->contents_scale_x(), 1762 SK_MScalar1 / layer->contents_scale_x(),
1754 SK_MScalar1 / layer->contents_scale_y()); 1763 SK_MScalar1 / layer->contents_scale_y());
1755 1764
1756 // The layer's screen_space_transform represents the transform between root 1765 // The layer's screen_space_transform represents the transform between root
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 inputs->current_render_surface_layer_list_id); 2420 inputs->current_render_surface_layer_list_id);
2412 2421
2413 // The dummy layer list should not have been used. 2422 // The dummy layer list should not have been used.
2414 DCHECK_EQ(0u, dummy_layer_list.size()); 2423 DCHECK_EQ(0u, dummy_layer_list.size());
2415 // A root layer render_surface should always exist after 2424 // A root layer render_surface should always exist after
2416 // CalculateDrawProperties. 2425 // CalculateDrawProperties.
2417 DCHECK(inputs->root_layer->render_surface()); 2426 DCHECK(inputs->root_layer->render_surface());
2418 } 2427 }
2419 2428
2420 } // namespace cc 2429 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698