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

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

Issue 953093002: cc: Derive draw opacity from property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make opacity tree-building optional Created 5 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/draw_property_utils.cc ('k') | cc/trees/property_tree.h » ('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 <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 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 DCHECK_EQ(0u, dummy_layer_list.size()); 2513 DCHECK_EQ(0u, dummy_layer_list.size());
2514 // A root layer render_surface should always exist after 2514 // A root layer render_surface should always exist after
2515 // CalculateDrawProperties. 2515 // CalculateDrawProperties.
2516 DCHECK(inputs->root_layer->render_surface()); 2516 DCHECK(inputs->root_layer->render_surface());
2517 2517
2518 if (inputs->verify_property_trees) { 2518 if (inputs->verify_property_trees) {
2519 // The translation from layer to property trees is an intermediate state. We 2519 // The translation from layer to property trees is an intermediate state. We
2520 // will eventually get these data passed directly to the compositor. 2520 // will eventually get these data passed directly to the compositor.
2521 TransformTree transform_tree; 2521 TransformTree transform_tree;
2522 ClipTree clip_tree; 2522 ClipTree clip_tree;
2523 OpacityTree opacity_tree;
2523 ComputeVisibleRectsUsingPropertyTrees( 2524 ComputeVisibleRectsUsingPropertyTrees(
2524 inputs->root_layer, inputs->page_scale_application_layer, 2525 inputs->root_layer, inputs->page_scale_application_layer,
2525 inputs->page_scale_factor, inputs->device_scale_factor, 2526 inputs->page_scale_factor, inputs->device_scale_factor,
2526 gfx::Rect(inputs->device_viewport_size), inputs->device_transform, 2527 gfx::Rect(inputs->device_viewport_size), inputs->device_transform,
2527 &transform_tree, &clip_tree); 2528 &transform_tree, &clip_tree, &opacity_tree);
2528 2529
2529 LayerIterator<Layer> it, end; 2530 LayerIterator<Layer> it, end;
2530 for (it = LayerIterator<Layer>::Begin(inputs->render_surface_layer_list), 2531 for (it = LayerIterator<Layer>::Begin(inputs->render_surface_layer_list),
2531 end = LayerIterator<Layer>::End(inputs->render_surface_layer_list); 2532 end = LayerIterator<Layer>::End(inputs->render_surface_layer_list);
2532 it != end; ++it) { 2533 it != end; ++it) {
2533 Layer* current_layer = *it; 2534 Layer* current_layer = *it;
2534 if (!it.represents_itself() || !current_layer->DrawsContent()) 2535 if (!it.represents_itself() || !current_layer->DrawsContent())
2535 continue; 2536 continue;
2536 2537
2537 const bool visible_rects_match = 2538 const bool visible_rects_match =
2538 ApproximatelyEqual(current_layer->visible_content_rect(), 2539 ApproximatelyEqual(current_layer->visible_content_rect(),
2539 current_layer->visible_rect_from_property_trees()); 2540 current_layer->visible_rect_from_property_trees());
2540 CHECK(visible_rects_match); 2541 CHECK(visible_rects_match);
2541 2542
2542 const bool draw_transforms_match = ApproximatelyEqual( 2543 const bool draw_transforms_match = ApproximatelyEqual(
2543 current_layer->draw_transform(), 2544 current_layer->draw_transform(),
2544 current_layer->draw_transform_from_property_trees(transform_tree)); 2545 current_layer->draw_transform_from_property_trees(transform_tree));
2545 CHECK(draw_transforms_match); 2546 CHECK(draw_transforms_match);
2547
2548 const bool draw_opacities_match =
2549 current_layer->draw_opacity() ==
2550 current_layer->DrawOpacityFromPropertyTrees(opacity_tree);
2551 CHECK(draw_opacities_match);
2546 } 2552 }
2547 } 2553 }
2548 } 2554 }
2549 2555
2550 void LayerTreeHostCommon::CalculateDrawProperties( 2556 void LayerTreeHostCommon::CalculateDrawProperties(
2551 CalcDrawPropsImplInputs* inputs) { 2557 CalcDrawPropsImplInputs* inputs) {
2552 LayerImplList dummy_layer_list; 2558 LayerImplList dummy_layer_list;
2553 SubtreeGlobals<LayerImpl> globals; 2559 SubtreeGlobals<LayerImpl> globals;
2554 DataForRecursion<LayerImpl> data_for_recursion; 2560 DataForRecursion<LayerImpl> data_for_recursion;
2555 ProcessCalcDrawPropsInputs(*inputs, &globals, &data_for_recursion); 2561 ProcessCalcDrawPropsInputs(*inputs, &globals, &data_for_recursion);
(...skipping 14 matching lines...) Expand all
2570 inputs->current_render_surface_layer_list_id); 2576 inputs->current_render_surface_layer_list_id);
2571 2577
2572 // The dummy layer list should not have been used. 2578 // The dummy layer list should not have been used.
2573 DCHECK_EQ(0u, dummy_layer_list.size()); 2579 DCHECK_EQ(0u, dummy_layer_list.size());
2574 // A root layer render_surface should always exist after 2580 // A root layer render_surface should always exist after
2575 // CalculateDrawProperties. 2581 // CalculateDrawProperties.
2576 DCHECK(inputs->root_layer->render_surface()); 2582 DCHECK(inputs->root_layer->render_surface());
2577 } 2583 }
2578 2584
2579 } // namespace cc 2585 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698