| 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/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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 void executeCalculateDrawProperties(LayerImpl* root, std::vector<LayerImpl*>& re
nderSurfaceLayerList) | 25 void executeCalculateDrawProperties(LayerImpl* root, std::vector<LayerImpl*>& re
nderSurfaceLayerList) |
| 26 { | 26 { |
| 27 int dummyMaxTextureSize = 512; | 27 int dummyMaxTextureSize = 512; |
| 28 | 28 |
| 29 // Sanity check: The test itself should create the root layer's render surfa
ce, so | 29 // 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 | 30 // that the surface (and its damage tracker) can persist acros
s multiple |
| 31 // calls to this function. | 31 // calls to this function. |
| 32 ASSERT_TRUE(root->render_surface()); | 32 ASSERT_TRUE(root->render_surface()); |
| 33 ASSERT_FALSE(renderSurfaceLayerList.size()); | 33 ASSERT_FALSE(renderSurfaceLayerList.size()); |
| 34 | 34 |
| 35 LayerTreeHostCommon::CalculateDrawProperties(root, root->bounds(), 1, 1, dum
myMaxTextureSize, false, &renderSurfaceLayerList, false); | 35 LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1, dum
myMaxTextureSize, false, renderSurfaceLayerList, false); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void clearDamageForAllSurfaces(LayerImpl* layer) | 38 void clearDamageForAllSurfaces(LayerImpl* layer) |
| 39 { | 39 { |
| 40 if (layer->render_surface()) | 40 if (layer->render_surface()) |
| 41 layer->render_surface()->damage_tracker()->DidDrawDamagedArea(); | 41 layer->render_surface()->damage_tracker()->DidDrawDamagedArea(); |
| 42 | 42 |
| 43 // Recursively clear damage for any existing surface. | 43 // Recursively clear damage for any existing surface. |
| 44 for (size_t i = 0; i < layer->children().size(); ++i) | 44 for (size_t i = 0; i < layer->children().size(); ++i) |
| 45 clearDamageForAllSurfaces(layer->children()[i]); | 45 clearDamageForAllSurfaces(layer->children()[i]); |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 EXPECT_TRUE(rootDamageRect.IsEmpty()); | 1162 EXPECT_TRUE(rootDamageRect.IsEmpty()); |
| 1163 | 1163 |
| 1164 // Damage should remain empty even after one frame, since there's yet no new
damage | 1164 // Damage should remain empty even after one frame, since there's yet no new
damage |
| 1165 emulateDrawingOneFrame(root.get()); | 1165 emulateDrawingOneFrame(root.get()); |
| 1166 rootDamageRect = root->render_surface()->damage_tracker()->current_damage_re
ct(); | 1166 rootDamageRect = root->render_surface()->damage_tracker()->current_damage_re
ct(); |
| 1167 EXPECT_TRUE(rootDamageRect.IsEmpty()); | 1167 EXPECT_TRUE(rootDamageRect.IsEmpty()); |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 } // namespace | 1170 } // namespace |
| 1171 } // namespace cc | 1171 } // namespace cc |
| OLD | NEW |