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

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

Issue 1418663006: Turn on property tree verification for PictureLayerImplTests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/layers/picture_layer_impl_unittest.cc ('k') | no next file » | 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 <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 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 2427
2428 void CalculateRenderSurfaceLayerListInternal( 2428 void CalculateRenderSurfaceLayerListInternal(
2429 LayerImpl* layer, 2429 LayerImpl* layer,
2430 PropertyTrees* property_trees, 2430 PropertyTrees* property_trees,
2431 LayerImplList* render_surface_layer_list, 2431 LayerImplList* render_surface_layer_list,
2432 LayerImplList* descendants, 2432 LayerImplList* descendants,
2433 RenderSurfaceImpl* nearest_occlusion_immune_ancestor, 2433 RenderSurfaceImpl* nearest_occlusion_immune_ancestor,
2434 bool subtree_visible_from_ancestor, 2434 bool subtree_visible_from_ancestor,
2435 const bool can_render_to_separate_surface, 2435 const bool can_render_to_separate_surface,
2436 const int current_render_surface_layer_list_id, 2436 const int current_render_surface_layer_list_id,
2437 const int max_texture_size,
2437 const bool verify_property_trees) { 2438 const bool verify_property_trees) {
2438 // This calculates top level Render Surface Layer List, and Layer List for all 2439 // This calculates top level Render Surface Layer List, and Layer List for all
2439 // Render Surfaces. 2440 // Render Surfaces.
2440 2441
2441 // |layer| is current layer. 2442 // |layer| is current layer.
2442 2443
2443 // |render_surface_layer_list| is the top level RenderSurfaceLayerList. 2444 // |render_surface_layer_list| is the top level RenderSurfaceLayerList.
2444 2445
2445 // |descendants| is used to determine what's in current layer's render 2446 // |descendants| is used to determine what's in current layer's render
2446 // surface's layer list. 2447 // surface's layer list.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
2522 2523
2523 // Clear the old accumulated content rect of surface. 2524 // Clear the old accumulated content rect of surface.
2524 if (verify_property_trees && render_to_separate_surface) 2525 if (verify_property_trees && render_to_separate_surface)
2525 layer->render_surface()->SetAccumulatedContentRect(gfx::Rect()); 2526 layer->render_surface()->SetAccumulatedContentRect(gfx::Rect());
2526 2527
2527 for (auto& child_layer : layer->children()) { 2528 for (auto& child_layer : layer->children()) {
2528 CalculateRenderSurfaceLayerListInternal( 2529 CalculateRenderSurfaceLayerListInternal(
2529 child_layer, property_trees, render_surface_layer_list, descendants, 2530 child_layer, property_trees, render_surface_layer_list, descendants,
2530 nearest_occlusion_immune_ancestor, layer_is_drawn, 2531 nearest_occlusion_immune_ancestor, layer_is_drawn,
2531 can_render_to_separate_surface, current_render_surface_layer_list_id, 2532 can_render_to_separate_surface, current_render_surface_layer_list_id,
2532 verify_property_trees); 2533 max_texture_size, verify_property_trees);
2533 2534
2534 // If the child is its own render target, then it has a render surface. 2535 // If the child is its own render target, then it has a render surface.
2535 if (child_layer->render_target() == child_layer && 2536 if (child_layer->render_target() == child_layer &&
2536 !child_layer->render_surface()->layer_list().empty() && 2537 !child_layer->render_surface()->layer_list().empty() &&
2537 !child_layer->render_surface()->content_rect().IsEmpty()) { 2538 !child_layer->render_surface()->content_rect().IsEmpty()) {
2538 // This child will contribute its render surface, which means 2539 // This child will contribute its render surface, which means
2539 // we need to mark just the mask layer (and replica mask layer) 2540 // we need to mark just the mask layer (and replica mask layer)
2540 // with the id. 2541 // with the id.
2541 MarkMasksWithRenderSurfaceLayerListId( 2542 MarkMasksWithRenderSurfaceLayerListId(
2542 child_layer, current_render_surface_layer_list_id); 2543 child_layer, current_render_surface_layer_list_id);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 // intersect it with clip rect and project back the result to the 2577 // intersect it with clip rect and project back the result to the
2577 // surface space. 2578 // surface space.
2578 if (!surface_content_rect.IsEmpty()) { 2579 if (!surface_content_rect.IsEmpty()) {
2579 gfx::Rect surface_clip_rect = 2580 gfx::Rect surface_clip_rect =
2580 LayerTreeHostCommon::CalculateVisibleRect( 2581 LayerTreeHostCommon::CalculateVisibleRect(
2581 layer->render_surface()->clip_rect(), surface_content_rect, 2582 layer->render_surface()->clip_rect(), surface_content_rect,
2582 layer->render_surface()->draw_transform()); 2583 layer->render_surface()->draw_transform());
2583 surface_content_rect.Intersect(surface_clip_rect); 2584 surface_content_rect.Intersect(surface_clip_rect);
2584 } 2585 }
2585 } 2586 }
2587 // The RenderSurfaceImpl backing texture cannot exceed the maximum
2588 // supported texture size.
2589 surface_content_rect.set_width(
2590 std::min(surface_content_rect.width(), max_texture_size));
2591 surface_content_rect.set_height(
2592 std::min(surface_content_rect.height(), max_texture_size));
2586 layer->render_surface()->SetContentRectFromPropertyTrees( 2593 layer->render_surface()->SetContentRectFromPropertyTrees(
2587 surface_content_rect); 2594 surface_content_rect);
2588 } 2595 }
2589 const LayerImpl* parent_target = layer->parent()->render_target(); 2596 const LayerImpl* parent_target = layer->parent()->render_target();
2590 if (!IsRootLayer(parent_target)) { 2597 if (!IsRootLayer(parent_target)) {
2591 gfx::Rect surface_content_rect = 2598 gfx::Rect surface_content_rect =
2592 parent_target->render_surface()->accumulated_content_rect(); 2599 parent_target->render_surface()->accumulated_content_rect();
2593 if (render_to_separate_surface) { 2600 if (render_to_separate_surface) {
2594 // If the layer owns a surface, then the content rect is in the wrong 2601 // If the layer owns a surface, then the content rect is in the wrong
2595 // space. Instead, we will use the surface's DrawableContentRect which 2602 // space. Instead, we will use the surface's DrawableContentRect which
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 inputs->can_render_to_separate_surface); 2645 inputs->can_render_to_separate_surface);
2639 } 2646 }
2640 2647
2641 void CalculateRenderSurfaceLayerList( 2648 void CalculateRenderSurfaceLayerList(
2642 LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) { 2649 LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) {
2643 const bool subtree_visible_from_ancestor = true; 2650 const bool subtree_visible_from_ancestor = true;
2644 CalculateRenderSurfaceLayerListInternal( 2651 CalculateRenderSurfaceLayerListInternal(
2645 inputs->root_layer, inputs->property_trees, 2652 inputs->root_layer, inputs->property_trees,
2646 inputs->render_surface_layer_list, nullptr, nullptr, 2653 inputs->render_surface_layer_list, nullptr, nullptr,
2647 subtree_visible_from_ancestor, inputs->can_render_to_separate_surface, 2654 subtree_visible_from_ancestor, inputs->can_render_to_separate_surface,
2648 inputs->current_render_surface_layer_list_id, 2655 inputs->current_render_surface_layer_list_id, inputs->max_texture_size,
2649 inputs->verify_property_trees); 2656 inputs->verify_property_trees);
2650 } 2657 }
2651 2658
2652 void CalculateDrawPropertiesAndVerify( 2659 void CalculateDrawPropertiesAndVerify(
2653 LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs, 2660 LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs,
2654 PropertyTreeOption property_tree_option) { 2661 PropertyTreeOption property_tree_option) {
2655 SubtreeGlobals globals; 2662 SubtreeGlobals globals;
2656 DataForRecursion data_for_recursion; 2663 DataForRecursion data_for_recursion;
2657 inputs->render_surface_layer_list->clear(); 2664 inputs->render_surface_layer_list->clear();
2658 2665
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 2784
2778 PropertyTrees* GetPropertyTrees(Layer* layer) { 2785 PropertyTrees* GetPropertyTrees(Layer* layer) {
2779 return layer->layer_tree_host()->property_trees(); 2786 return layer->layer_tree_host()->property_trees();
2780 } 2787 }
2781 2788
2782 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { 2789 PropertyTrees* GetPropertyTrees(LayerImpl* layer) {
2783 return layer->layer_tree_impl()->property_trees(); 2790 return layer->layer_tree_impl()->property_trees();
2784 } 2791 }
2785 2792
2786 } // namespace cc 2793 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698