OLD | NEW |
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/damage_tracker.h" | 5 #include "cc/damage_tracker.h" |
6 | 6 |
7 #include "cc/layer_impl.h" | 7 #include "cc/layer_impl.h" |
8 #include "cc/layer_sorter.h" | |
9 #include "cc/layer_tree_host_common.h" | 8 #include "cc/layer_tree_host_common.h" |
10 #include "cc/math_util.h" | 9 #include "cc/math_util.h" |
11 #include "cc/single_thread_proxy.h" | 10 #include "cc/single_thread_proxy.h" |
12 #include "cc/test/geometry_test_utils.h" | 11 #include "cc/test/geometry_test_utils.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 13 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 14 #include "ui/gfx/quad_f.h" |
15 #include <public/WebFilterOperation.h> | 15 #include <public/WebFilterOperation.h> |
16 #include <public/WebFilterOperations.h> | 16 #include <public/WebFilterOperations.h> |
17 | 17 |
18 using namespace WebKit; | 18 using namespace WebKit; |
19 using namespace WebKitTests; | 19 using namespace WebKitTests; |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 namespace { | 22 namespace { |
23 | 23 |
24 void executeCalculateDrawProperties(LayerImpl* root, std::vector<LayerImpl*>& re
nderSurfaceLayerList) | 24 void executeCalculateDrawProperties(LayerImpl* root, std::vector<LayerImpl*>& re
nderSurfaceLayerList) |
25 { | 25 { |
26 LayerSorter layerSorter; | |
27 int dummyMaxTextureSize = 512; | 26 int dummyMaxTextureSize = 512; |
28 | 27 |
29 // Sanity check: The test itself should create the root layer's render surfa
ce, so | 28 // Sanity check: The test itself should create the root layer's render surfa
ce, so |
30 // that the surface (and its damage tracker) can persist acros
s multiple | 29 // that the surface (and its damage tracker) can persist acros
s multiple |
31 // calls to this function. | 30 // calls to this function. |
32 ASSERT_TRUE(root->renderSurface()); | 31 ASSERT_TRUE(root->renderSurface()); |
33 ASSERT_FALSE(renderSurfaceLayerList.size()); | 32 ASSERT_FALSE(renderSurfaceLayerList.size()); |
34 | 33 |
35 LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1, &la
yerSorter, dummyMaxTextureSize, renderSurfaceLayerList); | 34 LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1, dum
myMaxTextureSize, renderSurfaceLayerList); |
36 } | 35 } |
37 | 36 |
38 void clearDamageForAllSurfaces(LayerImpl* layer) | 37 void clearDamageForAllSurfaces(LayerImpl* layer) |
39 { | 38 { |
40 if (layer->renderSurface()) | 39 if (layer->renderSurface()) |
41 layer->renderSurface()->damageTracker()->didDrawDamagedArea(); | 40 layer->renderSurface()->damageTracker()->didDrawDamagedArea(); |
42 | 41 |
43 // Recursively clear damage for any existing surface. | 42 // Recursively clear damage for any existing surface. |
44 for (size_t i = 0; i < layer->children().size(); ++i) | 43 for (size_t i = 0; i < layer->children().size(); ++i) |
45 clearDamageForAllSurfaces(layer->children()[i]); | 44 clearDamageForAllSurfaces(layer->children()[i]); |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 EXPECT_TRUE(rootDamageRect.IsEmpty()); | 1151 EXPECT_TRUE(rootDamageRect.IsEmpty()); |
1153 | 1152 |
1154 // Damage should remain empty even after one frame, since there's yet no new
damage | 1153 // Damage should remain empty even after one frame, since there's yet no new
damage |
1155 emulateDrawingOneFrame(root.get()); | 1154 emulateDrawingOneFrame(root.get()); |
1156 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect()
; | 1155 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect()
; |
1157 EXPECT_TRUE(rootDamageRect.IsEmpty()); | 1156 EXPECT_TRUE(rootDamageRect.IsEmpty()); |
1158 } | 1157 } |
1159 | 1158 |
1160 } // namespace | 1159 } // namespace |
1161 } // namespace cc | 1160 } // namespace cc |
OLD | NEW |