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

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: rebase + update test Created 6 years, 6 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 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 layer, 1733 layer,
1734 globals.can_adjust_raster_scales, 1734 globals.can_adjust_raster_scales,
1735 ideal_contents_scale, 1735 ideal_contents_scale,
1736 globals.device_scale_factor, 1736 globals.device_scale_factor,
1737 data_from_ancestor.in_subtree_of_page_scale_application_layer 1737 data_from_ancestor.in_subtree_of_page_scale_application_layer
1738 ? globals.page_scale_factor 1738 ? globals.page_scale_factor
1739 : 1.f, 1739 : 1.f,
1740 combined_maximum_animation_contents_scale, 1740 combined_maximum_animation_contents_scale,
1741 animating_transform_to_screen); 1741 animating_transform_to_screen);
1742 1742
1743 layer_draw_properties.ideal_contents_scale = ideal_contents_scale;
danakj 2014/06/11 19:48:35 Notice that CalculateContentsScale() in this file
sohanjg 2014/06/12 11:48:24 Done.
1744 layer_draw_properties.maximum_animation_contents_scale =
1745 combined_maximum_animation_contents_scale;
1746 layer_draw_properties.page_scale_factor =
1747 data_from_ancestor.in_subtree_of_page_scale_application_layer
1748 ? globals.page_scale_factor
1749 : 1.f;
1750 layer_draw_properties.device_scale_factor = globals.device_scale_factor;
1751
1743 // The draw_transform that gets computed below is effectively the layer's 1752 // The draw_transform that gets computed below is effectively the layer's
1744 // draw_transform, unless the layer itself creates a render_surface. In that 1753 // draw_transform, unless the layer itself creates a render_surface. In that
1745 // case, the render_surface re-parents the transforms. 1754 // case, the render_surface re-parents the transforms.
1746 layer_draw_properties.target_space_transform = combined_transform; 1755 layer_draw_properties.target_space_transform = combined_transform;
1747 // M[draw] = M[parent] * LT * S[layer2content] 1756 // M[draw] = M[parent] * LT * S[layer2content]
1748 layer_draw_properties.target_space_transform.Scale( 1757 layer_draw_properties.target_space_transform.Scale(
1749 SK_MScalar1 / layer->contents_scale_x(), 1758 SK_MScalar1 / layer->contents_scale_x(),
1750 SK_MScalar1 / layer->contents_scale_y()); 1759 SK_MScalar1 / layer->contents_scale_y());
1751 1760
1752 // The layer's screen_space_transform represents the transform between root 1761 // The layer's screen_space_transform represents the transform between root
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 inputs->current_render_surface_layer_list_id); 2416 inputs->current_render_surface_layer_list_id);
2408 2417
2409 // The dummy layer list should not have been used. 2418 // The dummy layer list should not have been used.
2410 DCHECK_EQ(0u, dummy_layer_list.size()); 2419 DCHECK_EQ(0u, dummy_layer_list.size());
2411 // A root layer render_surface should always exist after 2420 // A root layer render_surface should always exist after
2412 // CalculateDrawProperties. 2421 // CalculateDrawProperties.
2413 DCHECK(inputs->root_layer->render_surface()); 2422 DCHECK(inputs->root_layer->render_surface());
2414 } 2423 }
2415 2424
2416 } // namespace cc 2425 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698