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

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

Issue 2716733007: cc: Rename LayerImpl::render_surface to GetRenderSurface (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 static void ComputeInitialRenderSurfaceLayerList( 285 static void ComputeInitialRenderSurfaceLayerList(
286 LayerTreeImpl* layer_tree_impl, 286 LayerTreeImpl* layer_tree_impl,
287 PropertyTrees* property_trees, 287 PropertyTrees* property_trees,
288 LayerImplList* render_surface_layer_list, 288 LayerImplList* render_surface_layer_list,
289 bool can_render_to_separate_surface) { 289 bool can_render_to_separate_surface) {
290 // Add all non-skipped surfaces to the initial render surface layer list. Add 290 // Add all non-skipped surfaces to the initial render surface layer list. Add
291 // all non-skipped layers to the layer list of their target surface, and 291 // all non-skipped layers to the layer list of their target surface, and
292 // add their content rect to their target surface's accumulated content rect. 292 // add their content rect to their target surface's accumulated content rect.
293 for (LayerImpl* layer : *layer_tree_impl) { 293 for (LayerImpl* layer : *layer_tree_impl) {
294 RenderSurfaceImpl* render_surface = layer->render_surface(); 294 RenderSurfaceImpl* render_surface = layer->GetRenderSurface();
295 if (render_surface) { 295 if (render_surface) {
296 render_surface->ClearLayerLists(); 296 render_surface->ClearLayerLists();
297 ClearMaskLayersAreDrawnRenderSurfaceLayerListMembers(render_surface); 297 ClearMaskLayersAreDrawnRenderSurfaceLayerListMembers(render_surface);
298 } 298 }
299 layer->set_is_drawn_render_surface_layer_list_member(false); 299 layer->set_is_drawn_render_surface_layer_list_member(false);
300 300
301 bool is_root = layer_tree_impl->IsRootLayer(layer); 301 bool is_root = layer_tree_impl->IsRootLayer(layer);
302 bool skip_layer = !is_root && draw_property_utils::LayerShouldBeSkipped( 302 bool skip_layer = !is_root && draw_property_utils::LayerShouldBeSkipped(
303 layer, property_trees->transform_tree, 303 layer, property_trees->transform_tree,
304 property_trees->effect_tree); 304 property_trees->effect_tree);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 } 366 }
367 367
368 static void ComputeSurfaceContentRects(LayerTreeImpl* layer_tree_impl, 368 static void ComputeSurfaceContentRects(LayerTreeImpl* layer_tree_impl,
369 PropertyTrees* property_trees, 369 PropertyTrees* property_trees,
370 LayerImplList* render_surface_layer_list, 370 LayerImplList* render_surface_layer_list,
371 int max_texture_size) { 371 int max_texture_size) {
372 // Walk the list backwards, accumulating each surface's content rect into its 372 // Walk the list backwards, accumulating each surface's content rect into its
373 // target's content rect. 373 // target's content rect.
374 for (LayerImpl* layer : base::Reversed(*render_surface_layer_list)) { 374 for (LayerImpl* layer : base::Reversed(*render_surface_layer_list)) {
375 RenderSurfaceImpl* render_surface = layer->render_surface(); 375 RenderSurfaceImpl* render_surface = layer->GetRenderSurface();
376 if (layer_tree_impl->IsRootLayer(layer)) { 376 if (layer_tree_impl->IsRootLayer(layer)) {
377 // The root layer's surface content rect is always the entire viewport. 377 // The root layer's surface content rect is always the entire viewport.
378 render_surface->SetContentRectToViewport(); 378 render_surface->SetContentRectToViewport();
379 continue; 379 continue;
380 } 380 }
381 381
382 // Now all contributing drawable content rect has been accumulated to this 382 // Now all contributing drawable content rect has been accumulated to this
383 // render surface, calculate the content rect. 383 // render surface, calculate the content rect.
384 render_surface->CalculateContentRectFromAccumulatedContentRect( 384 render_surface->CalculateContentRectFromAccumulatedContentRect(
385 max_texture_size); 385 max_texture_size);
386 386
387 // Now the render surface's content rect is calculated correctly, it could 387 // Now the render surface's content rect is calculated correctly, it could
388 // contribute to its render target. 388 // contribute to its render target.
389 render_surface->render_target() 389 render_surface->render_target()
390 ->AccumulateContentRectFromContributingRenderSurface(render_surface); 390 ->AccumulateContentRectFromContributingRenderSurface(render_surface);
391 } 391 }
392 } 392 }
393 393
394 static void ComputeListOfNonEmptySurfaces(LayerTreeImpl* layer_tree_impl, 394 static void ComputeListOfNonEmptySurfaces(LayerTreeImpl* layer_tree_impl,
395 PropertyTrees* property_trees, 395 PropertyTrees* property_trees,
396 LayerImplList* initial_surface_list, 396 LayerImplList* initial_surface_list,
397 LayerImplList* final_surface_list) { 397 LayerImplList* final_surface_list) {
398 // Walk the initial surface list forwards. The root surface and each 398 // Walk the initial surface list forwards. The root surface and each
399 // surface with a non-empty content rect go into the final render surface 399 // surface with a non-empty content rect go into the final render surface
400 // layer list. Surfaces with empty content rects or whose target isn't in 400 // layer list. Surfaces with empty content rects or whose target isn't in
401 // the final list do not get added to the final list. 401 // the final list do not get added to the final list.
402 for (LayerImpl* layer : *initial_surface_list) { 402 for (LayerImpl* layer : *initial_surface_list) {
403 bool is_root = layer_tree_impl->IsRootLayer(layer); 403 bool is_root = layer_tree_impl->IsRootLayer(layer);
404 RenderSurfaceImpl* surface = layer->render_surface(); 404 RenderSurfaceImpl* surface = layer->GetRenderSurface();
405 RenderSurfaceImpl* target_surface = surface->render_target(); 405 RenderSurfaceImpl* target_surface = surface->render_target();
406 if (!is_root && (surface->content_rect().IsEmpty() || 406 if (!is_root && (surface->content_rect().IsEmpty() ||
407 target_surface->layer_list().empty())) { 407 target_surface->layer_list().empty())) {
408 ClearIsDrawnRenderSurfaceLayerListMember(&surface->layer_list(), 408 ClearIsDrawnRenderSurfaceLayerListMember(&surface->layer_list(),
409 &property_trees->scroll_tree); 409 &property_trees->scroll_tree);
410 surface->ClearLayerLists(); 410 surface->ClearLayerLists();
411 if (!is_root) { 411 if (!is_root) {
412 LayerImplList& target_list = target_surface->layer_list(); 412 LayerImplList& target_list = target_surface->layer_list();
413 auto it = std::find(target_list.begin(), target_list.end(), layer); 413 auto it = std::find(target_list.begin(), target_list.end(), layer);
414 if (it != target_list.end()) { 414 if (it != target_list.end()) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 draw_property_utils::VerifyVisibleRectsCalculations(visible_layer_list, 560 draw_property_utils::VerifyVisibleRectsCalculations(visible_layer_list,
561 inputs->property_trees); 561 inputs->property_trees);
562 562
563 if (should_measure_property_tree_performance) { 563 if (should_measure_property_tree_performance) {
564 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"), 564 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
565 "LayerTreeHostCommon::CalculateDrawProperties"); 565 "LayerTreeHostCommon::CalculateDrawProperties");
566 } 566 }
567 567
568 // A root layer render_surface should always exist after 568 // A root layer render_surface should always exist after
569 // CalculateDrawProperties. 569 // CalculateDrawProperties.
570 DCHECK(inputs->root_layer->render_surface()); 570 DCHECK(inputs->root_layer->GetRenderSurface());
571 } 571 }
572 572
573 void LayerTreeHostCommon::CalculateDrawPropertiesForTesting( 573 void LayerTreeHostCommon::CalculateDrawPropertiesForTesting(
574 CalcDrawPropsMainInputsForTesting* inputs) { 574 CalcDrawPropsMainInputsForTesting* inputs) {
575 LayerList update_layer_list; 575 LayerList update_layer_list;
576 bool can_render_to_separate_surface = true; 576 bool can_render_to_separate_surface = true;
577 PropertyTrees* property_trees = 577 PropertyTrees* property_trees =
578 inputs->root_layer->layer_tree_host()->property_trees(); 578 inputs->root_layer->layer_tree_host()->property_trees();
579 Layer* overscroll_elasticity_layer = nullptr; 579 Layer* overscroll_elasticity_layer = nullptr;
580 gfx::Vector2dF elastic_overscroll; 580 gfx::Vector2dF elastic_overscroll;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 650
651 PropertyTrees* GetPropertyTrees(Layer* layer) { 651 PropertyTrees* GetPropertyTrees(Layer* layer) {
652 return layer->layer_tree_host()->property_trees(); 652 return layer->layer_tree_host()->property_trees();
653 } 653 }
654 654
655 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { 655 PropertyTrees* GetPropertyTrees(LayerImpl* layer) {
656 return layer->layer_tree_impl()->property_trees(); 656 return layer->layer_tree_impl()->property_trees();
657 } 657 }
658 658
659 } // namespace cc 659 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698