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/layers/tiled_layer.h" | 5 #include "cc/layers/tiled_layer.h" |
6 | 6 |
| 7 #include <limits> |
| 8 #include <vector> |
| 9 |
7 #include "cc/debug/overdraw_metrics.h" | 10 #include "cc/debug/overdraw_metrics.h" |
8 #include "cc/resources/bitmap_content_layer_updater.h" | 11 #include "cc/resources/bitmap_content_layer_updater.h" |
9 #include "cc/resources/layer_painter.h" | 12 #include "cc/resources/layer_painter.h" |
10 #include "cc/resources/prioritized_resource_manager.h" | 13 #include "cc/resources/prioritized_resource_manager.h" |
11 #include "cc/resources/resource_update_controller.h" | 14 #include "cc/resources/resource_update_controller.h" |
12 #include "cc/test/animation_test_common.h" | 15 #include "cc/test/animation_test_common.h" |
13 #include "cc/test/fake_layer_tree_host_client.h" | 16 #include "cc/test/fake_layer_tree_host_client.h" |
14 #include "cc/test/fake_layer_tree_host_impl.h" | 17 #include "cc/test/fake_layer_tree_host_impl.h" |
15 #include "cc/test/fake_output_surface.h" | 18 #include "cc/test/fake_output_surface.h" |
16 #include "cc/test/fake_proxy.h" | 19 #include "cc/test/fake_proxy.h" |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 layer->SetTexturePriorities(priority_calculator_); | 1182 layer->SetTexturePriorities(priority_calculator_); |
1180 resource_manager_->PrioritizeTextures(); | 1183 resource_manager_->PrioritizeTextures(); |
1181 layer->Update(queue_.get(), &occluded, NULL); | 1184 layer->Update(queue_.get(), &occluded, NULL); |
1182 EXPECT_EQ(24 - 6, layer->fake_layer_updater()->update_count()); | 1185 EXPECT_EQ(24 - 6, layer->fake_layer_updater()->update_count()); |
1183 | 1186 |
1184 EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); | 1187 EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); |
1185 EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), | 1188 EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), |
1186 210000 + 180000 + 180000, | 1189 210000 + 180000 + 180000, |
1187 1); | 1190 1); |
1188 EXPECT_EQ(3 + 6 + 6, occluded.overdraw_metrics()->tiles_culled_for_upload()); | 1191 EXPECT_EQ(3 + 6 + 6, occluded.overdraw_metrics()->tiles_culled_for_upload()); |
1189 | |
1190 } | 1192 } |
1191 | 1193 |
1192 TEST_F(TiledLayerTest, TilesNotPaintedWithoutInvalidation) { | 1194 TEST_F(TiledLayerTest, TilesNotPaintedWithoutInvalidation) { |
1193 scoped_refptr<FakeTiledLayer> layer = | 1195 scoped_refptr<FakeTiledLayer> layer = |
1194 make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); | 1196 make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); |
1195 TestOcclusionTracker occluded; | 1197 TestOcclusionTracker occluded; |
1196 occlusion_ = &occluded; | 1198 occlusion_ = &occluded; |
1197 | 1199 |
1198 // The tile size is 100x100. | 1200 // The tile size is 100x100. |
1199 | 1201 |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 // Invalidate the entire layer in layer space. When painting, the rect given | 1795 // Invalidate the entire layer in layer space. When painting, the rect given |
1794 // to webkit should match the layer's bounds. | 1796 // to webkit should match the layer's bounds. |
1795 layer->SetNeedsDisplayRect(layer_rect); | 1797 layer->SetNeedsDisplayRect(layer_rect); |
1796 layer->Update(queue_.get(), 0, NULL); | 1798 layer->Update(queue_.get(), 0, NULL); |
1797 | 1799 |
1798 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); | 1800 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); |
1799 } | 1801 } |
1800 | 1802 |
1801 } // namespace | 1803 } // namespace |
1802 } // namespace cc | 1804 } // namespace cc |
OLD | NEW |