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

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

Issue 13285002: cc: Consolidate LayerList types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/damage_tracker.cc ('k') | cc/trees/layer_sorter.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/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/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
11 #include "cc/test/geometry_test_utils.h" 11 #include "cc/test/geometry_test_utils.h"
12 #include "cc/trees/layer_tree_host_common.h" 12 #include "cc/trees/layer_tree_host_common.h"
13 #include "cc/trees/single_thread_proxy.h" 13 #include "cc/trees/single_thread_proxy.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation. h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation. h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h"
17 #include "third_party/skia/include/effects/SkBlurImageFilter.h" 17 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
18 #include "ui/gfx/quad_f.h" 18 #include "ui/gfx/quad_f.h"
19 19
20 using WebKit::WebFilterOperation; 20 using WebKit::WebFilterOperation;
21 using WebKit::WebFilterOperations; 21 using WebKit::WebFilterOperations;
22 22
23 namespace cc { 23 namespace cc {
24 namespace { 24 namespace {
25 25
26 void ExecuteCalculateDrawProperties( 26 void ExecuteCalculateDrawProperties(
27 LayerImpl* root, 27 LayerImpl* root,
28 std::vector<LayerImpl*>& render_surface_layer_list) { 28 LayerImplList& render_surface_layer_list) {
29 int dummy_max_texture_size = 512; 29 int dummy_max_texture_size = 512;
30 30
31 // Sanity check: The test itself should create the root layer's render 31 // Sanity check: The test itself should create the root layer's render
32 // surface, so that the surface (and its damage tracker) can 32 // surface, so that the surface (and its damage tracker) can
33 // persist across multiple calls to this function. 33 // persist across multiple calls to this function.
34 ASSERT_TRUE(root->render_surface()); 34 ASSERT_TRUE(root->render_surface());
35 ASSERT_FALSE(render_surface_layer_list.size()); 35 ASSERT_FALSE(render_surface_layer_list.size());
36 36
37 LayerTreeHostCommon::CalculateDrawProperties(root, 37 LayerTreeHostCommon::CalculateDrawProperties(root,
38 root->bounds(), 38 root->bounds(),
(...skipping 14 matching lines...) Expand all
53 ClearDamageForAllSurfaces(layer->children()[i]); 53 ClearDamageForAllSurfaces(layer->children()[i]);
54 } 54 }
55 55
56 void EmulateDrawingOneFrame(LayerImpl* root) { 56 void EmulateDrawingOneFrame(LayerImpl* root) {
57 // This emulates only steps that are relevant to testing the damage tracker: 57 // This emulates only steps that are relevant to testing the damage tracker:
58 // 1. computing the render passes and layerlists 58 // 1. computing the render passes and layerlists
59 // 2. updating all damage trackers in the correct order 59 // 2. updating all damage trackers in the correct order
60 // 3. resetting all update_rects and property_changed flags for all layers 60 // 3. resetting all update_rects and property_changed flags for all layers
61 // and surfaces. 61 // and surfaces.
62 62
63 std::vector<LayerImpl*> render_surface_layer_list; 63 LayerImplList render_surface_layer_list;
64 ExecuteCalculateDrawProperties(root, render_surface_layer_list); 64 ExecuteCalculateDrawProperties(root, render_surface_layer_list);
65 65
66 // Iterate back-to-front, so that damage correctly propagates from descendant 66 // Iterate back-to-front, so that damage correctly propagates from descendant
67 // surfaces to ancestors. 67 // surfaces to ancestors.
68 for (int i = render_surface_layer_list.size() - 1; i >= 0; --i) { 68 for (int i = render_surface_layer_list.size() - 1; i >= 0; --i) {
69 RenderSurfaceImpl* target_surface = 69 RenderSurfaceImpl* target_surface =
70 render_surface_layer_list[i]->render_surface(); 70 render_surface_layer_list[i]->render_surface();
71 target_surface->damage_tracker()->UpdateDamageTrackingState( 71 target_surface->damage_tracker()->UpdateDamageTrackingState(
72 target_surface->layer_list(), 72 target_surface->layer_list(),
73 target_surface->OwningLayerId(), 73 target_surface->OwningLayerId(),
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 // Damage should remain empty even after one frame, since there's yet no new 1345 // Damage should remain empty even after one frame, since there's yet no new
1346 // damage. 1346 // damage.
1347 EmulateDrawingOneFrame(root.get()); 1347 EmulateDrawingOneFrame(root.get());
1348 root_damage_rect = 1348 root_damage_rect =
1349 root->render_surface()->damage_tracker()->current_damage_rect(); 1349 root->render_surface()->damage_tracker()->current_damage_rect();
1350 EXPECT_TRUE(root_damage_rect.IsEmpty()); 1350 EXPECT_TRUE(root_damage_rect.IsEmpty());
1351 } 1351 }
1352 1352
1353 } // namespace 1353 } // namespace
1354 } // namespace cc 1354 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/damage_tracker.cc ('k') | cc/trees/layer_sorter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698