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

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

Issue 2564433003: Add PictureLayerTiling pointer to Tile (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | cc/tiles/tile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 1055
1056 TEST_F(PictureLayerTilingIteratorTest, TightCover2) { 1056 TEST_F(PictureLayerTilingIteratorTest, TightCover2) {
1057 // In this test, the left edge of tile #38 almost (but failed to) covered 1057 // In this test, the left edge of tile #38 almost (but failed to) covered
1058 // grid line x = 9653. Tile #37 needs to reach hard to x = 9654 to make up 1058 // grid line x = 9653. Tile #37 needs to reach hard to x = 9654 to make up
1059 // for this. 1059 // for this.
1060 Initialize(gfx::Size(256, 256), 1.f, gfx::Size(10000, 1)); 1060 Initialize(gfx::Size(256, 256), 1.f, gfx::Size(10000, 1));
1061 float dest_scale = 16778088.f / 16777216.f; // 0b1.00000000 00000011 01101000 1061 float dest_scale = 16778088.f / 16777216.f; // 0b1.00000000 00000011 01101000
1062 VerifyTilesExactlyCoverRect(dest_scale, gfx::Rect(10001, 2)); 1062 VerifyTilesExactlyCoverRect(dest_scale, gfx::Rect(10001, 2));
1063 } 1063 }
1064 1064
1065 TEST_F(PictureLayerTilingIteratorTest, TilesStoreTilings) {
1066 gfx::Size bounds(200, 200);
1067 Initialize(gfx::Size(100, 100), 1.f, bounds);
1068 SetLiveRectAndVerifyTiles(gfx::Rect(bounds));
1069
1070 // Get all tiles and ensure they are associated with |tiling_|.
1071 std::vector<Tile*> tiles = tiling_->AllTilesForTesting();
1072 EXPECT_TRUE(tiles.size());
1073 for (const auto* tile : tiles) {
1074 EXPECT_EQ(tile->tiling(), tiling_.get());
1075 }
1076
1077 // Create an active tiling, transfer tiles to that tiling, and ensure that
1078 // the tiles have their tiling updated.
1079 scoped_refptr<FakeRasterSource> raster_source =
1080 FakeRasterSource::CreateFilled(bounds);
1081 auto active_tiling = TestablePictureLayerTiling::Create(
1082 ACTIVE_TREE, 1.f, raster_source, &client_, LayerTreeSettings());
1083 active_tiling->set_resolution(HIGH_RESOLUTION);
1084
1085 active_tiling->TakeTilesAndPropertiesFrom(tiling_.get(),
1086 Region(gfx::Rect(bounds)));
1087 for (const auto* tile : tiles) {
1088 EXPECT_EQ(tile->tiling(), active_tiling.get());
1089 }
1090 }
1091
1065 } // namespace 1092 } // namespace
1066 } // namespace cc 1093 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | cc/tiles/tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698