| 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" | 5 #include "cc/tiles/picture_layer_tiling.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 static std::unique_ptr<TestablePictureLayerTiling> Create( | 48 static std::unique_ptr<TestablePictureLayerTiling> Create( |
| 49 WhichTree tree, | 49 WhichTree tree, |
| 50 float contents_scale, | 50 float contents_scale, |
| 51 scoped_refptr<RasterSource> raster_source, | 51 scoped_refptr<RasterSource> raster_source, |
| 52 PictureLayerTilingClient* client, | 52 PictureLayerTilingClient* client, |
| 53 const LayerTreeSettings& settings) { | 53 const LayerTreeSettings& settings) { |
| 54 return base::WrapUnique(new TestablePictureLayerTiling( | 54 return base::WrapUnique(new TestablePictureLayerTiling( |
| 55 tree, contents_scale, raster_source, client, | 55 tree, contents_scale, raster_source, client, |
| 56 settings.tiling_interest_area_padding, | 56 settings.tiling_interest_area_padding, |
| 57 settings.skewport_target_time_in_seconds, | 57 settings.skewport_target_time_in_seconds, |
| 58 settings.skewport_extrapolation_limit_in_content_pixels)); | 58 settings.skewport_extrapolation_limit_in_screen_pixels)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } | 61 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } |
| 62 | 62 |
| 63 using PictureLayerTiling::ComputeSkewport; | |
| 64 using PictureLayerTiling::RemoveTileAt; | 63 using PictureLayerTiling::RemoveTileAt; |
| 65 using PictureLayerTiling::RemoveTilesInRegion; | 64 using PictureLayerTiling::RemoveTilesInRegion; |
| 66 | 65 |
| 67 protected: | 66 protected: |
| 68 TestablePictureLayerTiling(WhichTree tree, | 67 TestablePictureLayerTiling(WhichTree tree, |
| 69 float contents_scale, | 68 float contents_scale, |
| 70 scoped_refptr<RasterSource> raster_source, | 69 scoped_refptr<RasterSource> raster_source, |
| 71 PictureLayerTilingClient* client, | 70 PictureLayerTilingClient* client, |
| 72 size_t tiling_interest_area_padding, | 71 size_t tiling_interest_area_padding, |
| 73 float skewport_target_time, | 72 float skewport_target_time, |
| 74 int skewport_extrapolation_limit) | 73 int skewport_extrapolation_limit) |
| 75 : PictureLayerTiling(tree, | 74 : PictureLayerTiling(tree, contents_scale, raster_source, client) {} |
| 76 contents_scale, | |
| 77 raster_source, | |
| 78 client, | |
| 79 tiling_interest_area_padding, | |
| 80 skewport_target_time, | |
| 81 skewport_extrapolation_limit) {} | |
| 82 }; | 75 }; |
| 83 | 76 |
| 84 class PictureLayerTilingIteratorTest : public testing::Test { | 77 class PictureLayerTilingIteratorTest : public testing::Test { |
| 85 public: | 78 public: |
| 86 PictureLayerTilingIteratorTest() {} | 79 PictureLayerTilingIteratorTest() {} |
| 87 ~PictureLayerTilingIteratorTest() override {} | 80 ~PictureLayerTilingIteratorTest() override {} |
| 88 | 81 |
| 89 void Initialize(const gfx::Size& tile_size, | 82 void Initialize(const gfx::Size& tile_size, |
| 90 float contents_scale, | 83 float contents_scale, |
| 91 const gfx::Size& layer_bounds) { | 84 const gfx::Size& layer_bounds) { |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 VerifyTilesCoverNonContainedRect(1.0f, gfx::Rect(-1000, -1000, 2000, 2000)); | 599 VerifyTilesCoverNonContainedRect(1.0f, gfx::Rect(-1000, -1000, 2000, 2000)); |
| 607 VerifyTilesCoverNonContainedRect(1.5f, gfx::Rect(-1000, -1000, 2000, 2000)); | 600 VerifyTilesCoverNonContainedRect(1.5f, gfx::Rect(-1000, -1000, 2000, 2000)); |
| 608 VerifyTilesCoverNonContainedRect(0.5f, gfx::Rect(-1000, -1000, 2000, 2000)); | 601 VerifyTilesCoverNonContainedRect(0.5f, gfx::Rect(-1000, -1000, 2000, 2000)); |
| 609 | 602 |
| 610 // Partially covering content, but too large | 603 // Partially covering content, but too large |
| 611 VerifyTilesCoverNonContainedRect(1.0f, gfx::Rect(-1000, 100, 2000, 100)); | 604 VerifyTilesCoverNonContainedRect(1.0f, gfx::Rect(-1000, 100, 2000, 100)); |
| 612 VerifyTilesCoverNonContainedRect(1.5f, gfx::Rect(-1000, 100, 2000, 100)); | 605 VerifyTilesCoverNonContainedRect(1.5f, gfx::Rect(-1000, 100, 2000, 100)); |
| 613 VerifyTilesCoverNonContainedRect(0.5f, gfx::Rect(-1000, 100, 2000, 100)); | 606 VerifyTilesCoverNonContainedRect(0.5f, gfx::Rect(-1000, 100, 2000, 100)); |
| 614 } | 607 } |
| 615 | 608 |
| 616 TEST(PictureLayerTilingTest, SkewportLimits) { | |
| 617 FakePictureLayerTilingClient client; | |
| 618 | |
| 619 gfx::Rect viewport(0, 0, 100, 100); | |
| 620 gfx::Size layer_bounds(200, 200); | |
| 621 | |
| 622 client.SetTileSize(gfx::Size(100, 100)); | |
| 623 LayerTreeSettings settings; | |
| 624 settings.skewport_extrapolation_limit_in_content_pixels = 75; | |
| 625 | |
| 626 scoped_refptr<FakeRasterSource> raster_source = | |
| 627 FakeRasterSource::CreateFilled(layer_bounds); | |
| 628 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 629 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 630 &client, settings); | |
| 631 | |
| 632 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); | |
| 633 | |
| 634 // Move viewport down 50 pixels in 0.5 seconds. | |
| 635 gfx::Rect down_skewport = | |
| 636 tiling->ComputeSkewport(1.5, gfx::Rect(0, 50, 100, 100)); | |
| 637 | |
| 638 EXPECT_EQ(0, down_skewport.x()); | |
| 639 EXPECT_EQ(50, down_skewport.y()); | |
| 640 EXPECT_EQ(100, down_skewport.width()); | |
| 641 EXPECT_EQ(175, down_skewport.height()); | |
| 642 EXPECT_TRUE(down_skewport.Contains(gfx::Rect(0, 50, 100, 100))); | |
| 643 | |
| 644 // Move viewport down 50 and right 10 pixels. | |
| 645 gfx::Rect down_right_skewport = | |
| 646 tiling->ComputeSkewport(1.5, gfx::Rect(10, 50, 100, 100)); | |
| 647 | |
| 648 EXPECT_EQ(10, down_right_skewport.x()); | |
| 649 EXPECT_EQ(50, down_right_skewport.y()); | |
| 650 EXPECT_EQ(120, down_right_skewport.width()); | |
| 651 EXPECT_EQ(175, down_right_skewport.height()); | |
| 652 EXPECT_TRUE(down_right_skewport.Contains(gfx::Rect(10, 50, 100, 100))); | |
| 653 | |
| 654 // Move viewport left. | |
| 655 gfx::Rect left_skewport = | |
| 656 tiling->ComputeSkewport(1.5, gfx::Rect(-50, 0, 100, 100)); | |
| 657 | |
| 658 EXPECT_EQ(-125, left_skewport.x()); | |
| 659 EXPECT_EQ(0, left_skewport.y()); | |
| 660 EXPECT_EQ(175, left_skewport.width()); | |
| 661 EXPECT_EQ(100, left_skewport.height()); | |
| 662 EXPECT_TRUE(left_skewport.Contains(gfx::Rect(-50, 0, 100, 100))); | |
| 663 | |
| 664 // Expand viewport. | |
| 665 gfx::Rect expand_skewport = | |
| 666 tiling->ComputeSkewport(1.5, gfx::Rect(-50, -50, 200, 200)); | |
| 667 | |
| 668 // x and y moved by -75 (-50 - 75 = -125). | |
| 669 // right side and bottom side moved by 75 [(350 - 125) - (200 - 50) = 75]. | |
| 670 EXPECT_EQ(-125, expand_skewport.x()); | |
| 671 EXPECT_EQ(-125, expand_skewport.y()); | |
| 672 EXPECT_EQ(350, expand_skewport.width()); | |
| 673 EXPECT_EQ(350, expand_skewport.height()); | |
| 674 EXPECT_TRUE(expand_skewport.Contains(gfx::Rect(-50, -50, 200, 200))); | |
| 675 | |
| 676 // Expand the viewport past the limit in all directions. | |
| 677 gfx::Rect big_expand_skewport = | |
| 678 tiling->ComputeSkewport(1.5, gfx::Rect(-500, -500, 1500, 1500)); | |
| 679 | |
| 680 EXPECT_EQ(-575, big_expand_skewport.x()); | |
| 681 EXPECT_EQ(-575, big_expand_skewport.y()); | |
| 682 EXPECT_EQ(1650, big_expand_skewport.width()); | |
| 683 EXPECT_EQ(1650, big_expand_skewport.height()); | |
| 684 EXPECT_TRUE(big_expand_skewport.Contains(gfx::Rect(-500, -500, 1500, 1500))); | |
| 685 | |
| 686 // Shrink the skewport in all directions. | |
| 687 gfx::Rect shrink_viewport = | |
| 688 tiling->ComputeSkewport(1.5, gfx::Rect(0, 0, 100, 100)); | |
| 689 EXPECT_EQ(0, shrink_viewport.x()); | |
| 690 EXPECT_EQ(0, shrink_viewport.y()); | |
| 691 EXPECT_EQ(100, shrink_viewport.width()); | |
| 692 EXPECT_EQ(100, shrink_viewport.height()); | |
| 693 | |
| 694 // Move the skewport really far in one direction. | |
| 695 gfx::Rect move_skewport_far = | |
| 696 tiling->ComputeSkewport(1.5, gfx::Rect(0, 5000, 100, 100)); | |
| 697 EXPECT_EQ(0, move_skewport_far.x()); | |
| 698 EXPECT_EQ(5000, move_skewport_far.y()); | |
| 699 EXPECT_EQ(100, move_skewport_far.width()); | |
| 700 EXPECT_EQ(175, move_skewport_far.height()); | |
| 701 EXPECT_TRUE(move_skewport_far.Contains(gfx::Rect(0, 5000, 100, 100))); | |
| 702 } | |
| 703 | |
| 704 TEST(PictureLayerTilingTest, ComputeSkewportExtremeCases) { | |
| 705 FakePictureLayerTilingClient client; | |
| 706 | |
| 707 gfx::Size layer_bounds(200, 200); | |
| 708 client.SetTileSize(gfx::Size(100, 100)); | |
| 709 LayerTreeSettings settings; | |
| 710 scoped_refptr<FakeRasterSource> raster_source = | |
| 711 FakeRasterSource::CreateFilled(layer_bounds); | |
| 712 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 713 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 714 &client, settings); | |
| 715 | |
| 716 gfx::Rect viewport1(-1918, 255860, 4010, 2356); | |
| 717 gfx::Rect viewport2(-7088, -91738, 14212, 8350); | |
| 718 gfx::Rect viewport3(-12730024, -158883296, 24607540, 14454512); | |
| 719 double time = 1.0; | |
| 720 tiling->ComputeTilePriorityRects(viewport1, 1.f, time, Occlusion()); | |
| 721 time += 0.016; | |
| 722 EXPECT_TRUE(tiling->ComputeSkewport(time, viewport2).Contains(viewport2)); | |
| 723 tiling->ComputeTilePriorityRects(viewport2, 1.f, time, Occlusion()); | |
| 724 time += 0.016; | |
| 725 EXPECT_TRUE(tiling->ComputeSkewport(time, viewport3).Contains(viewport3)); | |
| 726 | |
| 727 // Use a tiling with a large scale, so the viewport times the scale no longer | |
| 728 // fits into integers, and the viewport is not anywhere close to the tiling. | |
| 729 tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1000.0f, | |
| 730 raster_source, &client, settings); | |
| 731 tiling->ComputeTilePriorityRects(viewport3, 1.f, time, Occlusion()); | |
| 732 EXPECT_EQ(gfx::Rect(), tiling->GetCurrentVisibleRectForTesting()); | |
| 733 } | |
| 734 | |
| 735 TEST(PictureLayerTilingTest, ComputeSkewport) { | |
| 736 FakePictureLayerTilingClient client; | |
| 737 | |
| 738 gfx::Rect viewport(0, 0, 100, 100); | |
| 739 gfx::Size layer_bounds(200, 200); | |
| 740 | |
| 741 client.SetTileSize(gfx::Size(100, 100)); | |
| 742 | |
| 743 scoped_refptr<FakeRasterSource> raster_source = | |
| 744 FakeRasterSource::CreateFilled(layer_bounds); | |
| 745 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 746 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 747 &client, LayerTreeSettings()); | |
| 748 | |
| 749 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); | |
| 750 | |
| 751 // Move viewport down 50 pixels in 0.5 seconds. | |
| 752 gfx::Rect down_skewport = | |
| 753 tiling->ComputeSkewport(1.5, gfx::Rect(0, 50, 100, 100)); | |
| 754 | |
| 755 EXPECT_EQ(0, down_skewport.x()); | |
| 756 EXPECT_EQ(50, down_skewport.y()); | |
| 757 EXPECT_EQ(100, down_skewport.width()); | |
| 758 EXPECT_EQ(200, down_skewport.height()); | |
| 759 | |
| 760 // Shrink viewport. | |
| 761 gfx::Rect shrink_skewport = | |
| 762 tiling->ComputeSkewport(1.5, gfx::Rect(25, 25, 50, 50)); | |
| 763 | |
| 764 EXPECT_EQ(25, shrink_skewport.x()); | |
| 765 EXPECT_EQ(25, shrink_skewport.y()); | |
| 766 EXPECT_EQ(50, shrink_skewport.width()); | |
| 767 EXPECT_EQ(50, shrink_skewport.height()); | |
| 768 | |
| 769 // Move viewport down 50 and right 10 pixels. | |
| 770 gfx::Rect down_right_skewport = | |
| 771 tiling->ComputeSkewport(1.5, gfx::Rect(10, 50, 100, 100)); | |
| 772 | |
| 773 EXPECT_EQ(10, down_right_skewport.x()); | |
| 774 EXPECT_EQ(50, down_right_skewport.y()); | |
| 775 EXPECT_EQ(120, down_right_skewport.width()); | |
| 776 EXPECT_EQ(200, down_right_skewport.height()); | |
| 777 | |
| 778 // Move viewport left. | |
| 779 gfx::Rect left_skewport = | |
| 780 tiling->ComputeSkewport(1.5, gfx::Rect(-20, 0, 100, 100)); | |
| 781 | |
| 782 EXPECT_EQ(-60, left_skewport.x()); | |
| 783 EXPECT_EQ(0, left_skewport.y()); | |
| 784 EXPECT_EQ(140, left_skewport.width()); | |
| 785 EXPECT_EQ(100, left_skewport.height()); | |
| 786 | |
| 787 // Expand viewport in 0.2 seconds. | |
| 788 gfx::Rect expanded_skewport = | |
| 789 tiling->ComputeSkewport(1.2, gfx::Rect(-5, -5, 110, 110)); | |
| 790 | |
| 791 EXPECT_EQ(-30, expanded_skewport.x()); | |
| 792 EXPECT_EQ(-30, expanded_skewport.y()); | |
| 793 EXPECT_EQ(160, expanded_skewport.width()); | |
| 794 EXPECT_EQ(160, expanded_skewport.height()); | |
| 795 } | |
| 796 | |
| 797 TEST(PictureLayerTilingTest, SkewportThroughUpdateTilePriorities) { | |
| 798 FakePictureLayerTilingClient client; | |
| 799 | |
| 800 gfx::Rect viewport(0, 0, 100, 100); | |
| 801 gfx::Size layer_bounds(200, 200); | |
| 802 | |
| 803 client.SetTileSize(gfx::Size(100, 100)); | |
| 804 | |
| 805 scoped_refptr<FakeRasterSource> raster_source = | |
| 806 FakeRasterSource::CreateFilled(layer_bounds); | |
| 807 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 808 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 809 &client, LayerTreeSettings()); | |
| 810 | |
| 811 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); | |
| 812 | |
| 813 // Move viewport down 50 pixels in 0.5 seconds. | |
| 814 gfx::Rect viewport_50 = gfx::Rect(0, 50, 100, 100); | |
| 815 gfx::Rect skewport_50 = tiling->ComputeSkewport(1.5, viewport_50); | |
| 816 | |
| 817 EXPECT_EQ(gfx::Rect(0, 50, 100, 200), skewport_50); | |
| 818 tiling->ComputeTilePriorityRects(viewport_50, 1.f, 1.5, Occlusion()); | |
| 819 | |
| 820 gfx::Rect viewport_100 = gfx::Rect(0, 100, 100, 100); | |
| 821 gfx::Rect skewport_100 = tiling->ComputeSkewport(2.0, viewport_100); | |
| 822 | |
| 823 EXPECT_EQ(gfx::Rect(0, 100, 100, 200), skewport_100); | |
| 824 tiling->ComputeTilePriorityRects(viewport_100, 1.f, 2.0, Occlusion()); | |
| 825 | |
| 826 // Advance time, but not the viewport. | |
| 827 gfx::Rect result = tiling->ComputeSkewport(2.5, viewport_100); | |
| 828 // Since the history did advance, we should still get a skewport but a smaller | |
| 829 // one. | |
| 830 EXPECT_EQ(gfx::Rect(0, 100, 100, 150), result); | |
| 831 tiling->ComputeTilePriorityRects(viewport_100, 1.f, 2.5, Occlusion()); | |
| 832 | |
| 833 // Advance time again. | |
| 834 result = tiling->ComputeSkewport(3.0, viewport_100); | |
| 835 EXPECT_EQ(viewport_100, result); | |
| 836 tiling->ComputeTilePriorityRects(viewport_100, 1.f, 3.0, Occlusion()); | |
| 837 | |
| 838 // Ensure we have a skewport. | |
| 839 gfx::Rect viewport_150 = gfx::Rect(0, 150, 100, 100); | |
| 840 gfx::Rect skewport_150 = tiling->ComputeSkewport(3.5, viewport_150); | |
| 841 EXPECT_EQ(gfx::Rect(0, 150, 100, 150), skewport_150); | |
| 842 tiling->ComputeTilePriorityRects(viewport_150, 1.f, 3.5, Occlusion()); | |
| 843 | |
| 844 // Advance the viewport, but not the time. | |
| 845 gfx::Rect viewport_200 = gfx::Rect(0, 200, 100, 100); | |
| 846 gfx::Rect skewport_200 = tiling->ComputeSkewport(3.5, viewport_200); | |
| 847 EXPECT_EQ(gfx::Rect(0, 200, 100, 300), skewport_200); | |
| 848 | |
| 849 // Ensure that continued calls with the same value, produce the same skewport. | |
| 850 tiling->ComputeTilePriorityRects(viewport_150, 1.f, 3.5, Occlusion()); | |
| 851 EXPECT_EQ(gfx::Rect(0, 200, 100, 300), skewport_200); | |
| 852 tiling->ComputeTilePriorityRects(viewport_150, 1.f, 3.5, Occlusion()); | |
| 853 EXPECT_EQ(gfx::Rect(0, 200, 100, 300), skewport_200); | |
| 854 | |
| 855 tiling->ComputeTilePriorityRects(viewport_200, 1.f, 3.5, Occlusion()); | |
| 856 | |
| 857 // This should never happen, but advance the viewport yet again keeping the | |
| 858 // time the same. | |
| 859 gfx::Rect viewport_250 = gfx::Rect(0, 250, 100, 100); | |
| 860 gfx::Rect skewport_250 = tiling->ComputeSkewport(3.5, viewport_250); | |
| 861 EXPECT_EQ(viewport_250, skewport_250); | |
| 862 tiling->ComputeTilePriorityRects(viewport_250, 1.f, 3.5, Occlusion()); | |
| 863 } | |
| 864 | |
| 865 TEST(PictureLayerTilingTest, ViewportDistanceWithScale) { | |
| 866 FakePictureLayerTilingClient client; | |
| 867 | |
| 868 gfx::Rect viewport(0, 0, 100, 100); | |
| 869 gfx::Size layer_bounds(1500, 1500); | |
| 870 | |
| 871 client.SetTileSize(gfx::Size(10, 10)); | |
| 872 LayerTreeSettings settings; | |
| 873 | |
| 874 // Tiling at 0.25 scale: this should create 47x47 tiles of size 10x10. | |
| 875 // The reason is that each tile has a one pixel border, so tile at (1, 2) | |
| 876 // for instance begins at (8, 16) pixels. So tile at (46, 46) will begin at | |
| 877 // (368, 368) and extend to the end of 1500 * 0.25 = 375 edge of the | |
| 878 // tiling. | |
| 879 scoped_refptr<FakeRasterSource> raster_source = | |
| 880 FakeRasterSource::CreateFilled(layer_bounds); | |
| 881 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 882 TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.25f, raster_source, | |
| 883 &client, settings); | |
| 884 tiling->set_resolution(HIGH_RESOLUTION); | |
| 885 gfx::Rect viewport_in_content_space = | |
| 886 gfx::ScaleToEnclosedRect(viewport, 0.25f); | |
| 887 | |
| 888 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); | |
| 889 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 890 | |
| 891 // Compute the soon border. | |
| 892 float inset = PictureLayerTiling::CalculateSoonBorderDistance( | |
| 893 viewport_in_content_space, 1.0f / 0.25f); | |
| 894 gfx::Rect soon_rect_in_content_space = viewport_in_content_space; | |
| 895 soon_rect_in_content_space.Inset(-inset, -inset); | |
| 896 | |
| 897 // Sanity checks. | |
| 898 for (int i = 0; i < 47; ++i) { | |
| 899 for (int j = 0; j < 47; ++j) { | |
| 900 EXPECT_TRUE(tiling->TileAt(i, j)) << "i: " << i << " j: " << j; | |
| 901 } | |
| 902 } | |
| 903 for (int i = 0; i < 47; ++i) { | |
| 904 EXPECT_FALSE(tiling->TileAt(i, 47)) << "i: " << i; | |
| 905 EXPECT_FALSE(tiling->TileAt(47, i)) << "i: " << i; | |
| 906 } | |
| 907 | |
| 908 // No movement in the viewport implies that tiles will either be NOW | |
| 909 // or EVENTUALLY, with the exception of tiles that are between 0 and 312 | |
| 910 // pixels away from the viewport, which will be in the SOON bin. | |
| 911 bool have_now = false; | |
| 912 bool have_eventually = false; | |
| 913 bool have_soon = false; | |
| 914 for (int i = 0; i < 47; ++i) { | |
| 915 for (int j = 0; j < 47; ++j) { | |
| 916 Tile* tile = tiling->TileAt(i, j); | |
| 917 PrioritizedTile prioritized_tile = prioritized_tiles[tile]; | |
| 918 TilePriority priority = prioritized_tile.priority(); | |
| 919 | |
| 920 gfx::Rect tile_rect = tiling->TilingDataForTesting().TileBounds(i, j); | |
| 921 if (viewport_in_content_space.Intersects(tile_rect)) { | |
| 922 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 923 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | |
| 924 have_now = true; | |
| 925 } else if (soon_rect_in_content_space.Intersects(tile_rect)) { | |
| 926 EXPECT_EQ(TilePriority::SOON, priority.priority_bin); | |
| 927 have_soon = true; | |
| 928 } else { | |
| 929 EXPECT_EQ(TilePriority::EVENTUALLY, priority.priority_bin); | |
| 930 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 931 have_eventually = true; | |
| 932 } | |
| 933 } | |
| 934 } | |
| 935 | |
| 936 EXPECT_TRUE(have_now); | |
| 937 EXPECT_TRUE(have_soon); | |
| 938 EXPECT_TRUE(have_eventually); | |
| 939 | |
| 940 // Spot check some distances. | |
| 941 // Tile at 5, 1 should begin at 41x9 in content space (without borders), | |
| 942 // so the distance to a viewport that ends at 25x25 in content space | |
| 943 // should be 17 (41 - 25 + 1). In layer space, then that should be | |
| 944 // 17 / 0.25 = 68 pixels. | |
| 945 | |
| 946 // We can verify that the content rect (with borders) is one pixel off | |
| 947 // 41,9 8x8 on all sides. | |
| 948 EXPECT_EQ(tiling->TileAt(5, 1)->content_rect().ToString(), "40,8 10x10"); | |
| 949 | |
| 950 TilePriority priority = prioritized_tiles[tiling->TileAt(5, 1)].priority(); | |
| 951 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible); | |
| 952 | |
| 953 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority(); | |
| 954 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible); | |
| 955 | |
| 956 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority(); | |
| 957 EXPECT_FLOAT_EQ(40.f, priority.distance_to_visible); | |
| 958 | |
| 959 // Move the viewport down 40 pixels. | |
| 960 viewport = gfx::Rect(0, 40, 100, 100); | |
| 961 viewport_in_content_space = gfx::ScaleToEnclosedRect(viewport, 0.25f); | |
| 962 gfx::Rect skewport = tiling->ComputeSkewport(2.0, viewport_in_content_space); | |
| 963 | |
| 964 // Compute the soon border. | |
| 965 inset = PictureLayerTiling::CalculateSoonBorderDistance( | |
| 966 viewport_in_content_space, 1.0f / 0.25f); | |
| 967 soon_rect_in_content_space = viewport_in_content_space; | |
| 968 soon_rect_in_content_space.Inset(-inset, -inset); | |
| 969 | |
| 970 EXPECT_EQ(0, skewport.x()); | |
| 971 EXPECT_EQ(10, skewport.y()); | |
| 972 EXPECT_EQ(25, skewport.width()); | |
| 973 EXPECT_EQ(35, skewport.height()); | |
| 974 | |
| 975 tiling->ComputeTilePriorityRects(viewport, 1.f, 2.0, Occlusion()); | |
| 976 prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 977 | |
| 978 have_now = false; | |
| 979 have_eventually = false; | |
| 980 have_soon = false; | |
| 981 | |
| 982 // Viewport moved, so we expect to find some NOW tiles, some SOON tiles and | |
| 983 // some EVENTUALLY tiles. | |
| 984 for (int i = 0; i < 47; ++i) { | |
| 985 for (int j = 0; j < 47; ++j) { | |
| 986 Tile* tile = tiling->TileAt(i, j); | |
| 987 TilePriority priority = prioritized_tiles[tile].priority(); | |
| 988 | |
| 989 gfx::Rect tile_rect = tiling->TilingDataForTesting().TileBounds(i, j); | |
| 990 if (viewport_in_content_space.Intersects(tile_rect)) { | |
| 991 EXPECT_EQ(TilePriority::NOW, priority.priority_bin) << "i: " << i | |
| 992 << " j: " << j; | |
| 993 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible) << "i: " << i | |
| 994 << " j: " << j; | |
| 995 have_now = true; | |
| 996 } else if (skewport.Intersects(tile_rect) || | |
| 997 soon_rect_in_content_space.Intersects(tile_rect)) { | |
| 998 EXPECT_EQ(TilePriority::SOON, priority.priority_bin) << "i: " << i | |
| 999 << " j: " << j; | |
| 1000 EXPECT_GT(priority.distance_to_visible, 0.f) << "i: " << i | |
| 1001 << " j: " << j; | |
| 1002 have_soon = true; | |
| 1003 } else { | |
| 1004 EXPECT_EQ(TilePriority::EVENTUALLY, priority.priority_bin) | |
| 1005 << "i: " << i << " j: " << j; | |
| 1006 EXPECT_GT(priority.distance_to_visible, 0.f) << "i: " << i | |
| 1007 << " j: " << j; | |
| 1008 have_eventually = true; | |
| 1009 } | |
| 1010 } | |
| 1011 } | |
| 1012 | |
| 1013 EXPECT_TRUE(have_now); | |
| 1014 EXPECT_TRUE(have_soon); | |
| 1015 EXPECT_TRUE(have_eventually); | |
| 1016 | |
| 1017 priority = prioritized_tiles[tiling->TileAt(5, 1)].priority(); | |
| 1018 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible); | |
| 1019 | |
| 1020 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority(); | |
| 1021 EXPECT_FLOAT_EQ(28.f, priority.distance_to_visible); | |
| 1022 | |
| 1023 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority(); | |
| 1024 EXPECT_FLOAT_EQ(4.f, priority.distance_to_visible); | |
| 1025 | |
| 1026 // Change the underlying layer scale. | |
| 1027 tiling->ComputeTilePriorityRects(viewport, 2.0f, 3.0, Occlusion()); | |
| 1028 prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 1029 | |
| 1030 priority = prioritized_tiles[tiling->TileAt(5, 1)].priority(); | |
| 1031 EXPECT_FLOAT_EQ(136.f, priority.distance_to_visible); | |
| 1032 | |
| 1033 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority(); | |
| 1034 EXPECT_FLOAT_EQ(56.f, priority.distance_to_visible); | |
| 1035 | |
| 1036 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority(); | |
| 1037 EXPECT_FLOAT_EQ(8.f, priority.distance_to_visible); | |
| 1038 | |
| 1039 // Test additional scales. | |
| 1040 tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.2f, raster_source, | |
| 1041 &client, LayerTreeSettings()); | |
| 1042 tiling->set_resolution(HIGH_RESOLUTION); | |
| 1043 tiling->ComputeTilePriorityRects(viewport, 1.0f, 4.0, Occlusion()); | |
| 1044 prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 1045 | |
| 1046 priority = prioritized_tiles[tiling->TileAt(5, 1)].priority(); | |
| 1047 EXPECT_FLOAT_EQ(110.f, priority.distance_to_visible); | |
| 1048 | |
| 1049 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority(); | |
| 1050 EXPECT_FLOAT_EQ(70.f, priority.distance_to_visible); | |
| 1051 | |
| 1052 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority(); | |
| 1053 EXPECT_FLOAT_EQ(60.f, priority.distance_to_visible); | |
| 1054 | |
| 1055 tiling->ComputeTilePriorityRects(viewport, 0.5f, 5.0, Occlusion()); | |
| 1056 prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 1057 | |
| 1058 priority = prioritized_tiles[tiling->TileAt(5, 1)].priority(); | |
| 1059 EXPECT_FLOAT_EQ(55.f, priority.distance_to_visible); | |
| 1060 | |
| 1061 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority(); | |
| 1062 EXPECT_FLOAT_EQ(35.f, priority.distance_to_visible); | |
| 1063 | |
| 1064 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority(); | |
| 1065 EXPECT_FLOAT_EQ(30.f, priority.distance_to_visible); | |
| 1066 } | |
| 1067 | |
| 1068 static void TileExists(bool exists, Tile* tile, | 609 static void TileExists(bool exists, Tile* tile, |
| 1069 const gfx::Rect& geometry_rect) { | 610 const gfx::Rect& geometry_rect) { |
| 1070 EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString(); | 611 EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString(); |
| 1071 } | 612 } |
| 1072 | 613 |
| 1073 TEST_F(PictureLayerTilingIteratorTest, TilesExist) { | 614 TEST_F(PictureLayerTilingIteratorTest, TilesExist) { |
| 1074 gfx::Size layer_bounds(1099, 801); | 615 gfx::Size layer_bounds(1099, 801); |
| 1075 Initialize(gfx::Size(100, 100), 1.f, layer_bounds); | 616 Initialize(gfx::Size(100, 100), 1.f, layer_bounds); |
| 1076 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); | 617 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); |
| 1077 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); | 618 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); |
| 1078 | 619 |
| 1079 tiling_->ComputeTilePriorityRects( | 620 tiling_->ComputeTilePriorityRects( |
| 1080 gfx::Rect(layer_bounds), // visible content rect | 621 gfx::Rect(layer_bounds), // visible rect |
| 622 gfx::Rect(layer_bounds), // skewport |
| 623 gfx::Rect(layer_bounds), // soon border rect |
| 624 gfx::Rect(layer_bounds), // eventually rect |
| 1081 1.f, // current contents scale | 625 1.f, // current contents scale |
| 1082 1.0, // current frame time | |
| 1083 Occlusion()); | 626 Occlusion()); |
| 1084 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); | 627 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); |
| 1085 | 628 |
| 1086 // Make the viewport rect empty. All tiles are killed and become zombies. | 629 // Make the viewport rect empty. All tiles are killed and become zombies. |
| 1087 tiling_->ComputeTilePriorityRects(gfx::Rect(), // visible content rect | 630 tiling_->ComputeTilePriorityRects(gfx::Rect(), gfx::Rect(), gfx::Rect(), |
| 1088 1.f, // current contents scale | 631 gfx::Rect(), 1.f, Occlusion()); |
| 1089 2.0, // current frame time | |
| 1090 Occlusion()); | |
| 1091 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); | 632 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); |
| 1092 } | 633 } |
| 1093 | 634 |
| 1094 TEST_F(PictureLayerTilingIteratorTest, TilesExistGiantViewport) { | 635 TEST_F(PictureLayerTilingIteratorTest, TilesExistGiantViewport) { |
| 1095 gfx::Size layer_bounds(1099, 801); | 636 gfx::Size layer_bounds(1099, 801); |
| 1096 Initialize(gfx::Size(100, 100), 1.f, layer_bounds); | 637 Initialize(gfx::Size(100, 100), 1.f, layer_bounds); |
| 1097 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); | 638 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); |
| 1098 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); | 639 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); |
| 1099 | 640 |
| 1100 gfx::Rect giant_rect(-10000000, -10000000, 1000000000, 1000000000); | 641 gfx::Rect giant_rect(-10000000, -10000000, 1000000000, 1000000000); |
| 1101 | 642 |
| 1102 tiling_->ComputeTilePriorityRects( | 643 tiling_->ComputeTilePriorityRects( |
| 1103 gfx::Rect(layer_bounds), // visible content rect | 644 gfx::Rect(layer_bounds), // visible rect |
| 645 gfx::Rect(layer_bounds), // skewport |
| 646 gfx::Rect(layer_bounds), // soon border rect |
| 647 gfx::Rect(layer_bounds), // eventually rect |
| 1104 1.f, // current contents scale | 648 1.f, // current contents scale |
| 1105 1.0, // current frame time | |
| 1106 Occlusion()); | 649 Occlusion()); |
| 1107 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); | 650 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); |
| 1108 | 651 |
| 1109 // If the visible content rect is empty, it should still have live tiles. | 652 // If the visible content rect is huge, we should still have live tiles. |
| 1110 tiling_->ComputeTilePriorityRects(giant_rect, // visible content rect | 653 tiling_->ComputeTilePriorityRects(giant_rect, giant_rect, giant_rect, |
| 1111 1.f, // current contents scale | 654 giant_rect, 1.f, Occlusion()); |
| 1112 2.0, // current frame time | |
| 1113 Occlusion()); | |
| 1114 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); | 655 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); |
| 1115 } | 656 } |
| 1116 | 657 |
| 1117 TEST_F(PictureLayerTilingIteratorTest, TilesExistOutsideViewport) { | 658 TEST_F(PictureLayerTilingIteratorTest, TilesExistOutsideViewport) { |
| 1118 gfx::Size layer_bounds(1099, 801); | 659 gfx::Size layer_bounds(1099, 801); |
| 1119 Initialize(gfx::Size(100, 100), 1.f, layer_bounds); | 660 Initialize(gfx::Size(100, 100), 1.f, layer_bounds); |
| 1120 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); | 661 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); |
| 1121 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); | 662 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); |
| 1122 | 663 |
| 1123 // This rect does not intersect with the layer, as the layer is outside the | 664 // This rect does not intersect with the layer, as the layer is outside the |
| 1124 // viewport. | 665 // viewport. |
| 1125 gfx::Rect viewport_rect(1100, 0, 1000, 1000); | 666 gfx::Rect viewport_rect(1100, 0, 1000, 1000); |
| 1126 EXPECT_FALSE(viewport_rect.Intersects(gfx::Rect(layer_bounds))); | 667 EXPECT_FALSE(viewport_rect.Intersects(gfx::Rect(layer_bounds))); |
| 1127 | 668 |
| 1128 tiling_->ComputeTilePriorityRects(viewport_rect, // visible content rect | 669 LayerTreeSettings settings; |
| 1129 1.f, // current contents scale | 670 gfx::Rect eventually_rect = viewport_rect; |
| 1130 1.0, // current frame time | 671 eventually_rect.Inset(-settings.tiling_interest_area_padding, |
| 1131 Occlusion()); | 672 -settings.tiling_interest_area_padding); |
| 673 tiling_->ComputeTilePriorityRects(viewport_rect, viewport_rect, viewport_rect, |
| 674 eventually_rect, 1.f, Occlusion()); |
| 1132 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); | 675 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); |
| 1133 } | 676 } |
| 1134 | 677 |
| 1135 static void TilesIntersectingRectExist(const gfx::Rect& rect, | 678 static void TilesIntersectingRectExist(const gfx::Rect& rect, |
| 1136 bool intersect_exists, | 679 bool intersect_exists, |
| 1137 Tile* tile, | 680 Tile* tile, |
| 1138 const gfx::Rect& geometry_rect) { | 681 const gfx::Rect& geometry_rect) { |
| 1139 bool intersects = rect.Intersects(geometry_rect); | 682 bool intersects = rect.Intersects(geometry_rect); |
| 1140 bool expected_exists = intersect_exists ? intersects : !intersects; | 683 bool expected_exists = intersect_exists ? intersects : !intersects; |
| 1141 EXPECT_EQ(expected_exists, tile != NULL) | 684 EXPECT_EQ(expected_exists, tile != NULL) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1153 scoped_refptr<FakeRasterSource> raster_source = | 696 scoped_refptr<FakeRasterSource> raster_source = |
| 1154 FakeRasterSource::CreateFilled(layer_bounds); | 697 FakeRasterSource::CreateFilled(layer_bounds); |
| 1155 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, 1.f, raster_source, | 698 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, 1.f, raster_source, |
| 1156 &client_, settings); | 699 &client_, settings); |
| 1157 tiling_->set_resolution(HIGH_RESOLUTION); | 700 tiling_->set_resolution(HIGH_RESOLUTION); |
| 1158 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); | 701 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); |
| 1159 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); | 702 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); |
| 1160 | 703 |
| 1161 gfx::Rect visible_rect(8000, 8000, 50, 50); | 704 gfx::Rect visible_rect(8000, 8000, 50, 50); |
| 1162 | 705 |
| 1163 tiling_->ComputeTilePriorityRects(visible_rect, // visible content rect | 706 tiling_->ComputeTilePriorityRects(visible_rect, // visible rect |
| 707 visible_rect, // skewport |
| 708 visible_rect, // soon border rect |
| 709 visible_rect, // eventually rect |
| 1164 1.f, // current contents scale | 710 1.f, // current contents scale |
| 1165 1.0, // current frame time | |
| 1166 Occlusion()); | 711 Occlusion()); |
| 1167 VerifyTiles(1.f, | 712 VerifyTiles(1.f, |
| 1168 gfx::Rect(layer_bounds), | 713 gfx::Rect(layer_bounds), |
| 1169 base::Bind(&TilesIntersectingRectExist, visible_rect, true)); | 714 base::Bind(&TilesIntersectingRectExist, visible_rect, true)); |
| 1170 } | 715 } |
| 1171 | 716 |
| 1172 TEST(ComputeTilePriorityRectsTest, VisibleTiles) { | 717 TEST(ComputeTilePriorityRectsTest, VisibleTiles) { |
| 1173 // The TilePriority of visible tiles should have zero distance_to_visible | 718 // The TilePriority of visible tiles should have zero distance_to_visible |
| 1174 // and time_to_visible. | 719 // and time_to_visible. |
| 1175 FakePictureLayerTilingClient client; | 720 FakePictureLayerTilingClient client; |
| 1176 | 721 |
| 1177 gfx::Size device_viewport(800, 600); | 722 gfx::Size device_viewport(800, 600); |
| 1178 gfx::Size last_layer_bounds(200, 200); | 723 gfx::Size last_layer_bounds(200, 200); |
| 1179 gfx::Size current_layer_bounds(200, 200); | 724 gfx::Size current_layer_bounds(200, 200); |
| 1180 float current_layer_contents_scale = 1.f; | 725 float current_layer_contents_scale = 1.f; |
| 1181 gfx::Transform current_screen_transform; | 726 gfx::Transform current_screen_transform; |
| 1182 double current_frame_time_in_seconds = 1.0; | |
| 1183 | 727 |
| 1184 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 728 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1185 current_screen_transform, device_viewport); | 729 current_screen_transform, device_viewport); |
| 1186 | 730 |
| 1187 client.SetTileSize(gfx::Size(100, 100)); | 731 client.SetTileSize(gfx::Size(100, 100)); |
| 1188 | 732 |
| 1189 scoped_refptr<FakeRasterSource> raster_source = | 733 scoped_refptr<FakeRasterSource> raster_source = |
| 1190 FakeRasterSource::CreateFilled(current_layer_bounds); | 734 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1191 std::unique_ptr<TestablePictureLayerTiling> tiling = | 735 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1192 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 736 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1193 &client, LayerTreeSettings()); | 737 &client, LayerTreeSettings()); |
| 1194 tiling->set_resolution(HIGH_RESOLUTION); | 738 tiling->set_resolution(HIGH_RESOLUTION); |
| 1195 | 739 |
| 1196 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 740 LayerTreeSettings settings; |
| 1197 current_layer_contents_scale, | 741 gfx::Rect eventually_rect = viewport_in_layer_space; |
| 1198 current_frame_time_in_seconds, Occlusion()); | 742 eventually_rect.Inset(-settings.tiling_interest_area_padding, |
| 743 -settings.tiling_interest_area_padding); |
| 744 tiling->ComputeTilePriorityRects( |
| 745 viewport_in_layer_space, viewport_in_layer_space, viewport_in_layer_space, |
| 746 eventually_rect, current_layer_contents_scale, Occlusion()); |
| 1199 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 747 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1200 | 748 |
| 1201 ASSERT_TRUE(tiling->TileAt(0, 0)); | 749 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| 1202 ASSERT_TRUE(tiling->TileAt(0, 1)); | 750 ASSERT_TRUE(tiling->TileAt(0, 1)); |
| 1203 ASSERT_TRUE(tiling->TileAt(1, 0)); | 751 ASSERT_TRUE(tiling->TileAt(1, 0)); |
| 1204 ASSERT_TRUE(tiling->TileAt(1, 1)); | 752 ASSERT_TRUE(tiling->TileAt(1, 1)); |
| 1205 | 753 |
| 1206 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | 754 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); |
| 1207 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | 755 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); |
| 1208 EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin); | 756 EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1224 // The TilePriority of offscreen tiles (without movement) should have nonzero | 772 // The TilePriority of offscreen tiles (without movement) should have nonzero |
| 1225 // distance_to_visible and infinite time_to_visible. | 773 // distance_to_visible and infinite time_to_visible. |
| 1226 FakePictureLayerTilingClient client; | 774 FakePictureLayerTilingClient client; |
| 1227 | 775 |
| 1228 gfx::Size device_viewport(800, 600); | 776 gfx::Size device_viewport(800, 600); |
| 1229 gfx::Size last_layer_bounds(200, 200); | 777 gfx::Size last_layer_bounds(200, 200); |
| 1230 gfx::Size current_layer_bounds(200, 200); | 778 gfx::Size current_layer_bounds(200, 200); |
| 1231 float current_layer_contents_scale = 1.f; | 779 float current_layer_contents_scale = 1.f; |
| 1232 gfx::Transform last_screen_transform; | 780 gfx::Transform last_screen_transform; |
| 1233 gfx::Transform current_screen_transform; | 781 gfx::Transform current_screen_transform; |
| 1234 double current_frame_time_in_seconds = 1.0; | |
| 1235 | 782 |
| 1236 current_screen_transform.Translate(850, 0); | 783 current_screen_transform.Translate(850, 0); |
| 1237 last_screen_transform = current_screen_transform; | 784 last_screen_transform = current_screen_transform; |
| 1238 | 785 |
| 1239 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 786 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1240 current_screen_transform, device_viewport); | 787 current_screen_transform, device_viewport); |
| 1241 | 788 |
| 1242 client.SetTileSize(gfx::Size(100, 100)); | 789 client.SetTileSize(gfx::Size(100, 100)); |
| 1243 | 790 |
| 1244 scoped_refptr<FakeRasterSource> raster_source = | 791 scoped_refptr<FakeRasterSource> raster_source = |
| 1245 FakeRasterSource::CreateFilled(current_layer_bounds); | 792 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1246 std::unique_ptr<TestablePictureLayerTiling> tiling = | 793 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1247 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 794 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1248 &client, LayerTreeSettings()); | 795 &client, LayerTreeSettings()); |
| 1249 tiling->set_resolution(HIGH_RESOLUTION); | 796 tiling->set_resolution(HIGH_RESOLUTION); |
| 1250 | 797 |
| 1251 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 798 LayerTreeSettings settings; |
| 1252 current_layer_contents_scale, | 799 gfx::Rect eventually_rect = viewport_in_layer_space; |
| 1253 current_frame_time_in_seconds, Occlusion()); | 800 eventually_rect.Inset(-settings.tiling_interest_area_padding, |
| 801 -settings.tiling_interest_area_padding); |
| 802 tiling->ComputeTilePriorityRects( |
| 803 viewport_in_layer_space, viewport_in_layer_space, viewport_in_layer_space, |
| 804 eventually_rect, current_layer_contents_scale, Occlusion()); |
| 1254 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 805 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1255 | 806 |
| 1256 ASSERT_TRUE(tiling->TileAt(0, 0)); | 807 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| 1257 ASSERT_TRUE(tiling->TileAt(0, 1)); | 808 ASSERT_TRUE(tiling->TileAt(0, 1)); |
| 1258 ASSERT_TRUE(tiling->TileAt(1, 0)); | 809 ASSERT_TRUE(tiling->TileAt(1, 0)); |
| 1259 ASSERT_TRUE(tiling->TileAt(1, 1)); | 810 ASSERT_TRUE(tiling->TileAt(1, 1)); |
| 1260 | 811 |
| 1261 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | 812 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); |
| 1262 EXPECT_GT(priority.distance_to_visible, 0.f); | 813 EXPECT_GT(priority.distance_to_visible, 0.f); |
| 1263 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | 814 EXPECT_NE(TilePriority::NOW, priority.priority_bin); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1289 // Sanity check that a layer with some tiles visible and others offscreen has | 840 // Sanity check that a layer with some tiles visible and others offscreen has |
| 1290 // correct TilePriorities for each tile. | 841 // correct TilePriorities for each tile. |
| 1291 FakePictureLayerTilingClient client; | 842 FakePictureLayerTilingClient client; |
| 1292 | 843 |
| 1293 gfx::Size device_viewport(800, 600); | 844 gfx::Size device_viewport(800, 600); |
| 1294 gfx::Size last_layer_bounds(200, 200); | 845 gfx::Size last_layer_bounds(200, 200); |
| 1295 gfx::Size current_layer_bounds(200, 200); | 846 gfx::Size current_layer_bounds(200, 200); |
| 1296 float current_layer_contents_scale = 1.f; | 847 float current_layer_contents_scale = 1.f; |
| 1297 gfx::Transform last_screen_transform; | 848 gfx::Transform last_screen_transform; |
| 1298 gfx::Transform current_screen_transform; | 849 gfx::Transform current_screen_transform; |
| 1299 double current_frame_time_in_seconds = 1.0; | |
| 1300 | 850 |
| 1301 current_screen_transform.Translate(705, 505); | 851 current_screen_transform.Translate(705, 505); |
| 1302 last_screen_transform = current_screen_transform; | 852 last_screen_transform = current_screen_transform; |
| 1303 | 853 |
| 1304 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | 854 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( |
| 1305 current_screen_transform, device_viewport); | 855 current_screen_transform, device_viewport); |
| 1306 | 856 |
| 1307 client.SetTileSize(gfx::Size(100, 100)); | 857 client.SetTileSize(gfx::Size(100, 100)); |
| 1308 | 858 |
| 1309 scoped_refptr<FakeRasterSource> raster_source = | 859 scoped_refptr<FakeRasterSource> raster_source = |
| 1310 FakeRasterSource::CreateFilled(current_layer_bounds); | 860 FakeRasterSource::CreateFilled(current_layer_bounds); |
| 1311 std::unique_ptr<TestablePictureLayerTiling> tiling = | 861 std::unique_ptr<TestablePictureLayerTiling> tiling = |
| 1312 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 862 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1313 &client, LayerTreeSettings()); | 863 &client, LayerTreeSettings()); |
| 1314 tiling->set_resolution(HIGH_RESOLUTION); | 864 tiling->set_resolution(HIGH_RESOLUTION); |
| 1315 | 865 |
| 1316 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | 866 LayerTreeSettings settings; |
| 1317 current_layer_contents_scale, | 867 gfx::Rect eventually_rect = viewport_in_layer_space; |
| 1318 current_frame_time_in_seconds, Occlusion()); | 868 eventually_rect.Inset(-settings.tiling_interest_area_padding, |
| 869 -settings.tiling_interest_area_padding); |
| 870 tiling->ComputeTilePriorityRects( |
| 871 viewport_in_layer_space, viewport_in_layer_space, viewport_in_layer_space, |
| 872 eventually_rect, current_layer_contents_scale, Occlusion()); |
| 1319 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 873 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 1320 | 874 |
| 1321 ASSERT_TRUE(tiling->TileAt(0, 0)); | 875 ASSERT_TRUE(tiling->TileAt(0, 0)); |
| 1322 ASSERT_TRUE(tiling->TileAt(0, 1)); | |
| 1323 ASSERT_TRUE(tiling->TileAt(1, 0)); | |
| 1324 ASSERT_TRUE(tiling->TileAt(1, 1)); | |
| 1325 | |
| 1326 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | |
| 1327 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | |
| 1328 EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1329 | |
| 1330 priority = prioritized_tiles[tiling->TileAt(0, 1)].priority(); | |
| 1331 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1332 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1333 | |
| 1334 priority = prioritized_tiles[tiling->TileAt(1, 0)].priority(); | |
| 1335 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1336 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1337 | |
| 1338 priority = prioritized_tiles[tiling->TileAt(1, 1)].priority(); | |
| 1339 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1340 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1341 } | |
| 1342 | |
| 1343 TEST(ComputeTilePriorityRectsTest, PartiallyOffscreenRotatedLayer) { | |
| 1344 // Each tile of a layer may be affected differently by a transform; Check | |
| 1345 // that ComputeTilePriorityRects correctly accounts for the transform between | |
| 1346 // layer space and screen space. | |
| 1347 FakePictureLayerTilingClient client; | |
| 1348 | |
| 1349 gfx::Size device_viewport(800, 600); | |
| 1350 gfx::Size last_layer_bounds(200, 200); | |
| 1351 gfx::Size current_layer_bounds(200, 200); | |
| 1352 float current_layer_contents_scale = 1.f; | |
| 1353 gfx::Transform last_screen_transform; | |
| 1354 gfx::Transform current_screen_transform; | |
| 1355 double current_frame_time_in_seconds = 1.0; | |
| 1356 | |
| 1357 // A diagonally rotated layer that is partially off the bottom of the screen. | |
| 1358 // In this configuration, only the top-left tile would be visible. | |
| 1359 current_screen_transform.Translate(600, 750); | |
| 1360 current_screen_transform.RotateAboutZAxis(45); | |
| 1361 last_screen_transform = current_screen_transform; | |
| 1362 | |
| 1363 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | |
| 1364 current_screen_transform, device_viewport); | |
| 1365 | |
| 1366 client.SetTileSize(gfx::Size(100, 100)); | |
| 1367 | |
| 1368 scoped_refptr<FakeRasterSource> raster_source = | |
| 1369 FakeRasterSource::CreateFilled(current_layer_bounds); | |
| 1370 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 1371 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 1372 &client, LayerTreeSettings()); | |
| 1373 tiling->set_resolution(HIGH_RESOLUTION); | |
| 1374 | |
| 1375 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | |
| 1376 current_layer_contents_scale, | |
| 1377 current_frame_time_in_seconds, Occlusion()); | |
| 1378 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 1379 | |
| 1380 ASSERT_TRUE(tiling->TileAt(0, 0)); | |
| 1381 ASSERT_TRUE(tiling->TileAt(0, 1)); | |
| 1382 ASSERT_TRUE(tiling->TileAt(1, 0)); | |
| 1383 ASSERT_TRUE(tiling->TileAt(1, 1)); | |
| 1384 | |
| 1385 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | |
| 1386 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | |
| 1387 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1388 | |
| 1389 priority = prioritized_tiles[tiling->TileAt(0, 1)].priority(); | |
| 1390 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | |
| 1391 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1392 | |
| 1393 priority = prioritized_tiles[tiling->TileAt(1, 0)].priority(); | |
| 1394 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1395 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1396 | |
| 1397 priority = prioritized_tiles[tiling->TileAt(1, 1)].priority(); | |
| 1398 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1399 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1400 | |
| 1401 // Furthermore, in this scenario the bottom-right tile should have the larger | |
| 1402 // distance to visible. | |
| 1403 TilePriority top_left = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | |
| 1404 TilePriority top_right = prioritized_tiles[tiling->TileAt(1, 0)].priority(); | |
| 1405 TilePriority bottom_right = | |
| 1406 prioritized_tiles[tiling->TileAt(1, 1)].priority(); | |
| 1407 EXPECT_GT(top_right.distance_to_visible, top_left.distance_to_visible); | |
| 1408 | |
| 1409 EXPECT_EQ(bottom_right.distance_to_visible, top_right.distance_to_visible); | |
| 1410 } | |
| 1411 | |
| 1412 TEST(ComputeTilePriorityRectsTest, PerspectiveLayer) { | |
| 1413 // Perspective transforms need to take a different code path. | |
| 1414 // This test checks tile priorities of a perspective layer. | |
| 1415 FakePictureLayerTilingClient client; | |
| 1416 | |
| 1417 gfx::Size device_viewport(800, 600); | |
| 1418 gfx::Rect visible_layer_rect(0, 0, 0, 0); // offscreen. | |
| 1419 gfx::Size last_layer_bounds(200, 200); | |
| 1420 gfx::Size current_layer_bounds(200, 200); | |
| 1421 float current_layer_contents_scale = 1.f; | |
| 1422 gfx::Transform last_screen_transform; | |
| 1423 gfx::Transform current_screen_transform; | |
| 1424 double current_frame_time_in_seconds = 1.0; | |
| 1425 | |
| 1426 // A 3d perspective layer rotated about its Y axis, translated to almost | |
| 1427 // fully offscreen. The left side will appear closer (i.e. larger in 2d) than | |
| 1428 // the right side, so the top-left tile will technically be closer than the | |
| 1429 // top-right. | |
| 1430 | |
| 1431 // Translate layer to offscreen | |
| 1432 current_screen_transform.Translate(400.0, 630.0); | |
| 1433 // Apply perspective about the center of the layer | |
| 1434 current_screen_transform.Translate(100.0, 100.0); | |
| 1435 current_screen_transform.ApplyPerspectiveDepth(100.0); | |
| 1436 current_screen_transform.RotateAboutYAxis(10.0); | |
| 1437 current_screen_transform.Translate(-100.0, -100.0); | |
| 1438 last_screen_transform = current_screen_transform; | |
| 1439 | |
| 1440 // Sanity check that this transform wouldn't cause w<0 clipping. | |
| 1441 bool clipped; | |
| 1442 MathUtil::MapQuad(current_screen_transform, | |
| 1443 gfx::QuadF(gfx::RectF(0, 0, 200, 200)), | |
| 1444 &clipped); | |
| 1445 ASSERT_FALSE(clipped); | |
| 1446 | |
| 1447 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | |
| 1448 current_screen_transform, device_viewport); | |
| 1449 | |
| 1450 client.SetTileSize(gfx::Size(100, 100)); | |
| 1451 | |
| 1452 scoped_refptr<FakeRasterSource> raster_source = | |
| 1453 FakeRasterSource::CreateFilled(current_layer_bounds); | |
| 1454 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 1455 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 1456 &client, LayerTreeSettings()); | |
| 1457 tiling->set_resolution(HIGH_RESOLUTION); | |
| 1458 | |
| 1459 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | |
| 1460 current_layer_contents_scale, | |
| 1461 current_frame_time_in_seconds, Occlusion()); | |
| 1462 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 1463 | |
| 1464 ASSERT_TRUE(tiling->TileAt(0, 0)); | |
| 1465 ASSERT_TRUE(tiling->TileAt(0, 1)); | |
| 1466 ASSERT_TRUE(tiling->TileAt(1, 0)); | |
| 1467 ASSERT_TRUE(tiling->TileAt(1, 1)); | |
| 1468 | |
| 1469 // All tiles will have a positive distance_to_visible | |
| 1470 // and an infinite time_to_visible. | |
| 1471 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | |
| 1472 EXPECT_FLOAT_EQ(priority.distance_to_visible, 0.f); | |
| 1473 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1474 | |
| 1475 priority = prioritized_tiles[tiling->TileAt(0, 1)].priority(); | |
| 1476 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1477 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1478 | |
| 1479 priority = prioritized_tiles[tiling->TileAt(1, 0)].priority(); | |
| 1480 EXPECT_FLOAT_EQ(priority.distance_to_visible, 0.f); | |
| 1481 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1482 | |
| 1483 priority = prioritized_tiles[tiling->TileAt(1, 1)].priority(); | |
| 1484 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1485 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1486 | |
| 1487 // Furthermore, in this scenario the top-left distance_to_visible | |
| 1488 // will be smallest, followed by top-right. The bottom layers | |
| 1489 // will of course be further than the top layers. | |
| 1490 TilePriority top_left = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | |
| 1491 TilePriority top_right = prioritized_tiles[tiling->TileAt(1, 0)].priority(); | |
| 1492 TilePriority bottom_left = prioritized_tiles[tiling->TileAt(0, 1)].priority(); | |
| 1493 TilePriority bottom_right = | |
| 1494 prioritized_tiles[tiling->TileAt(1, 1)].priority(); | |
| 1495 | |
| 1496 EXPECT_GT(bottom_right.distance_to_visible, top_right.distance_to_visible); | |
| 1497 | |
| 1498 EXPECT_GT(bottom_left.distance_to_visible, top_left.distance_to_visible); | |
| 1499 } | |
| 1500 | |
| 1501 TEST(ComputeTilePriorityRectsTest, PerspectiveLayerClippedByW) { | |
| 1502 // Perspective transforms need to take a different code path. | |
| 1503 // This test checks tile priorities of a perspective layer. | |
| 1504 FakePictureLayerTilingClient client; | |
| 1505 | |
| 1506 gfx::Size device_viewport(800, 600); | |
| 1507 gfx::Size last_layer_bounds(200, 200); | |
| 1508 gfx::Size current_layer_bounds(200, 200); | |
| 1509 float current_layer_contents_scale = 1.f; | |
| 1510 gfx::Transform last_screen_transform; | |
| 1511 gfx::Transform current_screen_transform; | |
| 1512 double current_frame_time_in_seconds = 1.0; | |
| 1513 | |
| 1514 // A 3d perspective layer rotated about its Y axis, translated to almost | |
| 1515 // fully offscreen. The left side will appear closer (i.e. larger in 2d) than | |
| 1516 // the right side, so the top-left tile will technically be closer than the | |
| 1517 // top-right. | |
| 1518 | |
| 1519 // Translate layer to offscreen | |
| 1520 current_screen_transform.Translate(400.0, 970.0); | |
| 1521 // Apply perspective and rotation about the center of the layer | |
| 1522 current_screen_transform.Translate(100.0, 100.0); | |
| 1523 current_screen_transform.ApplyPerspectiveDepth(10.0); | |
| 1524 current_screen_transform.RotateAboutYAxis(10.0); | |
| 1525 current_screen_transform.Translate(-100.0, -100.0); | |
| 1526 last_screen_transform = current_screen_transform; | |
| 1527 | |
| 1528 // Sanity check that this transform does cause w<0 clipping for the left side | |
| 1529 // of the layer, but not the right side. | |
| 1530 bool clipped; | |
| 1531 MathUtil::MapQuad(current_screen_transform, | |
| 1532 gfx::QuadF(gfx::RectF(0, 0, 100, 200)), | |
| 1533 &clipped); | |
| 1534 ASSERT_TRUE(clipped); | |
| 1535 | |
| 1536 MathUtil::MapQuad(current_screen_transform, | |
| 1537 gfx::QuadF(gfx::RectF(100, 0, 100, 200)), | |
| 1538 &clipped); | |
| 1539 ASSERT_FALSE(clipped); | |
| 1540 | |
| 1541 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | |
| 1542 current_screen_transform, device_viewport); | |
| 1543 | |
| 1544 client.SetTileSize(gfx::Size(100, 100)); | |
| 1545 | |
| 1546 scoped_refptr<FakeRasterSource> raster_source = | |
| 1547 FakeRasterSource::CreateFilled(current_layer_bounds); | |
| 1548 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 1549 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 1550 &client, LayerTreeSettings()); | |
| 1551 tiling->set_resolution(HIGH_RESOLUTION); | |
| 1552 | |
| 1553 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | |
| 1554 current_layer_contents_scale, | |
| 1555 current_frame_time_in_seconds, Occlusion()); | |
| 1556 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 1557 | |
| 1558 ASSERT_TRUE(tiling->TileAt(0, 0)); | |
| 1559 ASSERT_TRUE(tiling->TileAt(0, 1)); | 876 ASSERT_TRUE(tiling->TileAt(0, 1)); |
| 1560 ASSERT_TRUE(tiling->TileAt(1, 0)); | 877 ASSERT_TRUE(tiling->TileAt(1, 0)); |
| 1561 ASSERT_TRUE(tiling->TileAt(1, 1)); | 878 ASSERT_TRUE(tiling->TileAt(1, 1)); |
| 1562 | 879 |
| 1563 // Left-side tiles will be clipped by the transform, so we have to assume | |
| 1564 // they are visible just in case. | |
| 1565 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | 880 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); |
| 1566 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | 881 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); |
| 1567 EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin); | 882 EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin); |
| 1568 | 883 |
| 1569 priority = prioritized_tiles[tiling->TileAt(0, 1)].priority(); | 884 priority = prioritized_tiles[tiling->TileAt(0, 1)].priority(); |
| 1570 EXPECT_GT(priority.distance_to_visible, 0.f); | 885 EXPECT_GT(priority.distance_to_visible, 0.f); |
| 1571 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | 886 EXPECT_NE(TilePriority::NOW, priority.priority_bin); |
| 1572 | 887 |
| 1573 // Right-side tiles will have a positive distance_to_visible | |
| 1574 // and an infinite time_to_visible. | |
| 1575 priority = prioritized_tiles[tiling->TileAt(1, 0)].priority(); | |
| 1576 EXPECT_FLOAT_EQ(priority.distance_to_visible, 0.f); | |
| 1577 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1578 | |
| 1579 priority = prioritized_tiles[tiling->TileAt(1, 1)].priority(); | |
| 1580 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1581 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1582 } | |
| 1583 | |
| 1584 TEST(ComputeTilePriorityRectsTest, BasicMotion) { | |
| 1585 // Test that time_to_visible is computed correctly when | |
| 1586 // there is some motion. | |
| 1587 FakePictureLayerTilingClient client; | |
| 1588 | |
| 1589 gfx::Size device_viewport(800, 600); | |
| 1590 gfx::Rect visible_layer_rect(0, 0, 0, 0); | |
| 1591 gfx::Size last_layer_bounds(200, 200); | |
| 1592 gfx::Size current_layer_bounds(200, 200); | |
| 1593 float last_layer_contents_scale = 1.f; | |
| 1594 float current_layer_contents_scale = 1.f; | |
| 1595 gfx::Transform last_screen_transform; | |
| 1596 gfx::Transform current_screen_transform; | |
| 1597 double last_frame_time_in_seconds = 1.0; | |
| 1598 double current_frame_time_in_seconds = 2.0; | |
| 1599 | |
| 1600 // Offscreen layer is coming closer to viewport at 1000 pixels per second. | |
| 1601 current_screen_transform.Translate(1800, 0); | |
| 1602 last_screen_transform.Translate(2800, 0); | |
| 1603 | |
| 1604 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | |
| 1605 current_screen_transform, device_viewport); | |
| 1606 | |
| 1607 client.SetTileSize(gfx::Size(100, 100)); | |
| 1608 LayerTreeSettings settings; | |
| 1609 | |
| 1610 scoped_refptr<FakeRasterSource> raster_source = | |
| 1611 FakeRasterSource::CreateFilled(current_layer_bounds); | |
| 1612 std::unique_ptr<TestablePictureLayerTiling> tiling = | |
| 1613 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 1614 &client, settings); | |
| 1615 tiling->set_resolution(HIGH_RESOLUTION); | |
| 1616 | |
| 1617 // previous ("last") frame | |
| 1618 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | |
| 1619 last_layer_contents_scale, | |
| 1620 last_frame_time_in_seconds, Occlusion()); | |
| 1621 | |
| 1622 // current frame | |
| 1623 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | |
| 1624 current_layer_contents_scale, | |
| 1625 current_frame_time_in_seconds, Occlusion()); | |
| 1626 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 1627 | |
| 1628 ASSERT_TRUE(tiling->TileAt(0, 0)); | |
| 1629 ASSERT_TRUE(tiling->TileAt(0, 1)); | |
| 1630 ASSERT_TRUE(tiling->TileAt(1, 0)); | |
| 1631 ASSERT_TRUE(tiling->TileAt(1, 1)); | |
| 1632 | |
| 1633 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | |
| 1634 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1635 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1636 | |
| 1637 priority = prioritized_tiles[tiling->TileAt(0, 1)].priority(); | |
| 1638 EXPECT_GT(priority.distance_to_visible, 0.f); | |
| 1639 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 1640 | |
| 1641 // time_to_visible for the right hand side layers needs an extra 0.099 | |
| 1642 // seconds because this tile is 99 pixels further away. | |
| 1643 priority = prioritized_tiles[tiling->TileAt(1, 0)].priority(); | 888 priority = prioritized_tiles[tiling->TileAt(1, 0)].priority(); |
| 1644 EXPECT_GT(priority.distance_to_visible, 0.f); | 889 EXPECT_GT(priority.distance_to_visible, 0.f); |
| 1645 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | 890 EXPECT_NE(TilePriority::NOW, priority.priority_bin); |
| 1646 | 891 |
| 1647 priority = prioritized_tiles[tiling->TileAt(1, 1)].priority(); | 892 priority = prioritized_tiles[tiling->TileAt(1, 1)].priority(); |
| 1648 EXPECT_GT(priority.distance_to_visible, 0.f); | 893 EXPECT_GT(priority.distance_to_visible, 0.f); |
| 1649 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | 894 EXPECT_NE(TilePriority::NOW, priority.priority_bin); |
| 1650 } | 895 } |
| 1651 | 896 |
| 1652 TEST(ComputeTilePriorityRectsTest, RotationMotion) { | |
| 1653 // Each tile of a layer may be affected differently by a transform; Check | |
| 1654 // that ComputeTilePriorityRects correctly accounts for the transform between | |
| 1655 // layer space and screen space. | |
| 1656 | |
| 1657 FakePictureLayerTilingClient client; | |
| 1658 std::unique_ptr<TestablePictureLayerTiling> tiling; | |
| 1659 | |
| 1660 gfx::Size device_viewport(800, 600); | |
| 1661 gfx::Rect visible_layer_rect(0, 0, 0, 0); // offscren. | |
| 1662 gfx::Size last_layer_bounds(200, 200); | |
| 1663 gfx::Size current_layer_bounds(200, 200); | |
| 1664 float last_layer_contents_scale = 1.f; | |
| 1665 float current_layer_contents_scale = 1.f; | |
| 1666 gfx::Transform last_screen_transform; | |
| 1667 gfx::Transform current_screen_transform; | |
| 1668 double last_frame_time_in_seconds = 1.0; | |
| 1669 double current_frame_time_in_seconds = 2.0; | |
| 1670 | |
| 1671 // Rotation motion is set up specifically so that: | |
| 1672 // - rotation occurs about the center of the layer | |
| 1673 // - the top-left tile becomes visible on rotation | |
| 1674 // - the top-right tile will have an infinite time_to_visible | |
| 1675 // because it is rotating away from viewport. | |
| 1676 // - bottom-left layer will have a positive non-zero time_to_visible | |
| 1677 // because it is rotating toward the viewport. | |
| 1678 current_screen_transform.Translate(400, 550); | |
| 1679 current_screen_transform.RotateAboutZAxis(45); | |
| 1680 | |
| 1681 last_screen_transform.Translate(400, 550); | |
| 1682 | |
| 1683 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( | |
| 1684 current_screen_transform, device_viewport); | |
| 1685 | |
| 1686 client.SetTileSize(gfx::Size(100, 100)); | |
| 1687 | |
| 1688 scoped_refptr<FakeRasterSource> raster_source = | |
| 1689 FakeRasterSource::CreateFilled(current_layer_bounds); | |
| 1690 tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 1691 &client, LayerTreeSettings()); | |
| 1692 tiling->set_resolution(HIGH_RESOLUTION); | |
| 1693 | |
| 1694 // previous ("last") frame | |
| 1695 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | |
| 1696 last_layer_contents_scale, | |
| 1697 last_frame_time_in_seconds, Occlusion()); | |
| 1698 | |
| 1699 // current frame | |
| 1700 tiling->ComputeTilePriorityRects(viewport_in_layer_space, | |
| 1701 current_layer_contents_scale, | |
| 1702 current_frame_time_in_seconds, Occlusion()); | |
| 1703 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | |
| 1704 | |
| 1705 ASSERT_TRUE(tiling->TileAt(0, 0)); | |
| 1706 ASSERT_TRUE(tiling->TileAt(0, 1)); | |
| 1707 ASSERT_TRUE(tiling->TileAt(1, 0)); | |
| 1708 ASSERT_TRUE(tiling->TileAt(1, 1)); | |
| 1709 | |
| 1710 TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority(); | |
| 1711 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | |
| 1712 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1713 | |
| 1714 priority = prioritized_tiles[tiling->TileAt(0, 1)].priority(); | |
| 1715 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | |
| 1716 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1717 | |
| 1718 priority = prioritized_tiles[tiling->TileAt(1, 0)].priority(); | |
| 1719 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | |
| 1720 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 1721 } | |
| 1722 | |
| 1723 TEST(PictureLayerTilingTest, RecycledTilesCleared) { | |
| 1724 // This test performs the following: | |
| 1725 // Setup: | |
| 1726 // - Two tilings, one active one recycled with all tiles shared. | |
| 1727 // Procedure: | |
| 1728 // - Viewport moves somewhere far away and active tiling clears tiles. | |
| 1729 // - Viewport moves back and a new active tiling tile is created. | |
| 1730 // Result: | |
| 1731 // - Recycle tiling does _not_ have the tile in the same location (thus it | |
| 1732 // will be shared next time a pending tiling is created). | |
| 1733 | |
| 1734 FakePictureLayerTilingClient active_client; | |
| 1735 | |
| 1736 active_client.SetTileSize(gfx::Size(100, 100)); | |
| 1737 LayerTreeSettings settings; | |
| 1738 | |
| 1739 scoped_refptr<FakeRasterSource> raster_source = | |
| 1740 FakeRasterSource::CreateFilled(gfx::Size(10000, 10000)); | |
| 1741 std::unique_ptr<TestablePictureLayerTiling> active_tiling = | |
| 1742 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | |
| 1743 &active_client, settings); | |
| 1744 active_tiling->set_resolution(HIGH_RESOLUTION); | |
| 1745 // Create all tiles on this tiling. | |
| 1746 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, | |
| 1747 Occlusion()); | |
| 1748 | |
| 1749 FakePictureLayerTilingClient recycle_client; | |
| 1750 recycle_client.SetTileSize(gfx::Size(100, 100)); | |
| 1751 recycle_client.set_twin_tiling(active_tiling.get()); | |
| 1752 | |
| 1753 raster_source = FakeRasterSource::CreateFilled(gfx::Size(10000, 10000)); | |
| 1754 std::unique_ptr<TestablePictureLayerTiling> recycle_tiling = | |
| 1755 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, | |
| 1756 &recycle_client, settings); | |
| 1757 recycle_tiling->set_resolution(HIGH_RESOLUTION); | |
| 1758 | |
| 1759 // Create all tiles on the second tiling. All tiles should be shared. | |
| 1760 recycle_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, | |
| 1761 1.0f, Occlusion()); | |
| 1762 | |
| 1763 // Set the second tiling as recycled. | |
| 1764 active_client.set_twin_tiling(NULL); | |
| 1765 recycle_client.set_twin_tiling(NULL); | |
| 1766 | |
| 1767 EXPECT_TRUE(active_tiling->TileAt(0, 0)); | |
| 1768 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | |
| 1769 | |
| 1770 // Move the viewport far away from the (0, 0) tile. | |
| 1771 active_tiling->ComputeTilePriorityRects(gfx::Rect(9000, 9000, 100, 100), 1.0f, | |
| 1772 2.0, Occlusion()); | |
| 1773 // Ensure the tile was deleted. | |
| 1774 EXPECT_FALSE(active_tiling->TileAt(0, 0)); | |
| 1775 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | |
| 1776 | |
| 1777 // Move the viewport back to (0, 0) tile. | |
| 1778 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 3.0, | |
| 1779 Occlusion()); | |
| 1780 | |
| 1781 // Ensure that we now have a tile here on both active. | |
| 1782 EXPECT_TRUE(active_tiling->TileAt(0, 0)); | |
| 1783 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | |
| 1784 } | |
| 1785 | |
| 1786 TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { | 897 TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { |
| 1787 FakePictureLayerTilingClient active_client; | 898 FakePictureLayerTilingClient active_client; |
| 1788 active_client.SetTileSize(gfx::Size(100, 100)); | 899 active_client.SetTileSize(gfx::Size(100, 100)); |
| 1789 | 900 |
| 1790 scoped_refptr<FakeRasterSource> raster_source = | 901 scoped_refptr<FakeRasterSource> raster_source = |
| 1791 FakeRasterSource::CreateFilled(gfx::Size(100, 100)); | 902 FakeRasterSource::CreateFilled(gfx::Size(100, 100)); |
| 1792 std::unique_ptr<TestablePictureLayerTiling> active_tiling = | 903 std::unique_ptr<TestablePictureLayerTiling> active_tiling = |
| 1793 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, | 904 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, |
| 1794 &active_client, LayerTreeSettings()); | 905 &active_client, LayerTreeSettings()); |
| 1795 active_tiling->set_resolution(HIGH_RESOLUTION); | 906 active_tiling->set_resolution(HIGH_RESOLUTION); |
| 1796 // Create all tiles on this tiling. | 907 // Create all tiles on this tiling. |
| 1797 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, | 908 gfx::Rect visible_rect = gfx::Rect(0, 0, 100, 100); |
| 1798 Occlusion()); | 909 active_tiling->ComputeTilePriorityRects( |
| 910 visible_rect, visible_rect, visible_rect, visible_rect, 1.f, Occlusion()); |
| 1799 | 911 |
| 1800 FakePictureLayerTilingClient recycle_client; | 912 FakePictureLayerTilingClient recycle_client; |
| 1801 recycle_client.SetTileSize(gfx::Size(100, 100)); | 913 recycle_client.SetTileSize(gfx::Size(100, 100)); |
| 1802 recycle_client.set_twin_tiling(active_tiling.get()); | 914 recycle_client.set_twin_tiling(active_tiling.get()); |
| 1803 | 915 |
| 1804 LayerTreeSettings settings; | 916 LayerTreeSettings settings; |
| 1805 | 917 |
| 1806 raster_source = FakeRasterSource::CreateFilled(gfx::Size(100, 100)); | 918 raster_source = FakeRasterSource::CreateFilled(gfx::Size(100, 100)); |
| 1807 std::unique_ptr<TestablePictureLayerTiling> recycle_tiling = | 919 std::unique_ptr<TestablePictureLayerTiling> recycle_tiling = |
| 1808 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, | 920 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, |
| 1809 &recycle_client, settings); | 921 &recycle_client, settings); |
| 1810 recycle_tiling->set_resolution(HIGH_RESOLUTION); | 922 recycle_tiling->set_resolution(HIGH_RESOLUTION); |
| 1811 | 923 |
| 1812 // Create all tiles on the recycle tiling. All tiles should be shared. | 924 // Create all tiles on the recycle tiling. |
| 1813 recycle_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, | 925 recycle_tiling->ComputeTilePriorityRects(visible_rect, visible_rect, |
| 1814 1.0f, Occlusion()); | 926 visible_rect, visible_rect, 1.0f, |
| 927 Occlusion()); |
| 1815 | 928 |
| 1816 // Set the second tiling as recycled. | 929 // Set the second tiling as recycled. |
| 1817 active_client.set_twin_tiling(NULL); | 930 active_client.set_twin_tiling(NULL); |
| 1818 recycle_client.set_twin_tiling(NULL); | 931 recycle_client.set_twin_tiling(NULL); |
| 1819 | 932 |
| 1820 EXPECT_TRUE(active_tiling->TileAt(0, 0)); | 933 EXPECT_TRUE(active_tiling->TileAt(0, 0)); |
| 1821 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 934 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| 1822 | 935 |
| 1823 // Reset the active tiling. The recycle tiles should be released too. | 936 // Reset the active tiling. The recycle tiles should be released too. |
| 1824 active_tiling->Reset(); | 937 active_tiling->Reset(); |
| 1825 EXPECT_FALSE(active_tiling->TileAt(0, 0)); | 938 EXPECT_FALSE(active_tiling->TileAt(0, 0)); |
| 1826 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 939 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| 1827 } | 940 } |
| 1828 | 941 |
| 1829 TEST(PictureLayerTilingTest, InvalidateAfterComputeTilePriorityRects) { | |
| 1830 FakePictureLayerTilingClient pending_client; | |
| 1831 pending_client.SetTileSize(gfx::Size(100, 100)); | |
| 1832 | |
| 1833 scoped_refptr<FakeRasterSource> raster_source = | |
| 1834 FakeRasterSource::CreateFilled(gfx::Size(100, 100)); | |
| 1835 std::unique_ptr<TestablePictureLayerTiling> pending_tiling = | |
| 1836 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, | |
| 1837 &pending_client, LayerTreeSettings()); | |
| 1838 pending_tiling->set_resolution(HIGH_RESOLUTION); | |
| 1839 | |
| 1840 // Ensure that we can compute tile priority rects, invalidate, and compute the | |
| 1841 // rects again. It is important that the second compute tile priority rects | |
| 1842 // return true, indicating that things have changed (since invalidation has | |
| 1843 // changed things). This causes PrepareTiles to be properly scheduled. If the | |
| 1844 // second ComputeTilePriorityRects returns false, then we assume that | |
| 1845 // PrepareTiles isn't needed and we signal that we're ready to draw | |
| 1846 // immediately, which can cause visual glitches. | |
| 1847 // | |
| 1848 // This can happen we if we process an impl frame deadline before processing a | |
| 1849 // commit. That is, when we draw we ComputeTilePriorityRects. If we process | |
| 1850 // the commit afterwards, it would use the same timestamp and sometimes would | |
| 1851 // use the same viewport to compute tile priority rects again. | |
| 1852 double time = 1.; | |
| 1853 gfx::Rect viewport(0, 0, 100, 100); | |
| 1854 EXPECT_TRUE(pending_tiling->ComputeTilePriorityRects(viewport, 1.0f, time, | |
| 1855 Occlusion())); | |
| 1856 pending_tiling->Invalidate(viewport); | |
| 1857 EXPECT_TRUE(pending_tiling->ComputeTilePriorityRects(viewport, 1.0f, time, | |
| 1858 Occlusion())); | |
| 1859 } | |
| 1860 | |
| 1861 TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) { | 942 TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) { |
| 1862 // The tiling has four rows and three columns. | 943 // The tiling has four rows and three columns. |
| 1863 Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150)); | 944 Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150)); |
| 1864 tiling_->CreateAllTilesForTesting(); | 945 tiling_->CreateAllTilesForTesting(); |
| 1865 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width()); | 946 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width()); |
| 1866 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); | 947 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); |
| 1867 EXPECT_EQ(4u, tiling_->AllTilesForTesting().size()); | 948 EXPECT_EQ(4u, tiling_->AllTilesForTesting().size()); |
| 1868 | 949 |
| 1869 client_.SetTileSize(gfx::Size(250, 200)); | 950 client_.SetTileSize(gfx::Size(250, 200)); |
| 1870 | 951 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1895 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale, | 976 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale, |
| 1896 raster_source, &client_, | 977 raster_source, &client_, |
| 1897 LayerTreeSettings()); | 978 LayerTreeSettings()); |
| 1898 | 979 |
| 1899 gfx::Rect content_rect(25554432, 25554432, 950, 860); | 980 gfx::Rect content_rect(25554432, 25554432, 950, 860); |
| 1900 VerifyTilesExactlyCoverRect(contents_scale, content_rect); | 981 VerifyTilesExactlyCoverRect(contents_scale, content_rect); |
| 1901 } | 982 } |
| 1902 | 983 |
| 1903 } // namespace | 984 } // namespace |
| 1904 } // namespace cc | 985 } // namespace cc |
| OLD | NEW |