| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/tiles/picture_layer_tiling.h" |
| 6 |
| 5 #include <stddef.h> | 7 #include <stddef.h> |
| 6 | 8 |
| 7 #include <limits> | 9 #include <limits> |
| 8 #include <set> | 10 #include <set> |
| 9 | 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" |
| 11 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
| 12 #include "cc/test/fake_output_surface.h" | 15 #include "cc/test/fake_output_surface.h" |
| 13 #include "cc/test/fake_output_surface_client.h" | 16 #include "cc/test/fake_output_surface_client.h" |
| 14 #include "cc/test/fake_picture_layer_tiling_client.h" | 17 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 15 #include "cc/test/fake_raster_source.h" | 18 #include "cc/test/fake_raster_source.h" |
| 16 #include "cc/test/test_context_provider.h" | 19 #include "cc/test/test_context_provider.h" |
| 17 #include "cc/test/test_shared_bitmap_manager.h" | 20 #include "cc/test/test_shared_bitmap_manager.h" |
| 18 #include "cc/tiles/picture_layer_tiling.h" | |
| 19 #include "cc/tiles/picture_layer_tiling_set.h" | 21 #include "cc/tiles/picture_layer_tiling_set.h" |
| 20 #include "cc/trees/layer_tree_settings.h" | 22 #include "cc/trees/layer_tree_settings.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "ui/gfx/geometry/quad_f.h" | 24 #include "ui/gfx/geometry/quad_f.h" |
| 23 #include "ui/gfx/geometry/rect_conversions.h" | 25 #include "ui/gfx/geometry/rect_conversions.h" |
| 24 #include "ui/gfx/geometry/size_conversions.h" | 26 #include "ui/gfx/geometry/size_conversions.h" |
| 25 | 27 |
| 26 namespace cc { | 28 namespace cc { |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 static gfx::Rect ViewportInLayerSpace( | 31 static gfx::Rect ViewportInLayerSpace( |
| 30 const gfx::Transform& transform, | 32 const gfx::Transform& transform, |
| 31 const gfx::Size& device_viewport) { | 33 const gfx::Size& device_viewport) { |
| 32 | 34 |
| 33 gfx::Transform inverse; | 35 gfx::Transform inverse; |
| 34 if (!transform.GetInverse(&inverse)) | 36 if (!transform.GetInverse(&inverse)) |
| 35 return gfx::Rect(); | 37 return gfx::Rect(); |
| 36 | 38 |
| 37 return MathUtil::ProjectEnclosingClippedRect(inverse, | 39 return MathUtil::ProjectEnclosingClippedRect(inverse, |
| 38 gfx::Rect(device_viewport)); | 40 gfx::Rect(device_viewport)); |
| 39 } | 41 } |
| 40 | 42 |
| 41 class TestablePictureLayerTiling : public PictureLayerTiling { | 43 class TestablePictureLayerTiling : public PictureLayerTiling { |
| 42 public: | 44 public: |
| 43 using PictureLayerTiling::SetLiveTilesRect; | 45 using PictureLayerTiling::SetLiveTilesRect; |
| 44 using PictureLayerTiling::TileAt; | 46 using PictureLayerTiling::TileAt; |
| 45 | 47 |
| 46 static scoped_ptr<TestablePictureLayerTiling> Create( | 48 static std::unique_ptr<TestablePictureLayerTiling> Create( |
| 47 WhichTree tree, | 49 WhichTree tree, |
| 48 float contents_scale, | 50 float contents_scale, |
| 49 scoped_refptr<RasterSource> raster_source, | 51 scoped_refptr<RasterSource> raster_source, |
| 50 PictureLayerTilingClient* client, | 52 PictureLayerTilingClient* client, |
| 51 const LayerTreeSettings& settings) { | 53 const LayerTreeSettings& settings) { |
| 52 return make_scoped_ptr(new TestablePictureLayerTiling( | 54 return base::WrapUnique(new TestablePictureLayerTiling( |
| 53 tree, contents_scale, raster_source, client, | 55 tree, contents_scale, raster_source, client, |
| 54 settings.tiling_interest_area_padding, | 56 settings.tiling_interest_area_padding, |
| 55 settings.skewport_target_time_in_seconds, | 57 settings.skewport_target_time_in_seconds, |
| 56 settings.skewport_extrapolation_limit_in_content_pixels)); | 58 settings.skewport_extrapolation_limit_in_content_pixels)); |
| 57 } | 59 } |
| 58 | 60 |
| 59 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } | 61 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } |
| 60 | 62 |
| 61 using PictureLayerTiling::ComputeSkewport; | 63 using PictureLayerTiling::ComputeSkewport; |
| 62 using PictureLayerTiling::RemoveTileAt; | 64 using PictureLayerTiling::RemoveTileAt; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 const gfx::Rect& dest_rect) { | 192 const gfx::Rect& dest_rect) { |
| 191 float dest_to_contents_scale = tiling_->contents_scale() / rect_scale; | 193 float dest_to_contents_scale = tiling_->contents_scale() / rect_scale; |
| 192 gfx::Rect clamped_rect = gfx::ScaleToEnclosingRect( | 194 gfx::Rect clamped_rect = gfx::ScaleToEnclosingRect( |
| 193 gfx::Rect(tiling_->tiling_size()), 1.f / dest_to_contents_scale); | 195 gfx::Rect(tiling_->tiling_size()), 1.f / dest_to_contents_scale); |
| 194 clamped_rect.Intersect(dest_rect); | 196 clamped_rect.Intersect(dest_rect); |
| 195 VerifyTilesExactlyCoverRect(rect_scale, dest_rect, clamped_rect); | 197 VerifyTilesExactlyCoverRect(rect_scale, dest_rect, clamped_rect); |
| 196 } | 198 } |
| 197 | 199 |
| 198 protected: | 200 protected: |
| 199 FakePictureLayerTilingClient client_; | 201 FakePictureLayerTilingClient client_; |
| 200 scoped_ptr<TestablePictureLayerTiling> tiling_; | 202 std::unique_ptr<TestablePictureLayerTiling> tiling_; |
| 201 | 203 |
| 202 private: | 204 private: |
| 203 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest); | 205 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest); |
| 204 }; | 206 }; |
| 205 | 207 |
| 206 TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) { | 208 TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) { |
| 207 // Verifies that a resize with invalidation for newly exposed pixels will | 209 // Verifies that a resize with invalidation for newly exposed pixels will |
| 208 // deletes tiles that intersect that invalidation. | 210 // deletes tiles that intersect that invalidation. |
| 209 gfx::Size tile_size(100, 100); | 211 gfx::Size tile_size(100, 100); |
| 210 gfx::Size original_layer_size(10, 10); | 212 gfx::Size original_layer_size(10, 10); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 578 |
| 577 gfx::Rect viewport(0, 0, 100, 100); | 579 gfx::Rect viewport(0, 0, 100, 100); |
| 578 gfx::Size layer_bounds(200, 200); | 580 gfx::Size layer_bounds(200, 200); |
| 579 | 581 |
| 580 client.SetTileSize(gfx::Size(100, 100)); | 582 client.SetTileSize(gfx::Size(100, 100)); |
| 581 LayerTreeSettings settings; | 583 LayerTreeSettings settings; |
| 582 settings.skewport_extrapolation_limit_in_content_pixels = 75; | 584 settings.skewport_extrapolation_limit_in_content_pixels = 75; |
| 583 | 585 |
| 584 scoped_refptr<FakeRasterSource> raster_source = | 586 scoped_refptr<FakeRasterSource> raster_source = |
| 585 FakeRasterSource::CreateFilled(layer_bounds); | 587 FakeRasterSource::CreateFilled(layer_bounds); |
| 586 scoped_ptr<TestablePictureLayerTiling> tiling = | 588 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 587 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 589 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 588 &client, settings); | 590 &client, settings); |
| 589 | 591 |
| 590 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); | 592 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); |
| 591 | 593 |
| 592 // Move viewport down 50 pixels in 0.5 seconds. | 594 // Move viewport down 50 pixels in 0.5 seconds. |
| 593 gfx::Rect down_skewport = | 595 gfx::Rect down_skewport = |
| 594 tiling->ComputeSkewport(1.5, gfx::Rect(0, 50, 100, 100)); | 596 tiling->ComputeSkewport(1.5, gfx::Rect(0, 50, 100, 100)); |
| 595 | 597 |
| 596 EXPECT_EQ(0, down_skewport.x()); | 598 EXPECT_EQ(0, down_skewport.x()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 } | 662 } |
| 661 | 663 |
| 662 TEST(PictureLayerTilingTest, ComputeSkewportExtremeCases) { | 664 TEST(PictureLayerTilingTest, ComputeSkewportExtremeCases) { |
| 663 FakePictureLayerTilingClient client; | 665 FakePictureLayerTilingClient client; |
| 664 | 666 |
| 665 gfx::Size layer_bounds(200, 200); | 667 gfx::Size layer_bounds(200, 200); |
| 666 client.SetTileSize(gfx::Size(100, 100)); | 668 client.SetTileSize(gfx::Size(100, 100)); |
| 667 LayerTreeSettings settings; | 669 LayerTreeSettings settings; |
| 668 scoped_refptr<FakeRasterSource> raster_source = | 670 scoped_refptr<FakeRasterSource> raster_source = |
| 669 FakeRasterSource::CreateFilled(layer_bounds); | 671 FakeRasterSource::CreateFilled(layer_bounds); |
| 670 scoped_ptr<TestablePictureLayerTiling> tiling = | 672 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 671 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 673 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 672 &client, settings); | 674 &client, settings); |
| 673 | 675 |
| 674 gfx::Rect viewport1(-1918, 255860, 4010, 2356); | 676 gfx::Rect viewport1(-1918, 255860, 4010, 2356); |
| 675 gfx::Rect viewport2(-7088, -91738, 14212, 8350); | 677 gfx::Rect viewport2(-7088, -91738, 14212, 8350); |
| 676 gfx::Rect viewport3(-12730024, -158883296, 24607540, 14454512); | 678 gfx::Rect viewport3(-12730024, -158883296, 24607540, 14454512); |
| 677 double time = 1.0; | 679 double time = 1.0; |
| 678 tiling->ComputeTilePriorityRects(viewport1, 1.f, time, Occlusion()); | 680 tiling->ComputeTilePriorityRects(viewport1, 1.f, time, Occlusion()); |
| 679 time += 0.016; | 681 time += 0.016; |
| 680 EXPECT_TRUE(tiling->ComputeSkewport(time, viewport2).Contains(viewport2)); | 682 EXPECT_TRUE(tiling->ComputeSkewport(time, viewport2).Contains(viewport2)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 693 TEST(PictureLayerTilingTest, ComputeSkewport) { | 695 TEST(PictureLayerTilingTest, ComputeSkewport) { |
| 694 FakePictureLayerTilingClient client; | 696 FakePictureLayerTilingClient client; |
| 695 | 697 |
| 696 gfx::Rect viewport(0, 0, 100, 100); | 698 gfx::Rect viewport(0, 0, 100, 100); |
| 697 gfx::Size layer_bounds(200, 200); | 699 gfx::Size layer_bounds(200, 200); |
| 698 | 700 |
| 699 client.SetTileSize(gfx::Size(100, 100)); | 701 client.SetTileSize(gfx::Size(100, 100)); |
| 700 | 702 |
| 701 scoped_refptr<FakeRasterSource> raster_source = | 703 scoped_refptr<FakeRasterSource> raster_source = |
| 702 FakeRasterSource::CreateFilled(layer_bounds); | 704 FakeRasterSource::CreateFilled(layer_bounds); |
| 703 scoped_ptr<TestablePictureLayerTiling> tiling = | 705 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 704 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 706 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 705 &client, LayerTreeSettings()); | 707 &client, LayerTreeSettings()); |
| 706 | 708 |
| 707 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); | 709 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); |
| 708 | 710 |
| 709 // Move viewport down 50 pixels in 0.5 seconds. | 711 // Move viewport down 50 pixels in 0.5 seconds. |
| 710 gfx::Rect down_skewport = | 712 gfx::Rect down_skewport = |
| 711 tiling->ComputeSkewport(1.5, gfx::Rect(0, 50, 100, 100)); | 713 tiling->ComputeSkewport(1.5, gfx::Rect(0, 50, 100, 100)); |
| 712 | 714 |
| 713 EXPECT_EQ(0, down_skewport.x()); | 715 EXPECT_EQ(0, down_skewport.x()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 TEST(PictureLayerTilingTest, SkewportThroughUpdateTilePriorities) { | 757 TEST(PictureLayerTilingTest, SkewportThroughUpdateTilePriorities) { |
| 756 FakePictureLayerTilingClient client; | 758 FakePictureLayerTilingClient client; |
| 757 | 759 |
| 758 gfx::Rect viewport(0, 0, 100, 100); | 760 gfx::Rect viewport(0, 0, 100, 100); |
| 759 gfx::Size layer_bounds(200, 200); | 761 gfx::Size layer_bounds(200, 200); |
| 760 | 762 |
| 761 client.SetTileSize(gfx::Size(100, 100)); | 763 client.SetTileSize(gfx::Size(100, 100)); |
| 762 | 764 |
| 763 scoped_refptr<FakeRasterSource> raster_source = | 765 scoped_refptr<FakeRasterSource> raster_source = |
| 764 FakeRasterSource::CreateFilled(layer_bounds); | 766 FakeRasterSource::CreateFilled(layer_bounds); |
| 765 scoped_ptr<TestablePictureLayerTiling> tiling = | 767 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 766 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 768 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 767 &client, LayerTreeSettings()); | 769 &client, LayerTreeSettings()); |
| 768 | 770 |
| 769 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); | 771 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); |
| 770 | 772 |
| 771 // Move viewport down 50 pixels in 0.5 seconds. | 773 // Move viewport down 50 pixels in 0.5 seconds. |
| 772 gfx::Rect viewport_50 = gfx::Rect(0, 50, 100, 100); | 774 gfx::Rect viewport_50 = gfx::Rect(0, 50, 100, 100); |
| 773 gfx::Rect skewport_50 = tiling->ComputeSkewport(1.5, viewport_50); | 775 gfx::Rect skewport_50 = tiling->ComputeSkewport(1.5, viewport_50); |
| 774 | 776 |
| 775 EXPECT_EQ(gfx::Rect(0, 50, 100, 200), skewport_50); | 777 EXPECT_EQ(gfx::Rect(0, 50, 100, 200), skewport_50); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 client.SetTileSize(gfx::Size(10, 10)); | 831 client.SetTileSize(gfx::Size(10, 10)); |
| 830 LayerTreeSettings settings; | 832 LayerTreeSettings settings; |
| 831 | 833 |
| 832 // Tiling at 0.25 scale: this should create 47x47 tiles of size 10x10. | 834 // Tiling at 0.25 scale: this should create 47x47 tiles of size 10x10. |
| 833 // The reason is that each tile has a one pixel border, so tile at (1, 2) | 835 // The reason is that each tile has a one pixel border, so tile at (1, 2) |
| 834 // for instance begins at (8, 16) pixels. So tile at (46, 46) will begin at | 836 // for instance begins at (8, 16) pixels. So tile at (46, 46) will begin at |
| 835 // (368, 368) and extend to the end of 1500 * 0.25 = 375 edge of the | 837 // (368, 368) and extend to the end of 1500 * 0.25 = 375 edge of the |
| 836 // tiling. | 838 // tiling. |
| 837 scoped_refptr<FakeRasterSource> raster_source = | 839 scoped_refptr<FakeRasterSource> raster_source = |
| 838 FakeRasterSource::CreateFilled(layer_bounds); | 840 FakeRasterSource::CreateFilled(layer_bounds); |
| 839 scoped_ptr<TestablePictureLayerTiling> tiling = | 841 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 840 TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.25f, raster_source, | 842 TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.25f, raster_source, |
| 841 &client, settings); | 843 &client, settings); |
| 842 tiling->set_resolution(HIGH_RESOLUTION); | 844 tiling->set_resolution(HIGH_RESOLUTION); |
| 843 gfx::Rect viewport_in_content_space = | 845 gfx::Rect viewport_in_content_space = |
| 844 gfx::ScaleToEnclosedRect(viewport, 0.25f); | 846 gfx::ScaleToEnclosedRect(viewport, 0.25f); |
| 845 | 847 |
| 846 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); | 848 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); |
| 847 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 849 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 848 | 850 |
| 849 // Compute the soon border. | 851 // Compute the soon border. |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 gfx::Transform current_screen_transform; | 1141 gfx::Transform current_screen_transform; |
| 1140 double current_frame_time_in_seconds = 1.0; | 1142 double current_frame_time_in_seconds = 1.0; |
| 1141 | 1143 |
| 1142 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 1144 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1143 current_screen_transform, device_viewport); | 1145 current_screen_transform, device_viewport); |
| 1144 | 1146 |
| 1145 client.SetTileSize(gfx::Size(100, 100)); | 1147 client.SetTileSize(gfx::Size(100, 100)); |
| 1146 | 1148 |
| 1147 scoped_refptr<FakeRasterSource> raster_source = | 1149 scoped_refptr<FakeRasterSource> raster_source = |
| 1148 FakeRasterSource::CreateFilled(current_layer_bounds); | 1150 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1149 scoped_ptr<TestablePictureLayerTiling> tiling = | 1151 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1150 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1152 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1151 &client, LayerTreeSettings()); | 1153 &client, LayerTreeSettings()); |
| 1152 tiling->set_resolution(HIGH_RESOLUTION); | 1154 tiling->set_resolution(HIGH_RESOLUTION); |
| 1153 | 1155 |
| 1154 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 1156 tiling->ComputeTilePriorityRects(viewport_in_layer_space, |
| 1155 current_layer_contents_scale, | 1157 current_layer_contents_scale, |
| 1156 current_frame_time_in_seconds, Occlusion()); | 1158 current_frame_time_in_seconds, Occlusion()); |
| 1157 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 1159 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1158 | 1160 |
| 1159 ASSERT_TRUE(tiling->TileAt(0, 0)); | 1161 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 current_screen_transform.Translate(850, 0); | 1196 current_screen_transform.Translate(850, 0); |
| 1195 last_screen_transform = current_screen_transform; | 1197 last_screen_transform = current_screen_transform; |
| 1196 | 1198 |
| 1197 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 1199 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1198 current_screen_transform, device_viewport); | 1200 current_screen_transform, device_viewport); |
| 1199 | 1201 |
| 1200 client.SetTileSize(gfx::Size(100, 100)); | 1202 client.SetTileSize(gfx::Size(100, 100)); |
| 1201 | 1203 |
| 1202 scoped_refptr<FakeRasterSource> raster_source = | 1204 scoped_refptr<FakeRasterSource> raster_source = |
| 1203 FakeRasterSource::CreateFilled(current_layer_bounds); | 1205 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1204 scoped_ptr<TestablePictureLayerTiling> tiling = | 1206 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1205 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1207 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1206 &client, LayerTreeSettings()); | 1208 &client, LayerTreeSettings()); |
| 1207 tiling->set_resolution(HIGH_RESOLUTION); | 1209 tiling->set_resolution(HIGH_RESOLUTION); |
| 1208 | 1210 |
| 1209 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 1211 tiling->ComputeTilePriorityRects(viewport_in_layer_space, |
| 1210 current_layer_contents_scale, | 1212 current_layer_contents_scale, |
| 1211 current_frame_time_in_seconds, Occlusion()); | 1213 current_frame_time_in_seconds, Occlusion()); |
| 1212 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 1214 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1213 | 1215 |
| 1214 ASSERT_TRUE(tiling->TileAt(0, 0)); | 1216 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 current_screen_transform.Translate(705, 505); | 1261 current_screen_transform.Translate(705, 505); |
| 1260 last_screen_transform = current_screen_transform; | 1262 last_screen_transform = current_screen_transform; |
| 1261 | 1263 |
| 1262 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 1264 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1263 current_screen_transform, device_viewport); | 1265 current_screen_transform, device_viewport); |
| 1264 | 1266 |
| 1265 client.SetTileSize(gfx::Size(100, 100)); | 1267 client.SetTileSize(gfx::Size(100, 100)); |
| 1266 | 1268 |
| 1267 scoped_refptr<FakeRasterSource> raster_source = | 1269 scoped_refptr<FakeRasterSource> raster_source = |
| 1268 FakeRasterSource::CreateFilled(current_layer_bounds); | 1270 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1269 scoped_ptr<TestablePictureLayerTiling> tiling = | 1271 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1270 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1272 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1271 &client, LayerTreeSettings()); | 1273 &client, LayerTreeSettings()); |
| 1272 tiling->set_resolution(HIGH_RESOLUTION); | 1274 tiling->set_resolution(HIGH_RESOLUTION); |
| 1273 | 1275 |
| 1274 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 1276 tiling->ComputeTilePriorityRects(viewport_in_layer_space, |
| 1275 current_layer_contents_scale, | 1277 current_layer_contents_scale, |
| 1276 current_frame_time_in_seconds, Occlusion()); | 1278 current_frame_time_in_seconds, Occlusion()); |
| 1277 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 1279 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1278 | 1280 |
| 1279 ASSERT_TRUE(tiling->TileAt(0, 0)); | 1281 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 current_screen_transform.RotateAboutZAxis(45); | 1320 current_screen_transform.RotateAboutZAxis(45); |
| 1319 last_screen_transform = current_screen_transform; | 1321 last_screen_transform = current_screen_transform; |
| 1320 | 1322 |
| 1321 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 1323 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1322 current_screen_transform, device_viewport); | 1324 current_screen_transform, device_viewport); |
| 1323 | 1325 |
| 1324 client.SetTileSize(gfx::Size(100, 100)); | 1326 client.SetTileSize(gfx::Size(100, 100)); |
| 1325 | 1327 |
| 1326 scoped_refptr<FakeRasterSource> raster_source = | 1328 scoped_refptr<FakeRasterSource> raster_source = |
| 1327 FakeRasterSource::CreateFilled(current_layer_bounds); | 1329 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1328 scoped_ptr<TestablePictureLayerTiling> tiling = | 1330 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1329 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1331 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1330 &client, LayerTreeSettings()); | 1332 &client, LayerTreeSettings()); |
| 1331 tiling->set_resolution(HIGH_RESOLUTION); | 1333 tiling->set_resolution(HIGH_RESOLUTION); |
| 1332 | 1334 |
| 1333 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 1335 tiling->ComputeTilePriorityRects(viewport_in_layer_space, |
| 1334 current_layer_contents_scale, | 1336 current_layer_contents_scale, |
| 1335 current_frame_time_in_seconds, Occlusion()); | 1337 current_frame_time_in_seconds, Occlusion()); |
| 1336 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 1338 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1337 | 1339 |
| 1338 ASSERT_TRUE(tiling->TileAt(0, 0)); | 1340 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 &clipped); | 1404 &clipped); |
| 1403 ASSERT_FALSE(clipped); | 1405 ASSERT_FALSE(clipped); |
| 1404 | 1406 |
| 1405 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 1407 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1406 current_screen_transform, device_viewport); | 1408 current_screen_transform, device_viewport); |
| 1407 | 1409 |
| 1408 client.SetTileSize(gfx::Size(100, 100)); | 1410 client.SetTileSize(gfx::Size(100, 100)); |
| 1409 | 1411 |
| 1410 scoped_refptr<FakeRasterSource> raster_source = | 1412 scoped_refptr<FakeRasterSource> raster_source = |
| 1411 FakeRasterSource::CreateFilled(current_layer_bounds); | 1413 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1412 scoped_ptr<TestablePictureLayerTiling> tiling = | 1414 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1413 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1415 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1414 &client, LayerTreeSettings()); | 1416 &client, LayerTreeSettings()); |
| 1415 tiling->set_resolution(HIGH_RESOLUTION); | 1417 tiling->set_resolution(HIGH_RESOLUTION); |
| 1416 | 1418 |
| 1417 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 1419 tiling->ComputeTilePriorityRects(viewport_in_layer_space, |
| 1418 current_layer_contents_scale, | 1420 current_layer_contents_scale, |
| 1419 current_frame_time_in_seconds, Occlusion()); | 1421 current_frame_time_in_seconds, Occlusion()); |
| 1420 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 1422 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1421 | 1423 |
| 1422 ASSERT_TRUE(tiling->TileAt(0, 0)); | 1424 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 &clipped); | 1498 &clipped); |
| 1497 ASSERT_FALSE(clipped); | 1499 ASSERT_FALSE(clipped); |
| 1498 | 1500 |
| 1499 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 1501 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1500 current_screen_transform, device_viewport); | 1502 current_screen_transform, device_viewport); |
| 1501 | 1503 |
| 1502 client.SetTileSize(gfx::Size(100, 100)); | 1504 client.SetTileSize(gfx::Size(100, 100)); |
| 1503 | 1505 |
| 1504 scoped_refptr<FakeRasterSource> raster_source = | 1506 scoped_refptr<FakeRasterSource> raster_source = |
| 1505 FakeRasterSource::CreateFilled(current_layer_bounds); | 1507 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1506 scoped_ptr<TestablePictureLayerTiling> tiling = | 1508 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1507 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1509 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1508 &client, LayerTreeSettings()); | 1510 &client, LayerTreeSettings()); |
| 1509 tiling->set_resolution(HIGH_RESOLUTION); | 1511 tiling->set_resolution(HIGH_RESOLUTION); |
| 1510 | 1512 |
| 1511 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 1513 tiling->ComputeTilePriorityRects(viewport_in_layer_space, |
| 1512 current_layer_contents_scale, | 1514 current_layer_contents_scale, |
| 1513 current_frame_time_in_seconds, Occlusion()); | 1515 current_frame_time_in_seconds, Occlusion()); |
| 1514 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 1516 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1515 | 1517 |
| 1516 ASSERT_TRUE(tiling->TileAt(0, 0)); | 1518 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 last_screen_transform.Translate(2800, 0); | 1562 last_screen_transform.Translate(2800, 0); |
| 1561 | 1563 |
| 1562 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 1564 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1563 current_screen_transform, device_viewport); | 1565 current_screen_transform, device_viewport); |
| 1564 | 1566 |
| 1565 client.SetTileSize(gfx::Size(100, 100)); | 1567 client.SetTileSize(gfx::Size(100, 100)); |
| 1566 LayerTreeSettings settings; | 1568 LayerTreeSettings settings; |
| 1567 | 1569 |
| 1568 scoped_refptr<FakeRasterSource> raster_source = | 1570 scoped_refptr<FakeRasterSource> raster_source = |
| 1569 FakeRasterSource::CreateFilled(current_layer_bounds); | 1571 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1570 scoped_ptr<TestablePictureLayerTiling> tiling = | 1572 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1571 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1573 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1572 &client, settings); | 1574 &client, settings); |
| 1573 tiling->set_resolution(HIGH_RESOLUTION); | 1575 tiling->set_resolution(HIGH_RESOLUTION); |
| 1574 | 1576 |
| 1575 // previous ("last") frame | 1577 // previous ("last") frame |
| 1576 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 1578 tiling->ComputeTilePriorityRects(viewport_in_layer_space, |
| 1577 last_layer_contents_scale, | 1579 last_layer_contents_scale, |
| 1578 last_frame_time_in_seconds, Occlusion()); | 1580 last_frame_time_in_seconds, Occlusion()); |
| 1579 | 1581 |
| 1580 // current frame | 1582 // current frame |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1606 EXPECT_GT(priority.distance_to_visible, 0.f); | 1608 EXPECT_GT(priority.distance_to_visible, 0.f); |
| 1607 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | 1609 EXPECT_NE(TilePriority::NOW, priority.priority_bin); |
| 1608 } | 1610 } |
| 1609 | 1611 |
| 1610 TEST(ComputeTilePriorityRectsTest, RotationMotion) { | 1612 TEST(ComputeTilePriorityRectsTest, RotationMotion) { |
| 1611 // Each tile of a layer may be affected differently by a transform; Check | 1613 // Each tile of a layer may be affected differently by a transform; Check |
| 1612 // that ComputeTilePriorityRects correctly accounts for the transform between | 1614 // that ComputeTilePriorityRects correctly accounts for the transform between |
| 1613 // layer space and screen space. | 1615 // layer space and screen space. |
| 1614 | 1616 |
| 1615 FakePictureLayerTilingClient client; | 1617 FakePictureLayerTilingClient client; |
| 1616 scoped_ptr<TestablePictureLayerTiling> tiling; | 1618 std::unique_ptr<TestablePictureLayerTiling> tiling; |
| 1617 | 1619 |
| 1618 gfx::Size device_viewport(800, 600); | 1620 gfx::Size device_viewport(800, 600); |
| 1619 gfx::Rect visible_layer_rect(0, 0, 0, 0); // offscren. | 1621 gfx::Rect visible_layer_rect(0, 0, 0, 0); // offscren. |
| 1620 gfx::Size last_layer_bounds(200, 200); | 1622 gfx::Size last_layer_bounds(200, 200); |
| 1621 gfx::Size current_layer_bounds(200, 200); | 1623 gfx::Size current_layer_bounds(200, 200); |
| 1622 float last_layer_contents_scale = 1.f; | 1624 float last_layer_contents_scale = 1.f; |
| 1623 float current_layer_contents_scale = 1.f; | 1625 float current_layer_contents_scale = 1.f; |
| 1624 gfx::Transform last_screen_transform; | 1626 gfx::Transform last_screen_transform; |
| 1625 gfx::Transform current_screen_transform; | 1627 gfx::Transform current_screen_transform; |
| 1626 double last_frame_time_in_seconds = 1.0; | 1628 double last_frame_time_in_seconds = 1.0; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 // - Recycle tiling does _not_ have the tile in the same location (thus it | 1691 // - Recycle tiling does _not_ have the tile in the same location (thus it |
| 1690 // will be shared next time a pending tiling is created). | 1692 // will be shared next time a pending tiling is created). |
| 1691 | 1693 |
| 1692 FakePictureLayerTilingClient active_client; | 1694 FakePictureLayerTilingClient active_client; |
| 1693 | 1695 |
| 1694 active_client.SetTileSize(gfx::Size(100, 100)); | 1696 active_client.SetTileSize(gfx::Size(100, 100)); |
| 1695 LayerTreeSettings settings; | 1697 LayerTreeSettings settings; |
| 1696 | 1698 |
| 1697 scoped_refptr<FakeRasterSource> raster_source = | 1699 scoped_refptr<FakeRasterSource> raster_source = |
| 1698 FakeRasterSource::CreateFilled(gfx::Size(10000, 10000)); | 1700 FakeRasterSource::CreateFilled(gfx::Size(10000, 10000)); |
| 1699 scoped_ptr<TestablePictureLayerTiling> active_tiling = | 1701 std::unique_ptr<TestablePictureLayerTiling> active_tiling = |
| 1700 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1702 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1701 &active_client, settings); | 1703 &active_client, settings); |
| 1702 active_tiling->set_resolution(HIGH_RESOLUTION); | 1704 active_tiling->set_resolution(HIGH_RESOLUTION); |
| 1703 // Create all tiles on this tiling. | 1705 // Create all tiles on this tiling. |
| 1704 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, | 1706 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, |
| 1705 Occlusion()); | 1707 Occlusion()); |
| 1706 | 1708 |
| 1707 FakePictureLayerTilingClient recycle_client; | 1709 FakePictureLayerTilingClient recycle_client; |
| 1708 recycle_client.SetTileSize(gfx::Size(100, 100)); | 1710 recycle_client.SetTileSize(gfx::Size(100, 100)); |
| 1709 recycle_client.set_twin_tiling(active_tiling.get()); | 1711 recycle_client.set_twin_tiling(active_tiling.get()); |
| 1710 | 1712 |
| 1711 raster_source = FakeRasterSource::CreateFilled(gfx::Size(10000, 10000)); | 1713 raster_source = FakeRasterSource::CreateFilled(gfx::Size(10000, 10000)); |
| 1712 scoped_ptr<TestablePictureLayerTiling> recycle_tiling = | 1714 std::unique_ptr<TestablePictureLayerTiling> recycle_tiling = |
| 1713 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, | 1715 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, |
| 1714 &recycle_client, settings); | 1716 &recycle_client, settings); |
| 1715 recycle_tiling->set_resolution(HIGH_RESOLUTION); | 1717 recycle_tiling->set_resolution(HIGH_RESOLUTION); |
| 1716 | 1718 |
| 1717 // Create all tiles on the second tiling. All tiles should be shared. | 1719 // Create all tiles on the second tiling. All tiles should be shared. |
| 1718 recycle_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, | 1720 recycle_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, |
| 1719 1.0f, Occlusion()); | 1721 1.0f, Occlusion()); |
| 1720 | 1722 |
| 1721 // Set the second tiling as recycled. | 1723 // Set the second tiling as recycled. |
| 1722 active_client.set_twin_tiling(NULL); | 1724 active_client.set_twin_tiling(NULL); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1740 EXPECT_TRUE(active_tiling->TileAt(0, 0)); | 1742 EXPECT_TRUE(active_tiling->TileAt(0, 0)); |
| 1741 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 1743 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| 1742 } | 1744 } |
| 1743 | 1745 |
| 1744 TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { | 1746 TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { |
| 1745 FakePictureLayerTilingClient active_client; | 1747 FakePictureLayerTilingClient active_client; |
| 1746 active_client.SetTileSize(gfx::Size(100, 100)); | 1748 active_client.SetTileSize(gfx::Size(100, 100)); |
| 1747 | 1749 |
| 1748 scoped_refptr<FakeRasterSource> raster_source = | 1750 scoped_refptr<FakeRasterSource> raster_source = |
| 1749 FakeRasterSource::CreateFilled(gfx::Size(100, 100)); | 1751 FakeRasterSource::CreateFilled(gfx::Size(100, 100)); |
| 1750 scoped_ptr<TestablePictureLayerTiling> active_tiling = | 1752 std::unique_ptr<TestablePictureLayerTiling> active_tiling = |
| 1751 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 1753 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1752 &active_client, LayerTreeSettings()); | 1754 &active_client, LayerTreeSettings()); |
| 1753 active_tiling->set_resolution(HIGH_RESOLUTION); | 1755 active_tiling->set_resolution(HIGH_RESOLUTION); |
| 1754 // Create all tiles on this tiling. | 1756 // Create all tiles on this tiling. |
| 1755 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, | 1757 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, |
| 1756 Occlusion()); | 1758 Occlusion()); |
| 1757 | 1759 |
| 1758 FakePictureLayerTilingClient recycle_client; | 1760 FakePictureLayerTilingClient recycle_client; |
| 1759 recycle_client.SetTileSize(gfx::Size(100, 100)); | 1761 recycle_client.SetTileSize(gfx::Size(100, 100)); |
| 1760 recycle_client.set_twin_tiling(active_tiling.get()); | 1762 recycle_client.set_twin_tiling(active_tiling.get()); |
| 1761 | 1763 |
| 1762 LayerTreeSettings settings; | 1764 LayerTreeSettings settings; |
| 1763 | 1765 |
| 1764 raster_source = FakeRasterSource::CreateFilled(gfx::Size(100, 100)); | 1766 raster_source = FakeRasterSource::CreateFilled(gfx::Size(100, 100)); |
| 1765 scoped_ptr<TestablePictureLayerTiling> recycle_tiling = | 1767 std::unique_ptr<TestablePictureLayerTiling> recycle_tiling = |
| 1766 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, | 1768 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, |
| 1767 &recycle_client, settings); | 1769 &recycle_client, settings); |
| 1768 recycle_tiling->set_resolution(HIGH_RESOLUTION); | 1770 recycle_tiling->set_resolution(HIGH_RESOLUTION); |
| 1769 | 1771 |
| 1770 // Create all tiles on the recycle tiling. All tiles should be shared. | 1772 // Create all tiles on the recycle tiling. All tiles should be shared. |
| 1771 recycle_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, | 1773 recycle_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, |
| 1772 1.0f, Occlusion()); | 1774 1.0f, Occlusion()); |
| 1773 | 1775 |
| 1774 // Set the second tiling as recycled. | 1776 // Set the second tiling as recycled. |
| 1775 active_client.set_twin_tiling(NULL); | 1777 active_client.set_twin_tiling(NULL); |
| 1776 recycle_client.set_twin_tiling(NULL); | 1778 recycle_client.set_twin_tiling(NULL); |
| 1777 | 1779 |
| 1778 EXPECT_TRUE(active_tiling->TileAt(0, 0)); | 1780 EXPECT_TRUE(active_tiling->TileAt(0, 0)); |
| 1779 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 1781 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| 1780 | 1782 |
| 1781 // Reset the active tiling. The recycle tiles should be released too. | 1783 // Reset the active tiling. The recycle tiles should be released too. |
| 1782 active_tiling->Reset(); | 1784 active_tiling->Reset(); |
| 1783 EXPECT_FALSE(active_tiling->TileAt(0, 0)); | 1785 EXPECT_FALSE(active_tiling->TileAt(0, 0)); |
| 1784 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 1786 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| 1785 } | 1787 } |
| 1786 | 1788 |
| 1787 TEST(PictureLayerTilingTest, InvalidateAfterComputeTilePriorityRects) { | 1789 TEST(PictureLayerTilingTest, InvalidateAfterComputeTilePriorityRects) { |
| 1788 FakePictureLayerTilingClient pending_client; | 1790 FakePictureLayerTilingClient pending_client; |
| 1789 pending_client.SetTileSize(gfx::Size(100, 100)); | 1791 pending_client.SetTileSize(gfx::Size(100, 100)); |
| 1790 | 1792 |
| 1791 scoped_refptr<FakeRasterSource> raster_source = | 1793 scoped_refptr<FakeRasterSource> raster_source = |
| 1792 FakeRasterSource::CreateFilled(gfx::Size(100, 100)); | 1794 FakeRasterSource::CreateFilled(gfx::Size(100, 100)); |
| 1793 scoped_ptr<TestablePictureLayerTiling> pending_tiling = | 1795 std::unique_ptr<TestablePictureLayerTiling> pending_tiling = |
| 1794 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, | 1796 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, |
| 1795 &pending_client, LayerTreeSettings()); | 1797 &pending_client, LayerTreeSettings()); |
| 1796 pending_tiling->set_resolution(HIGH_RESOLUTION); | 1798 pending_tiling->set_resolution(HIGH_RESOLUTION); |
| 1797 | 1799 |
| 1798 // Ensure that we can compute tile priority rects, invalidate, and compute the | 1800 // Ensure that we can compute tile priority rects, invalidate, and compute the |
| 1799 // rects again. It is important that the second compute tile priority rects | 1801 // rects again. It is important that the second compute tile priority rects |
| 1800 // return true, indicating that things have changed (since invalidation has | 1802 // return true, indicating that things have changed (since invalidation has |
| 1801 // changed things). This causes PrepareTiles to be properly scheduled. If the | 1803 // changed things). This causes PrepareTiles to be properly scheduled. If the |
| 1802 // second ComputeTilePriorityRects returns false, then we assume that | 1804 // second ComputeTilePriorityRects returns false, then we assume that |
| 1803 // PrepareTiles isn't needed and we signal that we're ready to draw | 1805 // PrepareTiles isn't needed and we signal that we're ready to draw |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale, | 1855 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale, |
| 1854 raster_source, &client_, | 1856 raster_source, &client_, |
| 1855 LayerTreeSettings()); | 1857 LayerTreeSettings()); |
| 1856 | 1858 |
| 1857 gfx::Rect content_rect(25554432, 25554432, 950, 860); | 1859 gfx::Rect content_rect(25554432, 25554432, 950, 860); |
| 1858 VerifyTilesExactlyCoverRect(contents_scale, content_rect); | 1860 VerifyTilesExactlyCoverRect(contents_scale, content_rect); |
| 1859 } | 1861 } |
| 1860 | 1862 |
| 1861 } // namespace | 1863 } // namespace |
| 1862 } // namespace cc | 1864 } // namespace cc |
| OLD | NEW |