Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: cc/tiles/picture_layer_tiling_unittest.cc

Issue 1314943008: cc: Remove implicit conversions from Rect to RectF in src/cc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <limits> 5 #include <limits>
6 #include <set> 6 #include <set>
7 7
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 // for instance begins at (8, 16) pixels. So tile at (46, 46) will begin at 800 // for instance begins at (8, 16) pixels. So tile at (46, 46) will begin at
801 // (368, 368) and extend to the end of 1500 * 0.25 = 375 edge of the 801 // (368, 368) and extend to the end of 1500 * 0.25 = 375 edge of the
802 // tiling. 802 // tiling.
803 scoped_refptr<FakePicturePileImpl> pile = 803 scoped_refptr<FakePicturePileImpl> pile =
804 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); 804 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
805 scoped_ptr<TestablePictureLayerTiling> tiling = 805 scoped_ptr<TestablePictureLayerTiling> tiling =
806 TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.25f, pile, &client, 806 TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.25f, pile, &client,
807 settings); 807 settings);
808 tiling->set_resolution(HIGH_RESOLUTION); 808 tiling->set_resolution(HIGH_RESOLUTION);
809 gfx::Rect viewport_in_content_space = 809 gfx::Rect viewport_in_content_space =
810 gfx::ToEnclosedRect(gfx::ScaleRect(viewport, 0.25f)); 810 gfx::ScaleToEnclosedRect(viewport, 0.25f);
811 811
812 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); 812 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion());
813 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); 813 auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting();
814 814
815 // Compute the soon border. 815 // Compute the soon border.
816 float inset = PictureLayerTiling::CalculateSoonBorderDistance( 816 float inset = PictureLayerTiling::CalculateSoonBorderDistance(
817 viewport_in_content_space, 1.0f / 0.25f); 817 viewport_in_content_space, 1.0f / 0.25f);
818 gfx::Rect soon_rect_in_content_space = viewport_in_content_space; 818 gfx::Rect soon_rect_in_content_space = viewport_in_content_space;
819 soon_rect_in_content_space.Inset(-inset, -inset); 819 soon_rect_in_content_space.Inset(-inset, -inset);
820 820
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible); 875 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible);
876 876
877 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority(); 877 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority();
878 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible); 878 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible);
879 879
880 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority(); 880 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority();
881 EXPECT_FLOAT_EQ(40.f, priority.distance_to_visible); 881 EXPECT_FLOAT_EQ(40.f, priority.distance_to_visible);
882 882
883 // Move the viewport down 40 pixels. 883 // Move the viewport down 40 pixels.
884 viewport = gfx::Rect(0, 40, 100, 100); 884 viewport = gfx::Rect(0, 40, 100, 100);
885 viewport_in_content_space = 885 viewport_in_content_space = gfx::ScaleToEnclosedRect(viewport, 0.25f);
886 gfx::ToEnclosedRect(gfx::ScaleRect(viewport, 0.25f));
887 gfx::Rect skewport = tiling->ComputeSkewport(2.0, viewport_in_content_space); 886 gfx::Rect skewport = tiling->ComputeSkewport(2.0, viewport_in_content_space);
888 887
889 // Compute the soon border. 888 // Compute the soon border.
890 inset = PictureLayerTiling::CalculateSoonBorderDistance( 889 inset = PictureLayerTiling::CalculateSoonBorderDistance(
891 viewport_in_content_space, 1.0f / 0.25f); 890 viewport_in_content_space, 1.0f / 0.25f);
892 soon_rect_in_content_space = viewport_in_content_space; 891 soon_rect_in_content_space = viewport_in_content_space;
893 soon_rect_in_content_space.Inset(-inset, -inset); 892 soon_rect_in_content_space.Inset(-inset, -inset);
894 893
895 EXPECT_EQ(0, skewport.x()); 894 EXPECT_EQ(0, skewport.x());
896 EXPECT_EQ(10, skewport.y()); 895 EXPECT_EQ(10, skewport.y());
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 FakePicturePileImpl::CreatePile(tile_size, layer_size, filled); 1800 FakePicturePileImpl::CreatePile(tile_size, layer_size, filled);
1802 tiling_ = TestablePictureLayerTiling::Create( 1801 tiling_ = TestablePictureLayerTiling::Create(
1803 PENDING_TREE, contents_scale, pile, &client_, LayerTreeSettings()); 1802 PENDING_TREE, contents_scale, pile, &client_, LayerTreeSettings());
1804 1803
1805 gfx::Rect content_rect(25554432, 25554432, 950, 860); 1804 gfx::Rect content_rect(25554432, 25554432, 950, 860);
1806 VerifyTilesExactlyCoverRect(contents_scale, content_rect); 1805 VerifyTilesExactlyCoverRect(contents_scale, content_rect);
1807 } 1806 }
1808 1807
1809 } // namespace 1808 } // namespace
1810 } // namespace cc 1809 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698