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

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

Issue 1479883002: cc: Fix draw transform computation for non-drawn layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove LayerImpl::draw_transform() Created 5 years 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/damage_tracker.h" 5 #include "cc/trees/damage_tracker.h"
6 6
7 #include "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/layers/layer_impl.h" 8 #include "cc/layers/layer_impl.h"
9 #include "cc/output/filter_operation.h" 9 #include "cc/output/filter_operation.h"
10 #include "cc/output/filter_operations.h" 10 #include "cc/output/filter_operations.h"
(...skipping 15 matching lines...) Expand all
26 26
27 void ExecuteCalculateDrawProperties(LayerImpl* root, 27 void ExecuteCalculateDrawProperties(LayerImpl* root,
28 LayerImplList* render_surface_layer_list) { 28 LayerImplList* render_surface_layer_list) {
29 // Sanity check: The test itself should create the root layer's render 29 // Sanity check: The test itself should create the root layer's render
30 // surface, so that the surface (and its damage tracker) can 30 // surface, so that the surface (and its damage tracker) can
31 // persist across multiple calls to this function. 31 // persist across multiple calls to this function.
32 ASSERT_TRUE(root->render_surface()); 32 ASSERT_TRUE(root->render_surface());
33 ASSERT_FALSE(render_surface_layer_list->size()); 33 ASSERT_FALSE(render_surface_layer_list->size());
34 34
35 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root); 35 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root);
36 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
36 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 37 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
37 root, root->bounds(), render_surface_layer_list); 38 root, root->bounds(), render_surface_layer_list,
39 root->layer_tree_impl()->current_render_surface_list_id());
38 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 40 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
39 } 41 }
40 42
41 void ClearDamageForAllSurfaces(LayerImpl* layer) { 43 void ClearDamageForAllSurfaces(LayerImpl* layer) {
42 if (layer->render_surface()) 44 if (layer->render_surface())
43 layer->render_surface()->damage_tracker()->DidDrawDamagedArea(); 45 layer->render_surface()->damage_tracker()->DidDrawDamagedArea();
44 46
45 // Recursively clear damage for any existing surface. 47 // Recursively clear damage for any existing surface.
46 for (size_t i = 0; i < layer->children().size(); ++i) 48 for (size_t i = 0; i < layer->children().size(); ++i)
47 ClearDamageForAllSurfaces(layer->children()[i].get()); 49 ClearDamageForAllSurfaces(layer->children()[i].get());
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 gfx::Rect root_damage_rect = 1468 gfx::Rect root_damage_rect =
1467 root->render_surface()->damage_tracker()->current_damage_rect(); 1469 root->render_surface()->damage_tracker()->current_damage_rect();
1468 gfx::Rect damage_we_care_about = gfx::Rect(i, i); 1470 gfx::Rect damage_we_care_about = gfx::Rect(i, i);
1469 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); 1471 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right());
1470 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); 1472 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom());
1471 } 1473 }
1472 } 1474 }
1473 1475
1474 } // namespace 1476 } // namespace
1475 } // namespace cc 1477 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698