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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 226283004: Rasterize at maximum scale for scale animations on CPU-rasterized layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 iter; 147 iter;
148 ++iter) { 148 ++iter) {
149 EXPECT_TRUE(*iter); 149 EXPECT_TRUE(*iter);
150 EXPECT_EQ(pile, iter->picture_pile()); 150 EXPECT_EQ(pile, iter->picture_pile());
151 } 151 }
152 } 152 }
153 153
154 void SetContentsScaleOnBothLayers(float contents_scale, 154 void SetContentsScaleOnBothLayers(float contents_scale,
155 float device_scale_factor, 155 float device_scale_factor,
156 float page_scale_factor, 156 float page_scale_factor,
157 float maximum_animation_scale_factor,
157 bool animating_transform) { 158 bool animating_transform) {
158 float result_scale_x, result_scale_y; 159 float result_scale_x, result_scale_y;
159 gfx::Size result_bounds; 160 gfx::Size result_bounds;
160 pending_layer_->CalculateContentsScale( 161 pending_layer_->CalculateContentsScale(contents_scale,
161 contents_scale, 162 device_scale_factor,
162 device_scale_factor, 163 page_scale_factor,
163 page_scale_factor, 164 maximum_animation_scale_factor,
164 animating_transform, 165 animating_transform,
165 &result_scale_x, 166 &result_scale_x,
166 &result_scale_y, 167 &result_scale_y,
167 &result_bounds); 168 &result_bounds);
168 active_layer_->CalculateContentsScale( 169 active_layer_->CalculateContentsScale(contents_scale,
169 contents_scale, 170 device_scale_factor,
170 device_scale_factor, 171 page_scale_factor,
171 page_scale_factor, 172 maximum_animation_scale_factor,
172 animating_transform, 173 animating_transform,
173 &result_scale_x, 174 &result_scale_x,
174 &result_scale_y, 175 &result_scale_y,
175 &result_bounds); 176 &result_bounds);
176 } 177 }
177 178
178 void ResetTilingsAndRasterScales() { 179 void ResetTilingsAndRasterScales() {
179 pending_layer_->ReleaseResources(); 180 pending_layer_->ReleaseResources();
180 active_layer_->ReleaseResources(); 181 active_layer_->ReleaseResources();
181 } 182 }
182 183
183 void AssertAllTilesRequired(PictureLayerTiling* tiling) { 184 void AssertAllTilesRequired(PictureLayerTiling* tiling) {
184 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); 185 std::vector<Tile*> tiles = tiling->AllTilesForTesting();
185 for (size_t i = 0; i < tiles.size(); ++i) 186 for (size_t i = 0; i < tiles.size(); ++i)
(...skipping 18 matching lines...) Expand all
204 205
205 scoped_refptr<FakePicturePileImpl> pending_pile = 206 scoped_refptr<FakePicturePileImpl> pending_pile =
206 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size); 207 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size);
207 scoped_refptr<FakePicturePileImpl> active_pile = 208 scoped_refptr<FakePicturePileImpl> active_pile =
208 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size); 209 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size);
209 210
210 SetupTrees(pending_pile, active_pile); 211 SetupTrees(pending_pile, active_pile);
211 212
212 float result_scale_x, result_scale_y; 213 float result_scale_x, result_scale_y;
213 gfx::Size result_bounds; 214 gfx::Size result_bounds;
214 active_layer_->CalculateContentsScale( 215 active_layer_->CalculateContentsScale(1.f,
215 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 216 1.f,
217 1.f,
218 1.f,
219 false,
220 &result_scale_x,
221 &result_scale_y,
222 &result_bounds);
216 223
217 // Add 1x1 rects at the centers of each tile, then re-record pile contents 224 // Add 1x1 rects at the centers of each tile, then re-record pile contents
218 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 225 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
219 std::vector<Tile*> tiles = 226 std::vector<Tile*> tiles =
220 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); 227 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting();
221 EXPECT_EQ(16u, tiles.size()); 228 EXPECT_EQ(16u, tiles.size());
222 std::vector<SkRect> rects; 229 std::vector<SkRect> rects;
223 std::vector<Tile*>::const_iterator tile_iter; 230 std::vector<Tile*>::const_iterator tile_iter;
224 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { 231 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) {
225 gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint(); 232 gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); 313 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers);
307 EXPECT_EQ(0u, paired_layers.size()); 314 EXPECT_EQ(0u, paired_layers.size());
308 315
309 // Update tile priorities will force the layer to register itself. 316 // Update tile priorities will force the layer to register itself.
310 float dummy_contents_scale_x; 317 float dummy_contents_scale_x;
311 float dummy_contents_scale_y; 318 float dummy_contents_scale_y;
312 gfx::Size dummy_content_bounds; 319 gfx::Size dummy_content_bounds;
313 active_layer_->CalculateContentsScale(1.f, 320 active_layer_->CalculateContentsScale(1.f,
314 1.f, 321 1.f,
315 1.f, 322 1.f,
323 1.f,
316 false, 324 false,
317 &dummy_contents_scale_x, 325 &dummy_contents_scale_x,
318 &dummy_contents_scale_y, 326 &dummy_contents_scale_y,
319 &dummy_content_bounds); 327 &dummy_content_bounds);
320 active_layer_->UpdateTilePriorities(); 328 active_layer_->UpdateTilePriorities();
321 host_impl_.pending_tree()->UpdateDrawProperties(); 329 host_impl_.pending_tree()->UpdateDrawProperties();
322 pending_layer_->CalculateContentsScale(1.f, 330 pending_layer_->CalculateContentsScale(1.f,
323 1.f, 331 1.f,
324 1.f, 332 1.f,
333 1.f,
325 false, 334 false,
326 &dummy_contents_scale_x, 335 &dummy_contents_scale_x,
327 &dummy_contents_scale_y, 336 &dummy_contents_scale_y,
328 &dummy_content_bounds); 337 &dummy_content_bounds);
329 pending_layer_->UpdateTilePriorities(); 338 pending_layer_->UpdateTilePriorities();
330 339
331 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); 340 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers);
332 EXPECT_EQ(1u, paired_layers.size()); 341 EXPECT_EQ(1u, paired_layers.size());
333 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); 342 EXPECT_EQ(active_layer_, paired_layers[0].active_layer);
334 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); 343 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer);
335 344
336 // Destroy and recreate tile manager. 345 // Destroy and recreate tile manager.
337 host_impl_.DidLoseOutputSurface(); 346 host_impl_.DidLoseOutputSurface();
338 scoped_ptr<TestWebGraphicsContext3D> context = 347 scoped_ptr<TestWebGraphicsContext3D> context =
339 TestWebGraphicsContext3D::Create(); 348 TestWebGraphicsContext3D::Create();
340 host_impl_.InitializeRenderer( 349 host_impl_.InitializeRenderer(
341 FakeOutputSurface::Create3d(context.Pass()).PassAs<OutputSurface>()); 350 FakeOutputSurface::Create3d(context.Pass()).PassAs<OutputSurface>());
342 351
343 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); 352 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers);
344 EXPECT_EQ(0u, paired_layers.size()); 353 EXPECT_EQ(0u, paired_layers.size());
345 354
346 active_layer_->CalculateContentsScale(1.f, 355 active_layer_->CalculateContentsScale(1.f,
347 1.f, 356 1.f,
348 1.f, 357 1.f,
358 1.f,
349 false, 359 false,
350 &dummy_contents_scale_x, 360 &dummy_contents_scale_x,
351 &dummy_contents_scale_y, 361 &dummy_contents_scale_y,
352 &dummy_content_bounds); 362 &dummy_content_bounds);
353 active_layer_->UpdateTilePriorities(); 363 active_layer_->UpdateTilePriorities();
354 host_impl_.pending_tree()->UpdateDrawProperties(); 364 host_impl_.pending_tree()->UpdateDrawProperties();
355 pending_layer_->CalculateContentsScale(1.f, 365 pending_layer_->CalculateContentsScale(1.f,
356 1.f, 366 1.f,
357 1.f, 367 1.f,
368 1.f,
358 false, 369 false,
359 &dummy_contents_scale_x, 370 &dummy_contents_scale_x,
360 &dummy_contents_scale_y, 371 &dummy_contents_scale_y,
361 &dummy_content_bounds); 372 &dummy_content_bounds);
362 pending_layer_->UpdateTilePriorities(); 373 pending_layer_->UpdateTilePriorities();
363 374
364 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); 375 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers);
365 EXPECT_EQ(1u, paired_layers.size()); 376 EXPECT_EQ(1u, paired_layers.size());
366 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); 377 EXPECT_EQ(active_layer_, paired_layers[0].active_layer);
367 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); 378 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer);
(...skipping 14 matching lines...) Expand all
382 SetupTrees(pending_pile, active_pile); 393 SetupTrees(pending_pile, active_pile);
383 394
384 Region invalidation; 395 Region invalidation;
385 AddDefaultTilingsWithInvalidation(invalidation); 396 AddDefaultTilingsWithInvalidation(invalidation);
386 float dummy_contents_scale_x; 397 float dummy_contents_scale_x;
387 float dummy_contents_scale_y; 398 float dummy_contents_scale_y;
388 gfx::Size dummy_content_bounds; 399 gfx::Size dummy_content_bounds;
389 active_layer_->CalculateContentsScale(1.f, 400 active_layer_->CalculateContentsScale(1.f,
390 1.f, 401 1.f,
391 1.f, 402 1.f,
403 1.f,
392 false, 404 false,
393 &dummy_contents_scale_x, 405 &dummy_contents_scale_x,
394 &dummy_contents_scale_y, 406 &dummy_contents_scale_y,
395 &dummy_content_bounds); 407 &dummy_content_bounds);
396 408
397 EXPECT_TRUE(host_impl_.manage_tiles_needed()); 409 EXPECT_TRUE(host_impl_.manage_tiles_needed());
398 active_layer_->UpdateTilePriorities(); 410 active_layer_->UpdateTilePriorities();
399 host_impl_.ManageTiles(); 411 host_impl_.ManageTiles();
400 EXPECT_FALSE(host_impl_.manage_tiles_needed()); 412 EXPECT_FALSE(host_impl_.manage_tiles_needed());
401 413
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 scoped_refptr<FakePicturePileImpl> pending_pile = 606 scoped_refptr<FakePicturePileImpl> pending_pile =
595 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); 607 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
596 scoped_refptr<FakePicturePileImpl> active_pile = 608 scoped_refptr<FakePicturePileImpl> active_pile =
597 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); 609 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
598 610
599 float result_scale_x, result_scale_y; 611 float result_scale_x, result_scale_y;
600 gfx::Size result_bounds; 612 gfx::Size result_bounds;
601 613
602 SetupTrees(pending_pile, active_pile); 614 SetupTrees(pending_pile, active_pile);
603 615
604 pending_layer_->CalculateContentsScale( 616 pending_layer_->CalculateContentsScale(1.f,
605 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 617 1.f,
618 1.f,
619 1.f,
620 false,
621 &result_scale_x,
622 &result_scale_y,
623 &result_bounds);
606 624
607 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 625 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
608 } 626 }
609 627
610 TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) { 628 TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
611 gfx::Size tile_size(400, 400); 629 gfx::Size tile_size(400, 400);
612 gfx::Size layer_bounds(1300, 1900); 630 gfx::Size layer_bounds(1300, 1900);
613 631
614 scoped_refptr<FakePicturePileImpl> pending_pile = 632 scoped_refptr<FakePicturePileImpl> pending_pile =
615 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 633 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
616 scoped_refptr<FakePicturePileImpl> active_pile = 634 scoped_refptr<FakePicturePileImpl> active_pile =
617 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 635 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
618 636
619 float result_scale_x, result_scale_y; 637 float result_scale_x, result_scale_y;
620 gfx::Size result_bounds; 638 gfx::Size result_bounds;
621 639
622 SetupTrees(pending_pile, active_pile); 640 SetupTrees(pending_pile, active_pile);
623 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 641 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
624 642
625 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 643 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
626 EXPECT_LT(low_res_factor, 1.f); 644 EXPECT_LT(low_res_factor, 1.f);
627 645
628 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale 646 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale
629 1.7f, // device scale 647 1.7f, // device scale
630 3.2f, // page cale 648 3.2f, // page scale
649 1.f, // maximum animation scale
631 false, 650 false,
632 &result_scale_x, 651 &result_scale_x,
633 &result_scale_y, 652 &result_scale_y,
634 &result_bounds); 653 &result_bounds);
635 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 654 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
636 EXPECT_FLOAT_EQ( 655 EXPECT_FLOAT_EQ(
637 1.3f, 656 1.3f,
638 pending_layer_->tilings()->tiling_at(0)->contents_scale()); 657 pending_layer_->tilings()->tiling_at(0)->contents_scale());
639 EXPECT_FLOAT_EQ( 658 EXPECT_FLOAT_EQ(
640 1.3f * low_res_factor, 659 1.3f * low_res_factor,
641 pending_layer_->tilings()->tiling_at(1)->contents_scale()); 660 pending_layer_->tilings()->tiling_at(1)->contents_scale());
642 661
643 // If we change the layer's CSS scale factor, then we should not get new 662 // If we change the layer's CSS scale factor, then we should not get new
644 // tilings. 663 // tilings.
645 pending_layer_->CalculateContentsScale(1.8f, // ideal contents scale 664 pending_layer_->CalculateContentsScale(1.8f, // ideal contents scale
646 1.7f, // device scale 665 1.7f, // device scale
647 3.2f, // page cale 666 3.2f, // page scale
667 1.f, // maximum animation scale
648 false, 668 false,
649 &result_scale_x, 669 &result_scale_x,
650 &result_scale_y, 670 &result_scale_y,
651 &result_bounds); 671 &result_bounds);
652 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 672 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
653 EXPECT_FLOAT_EQ( 673 EXPECT_FLOAT_EQ(
654 1.3f, 674 1.3f,
655 pending_layer_->tilings()->tiling_at(0)->contents_scale()); 675 pending_layer_->tilings()->tiling_at(0)->contents_scale());
656 EXPECT_FLOAT_EQ( 676 EXPECT_FLOAT_EQ(
657 1.3f * low_res_factor, 677 1.3f * low_res_factor,
658 pending_layer_->tilings()->tiling_at(1)->contents_scale()); 678 pending_layer_->tilings()->tiling_at(1)->contents_scale());
659 679
660 // If we change the page scale factor, then we should get new tilings. 680 // If we change the page scale factor, then we should get new tilings.
661 pending_layer_->CalculateContentsScale(1.8f, // ideal contents scale 681 pending_layer_->CalculateContentsScale(1.8f, // ideal contents scale
662 1.7f, // device scale 682 1.7f, // device scale
663 2.2f, // page cale 683 2.2f, // page scale
684 1.f, // maximum animation scale
664 false, 685 false,
665 &result_scale_x, 686 &result_scale_x,
666 &result_scale_y, 687 &result_scale_y,
667 &result_bounds); 688 &result_bounds);
668 ASSERT_EQ(4u, pending_layer_->tilings()->num_tilings()); 689 ASSERT_EQ(4u, pending_layer_->tilings()->num_tilings());
669 EXPECT_FLOAT_EQ( 690 EXPECT_FLOAT_EQ(
670 1.8f, 691 1.8f,
671 pending_layer_->tilings()->tiling_at(0)->contents_scale()); 692 pending_layer_->tilings()->tiling_at(0)->contents_scale());
672 EXPECT_FLOAT_EQ( 693 EXPECT_FLOAT_EQ(
673 1.8f * low_res_factor, 694 1.8f * low_res_factor,
674 pending_layer_->tilings()->tiling_at(2)->contents_scale()); 695 pending_layer_->tilings()->tiling_at(2)->contents_scale());
675 696
676 // If we change the device scale factor, then we should get new tilings. 697 // If we change the device scale factor, then we should get new tilings.
677 pending_layer_->CalculateContentsScale(1.9f, // ideal contents scale 698 pending_layer_->CalculateContentsScale(1.9f, // ideal contents scale
678 1.4f, // device scale 699 1.4f, // device scale
679 2.2f, // page cale 700 2.2f, // page scale
701 1.f, // maximum animation scale
680 false, 702 false,
681 &result_scale_x, 703 &result_scale_x,
682 &result_scale_y, 704 &result_scale_y,
683 &result_bounds); 705 &result_bounds);
684 ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings()); 706 ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings());
685 EXPECT_FLOAT_EQ( 707 EXPECT_FLOAT_EQ(
686 1.9f, 708 1.9f,
687 pending_layer_->tilings()->tiling_at(0)->contents_scale()); 709 pending_layer_->tilings()->tiling_at(0)->contents_scale());
688 EXPECT_FLOAT_EQ( 710 EXPECT_FLOAT_EQ(
689 1.9f * low_res_factor, 711 1.9f * low_res_factor,
690 pending_layer_->tilings()->tiling_at(3)->contents_scale()); 712 pending_layer_->tilings()->tiling_at(3)->contents_scale());
691 713
692 // If we change the device scale factor, but end up at the same total scale 714 // If we change the device scale factor, but end up at the same total scale
693 // factor somehow, then we don't get new tilings. 715 // factor somehow, then we don't get new tilings.
694 pending_layer_->CalculateContentsScale(1.9f, // ideal contents scale 716 pending_layer_->CalculateContentsScale(1.9f, // ideal contents scale
695 2.2f, // device scale 717 2.2f, // device scale
696 1.4f, // page cale 718 1.4f, // page scale
719 1.f, // maximum animation scale
697 false, 720 false,
698 &result_scale_x, 721 &result_scale_x,
699 &result_scale_y, 722 &result_scale_y,
700 &result_bounds); 723 &result_bounds);
701 ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings()); 724 ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings());
702 EXPECT_FLOAT_EQ( 725 EXPECT_FLOAT_EQ(
703 1.9f, 726 1.9f,
704 pending_layer_->tilings()->tiling_at(0)->contents_scale()); 727 pending_layer_->tilings()->tiling_at(0)->contents_scale());
705 EXPECT_FLOAT_EQ( 728 EXPECT_FLOAT_EQ(
706 1.9f * low_res_factor, 729 1.9f * low_res_factor,
(...skipping 12 matching lines...) Expand all
719 scoped_refptr<FakePicturePileImpl> valid_pile = 742 scoped_refptr<FakePicturePileImpl> valid_pile =
720 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 743 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
721 744
722 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 745 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
723 EXPECT_LT(low_res_factor, 1.f); 746 EXPECT_LT(low_res_factor, 1.f);
724 747
725 float high_res_scale = 1.3f; 748 float high_res_scale = 1.3f;
726 float low_res_scale = high_res_scale * low_res_factor; 749 float low_res_scale = high_res_scale * low_res_factor;
727 float device_scale = 1.7f; 750 float device_scale = 1.7f;
728 float page_scale = 3.2f; 751 float page_scale = 3.2f;
752 float maximum_animation_scale = 1.f;
729 float result_scale_x, result_scale_y; 753 float result_scale_x, result_scale_y;
730 gfx::Size result_bounds; 754 gfx::Size result_bounds;
731 755
732 SetupPendingTree(valid_pile); 756 SetupPendingTree(valid_pile);
733 pending_layer_->CalculateContentsScale(high_res_scale, 757 pending_layer_->CalculateContentsScale(high_res_scale,
734 device_scale, 758 device_scale,
735 page_scale, 759 page_scale,
760 maximum_animation_scale,
736 false, 761 false,
737 &result_scale_x, 762 &result_scale_x,
738 &result_scale_y, 763 &result_scale_y,
739 &result_bounds); 764 &result_bounds);
740 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 765 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
741 EXPECT_FLOAT_EQ(high_res_scale, 766 EXPECT_FLOAT_EQ(high_res_scale,
742 pending_layer_->HighResTiling()->contents_scale()); 767 pending_layer_->HighResTiling()->contents_scale());
743 EXPECT_FLOAT_EQ(low_res_scale, 768 EXPECT_FLOAT_EQ(low_res_scale,
744 pending_layer_->LowResTiling()->contents_scale()); 769 pending_layer_->LowResTiling()->contents_scale());
745 770
746 ActivateTree(); 771 ActivateTree();
747 SetupPendingTree(empty_pile); 772 SetupPendingTree(empty_pile);
748 pending_layer_->CalculateContentsScale(high_res_scale, 773 pending_layer_->CalculateContentsScale(high_res_scale,
749 device_scale, 774 device_scale,
750 page_scale, 775 page_scale,
776 maximum_animation_scale,
751 false, 777 false,
752 &result_scale_x, 778 &result_scale_x,
753 &result_scale_y, 779 &result_scale_y,
754 &result_bounds); 780 &result_bounds);
755 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 781 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
756 ASSERT_EQ(0u, pending_layer_->tilings()->num_tilings()); 782 ASSERT_EQ(0u, pending_layer_->tilings()->num_tilings());
757 783
758 ActivateTree(); 784 ActivateTree();
759 active_layer_->CalculateContentsScale(high_res_scale, 785 active_layer_->CalculateContentsScale(high_res_scale,
760 device_scale, 786 device_scale,
761 page_scale, 787 page_scale,
788 maximum_animation_scale,
762 false, 789 false,
763 &result_scale_x, 790 &result_scale_x,
764 &result_scale_y, 791 &result_scale_y,
765 &result_bounds); 792 &result_bounds);
766 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings()); 793 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings());
767 794
768 SetupPendingTree(valid_pile); 795 SetupPendingTree(valid_pile);
769 pending_layer_->CalculateContentsScale(high_res_scale, 796 pending_layer_->CalculateContentsScale(high_res_scale,
770 device_scale, 797 device_scale,
771 page_scale, 798 page_scale,
799 maximum_animation_scale,
772 false, 800 false,
773 &result_scale_x, 801 &result_scale_x,
774 &result_scale_y, 802 &result_scale_y,
775 &result_bounds); 803 &result_bounds);
776 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 804 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
777 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings()); 805 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings());
778 EXPECT_FLOAT_EQ(high_res_scale, 806 EXPECT_FLOAT_EQ(high_res_scale,
779 pending_layer_->HighResTiling()->contents_scale()); 807 pending_layer_->HighResTiling()->contents_scale());
780 EXPECT_FLOAT_EQ(low_res_scale, 808 EXPECT_FLOAT_EQ(low_res_scale,
781 pending_layer_->LowResTiling()->contents_scale()); 809 pending_layer_->LowResTiling()->contents_scale());
782 } 810 }
783 811
784 TEST_F(PictureLayerImplTest, ZoomOutCrash) { 812 TEST_F(PictureLayerImplTest, ZoomOutCrash) {
785 gfx::Size tile_size(400, 400); 813 gfx::Size tile_size(400, 400);
786 gfx::Size layer_bounds(1300, 1900); 814 gfx::Size layer_bounds(1300, 1900);
787 815
788 // Set up the high and low res tilings before pinch zoom. 816 // Set up the high and low res tilings before pinch zoom.
789 scoped_refptr<FakePicturePileImpl> pending_pile = 817 scoped_refptr<FakePicturePileImpl> pending_pile =
790 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 818 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
791 scoped_refptr<FakePicturePileImpl> active_pile = 819 scoped_refptr<FakePicturePileImpl> active_pile =
792 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 820 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
793 821
794 SetupTrees(pending_pile, active_pile); 822 SetupTrees(pending_pile, active_pile);
795 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 823 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
796 SetContentsScaleOnBothLayers(32.0f, 1.0f, 32.0f, false); 824 SetContentsScaleOnBothLayers(32.0f, 1.0f, 32.0f, 1.0f, false);
797 host_impl_.PinchGestureBegin(); 825 host_impl_.PinchGestureBegin();
798 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, false); 826 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, false);
799 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, false); 827 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, false);
800 EXPECT_EQ(active_layer_->tilings()->NumHighResTilings(), 1); 828 EXPECT_EQ(active_layer_->tilings()->NumHighResTilings(), 1);
801 } 829 }
802 830
803 TEST_F(PictureLayerImplTest, PinchGestureTilings) { 831 TEST_F(PictureLayerImplTest, PinchGestureTilings) {
804 gfx::Size tile_size(400, 400); 832 gfx::Size tile_size(400, 400);
805 gfx::Size layer_bounds(1300, 1900); 833 gfx::Size layer_bounds(1300, 1900);
806 834
807 scoped_refptr<FakePicturePileImpl> pending_pile = 835 scoped_refptr<FakePicturePileImpl> pending_pile =
808 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 836 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
809 scoped_refptr<FakePicturePileImpl> active_pile = 837 scoped_refptr<FakePicturePileImpl> active_pile =
810 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 838 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
811 839
812 // Set up the high and low res tilings before pinch zoom. 840 // Set up the high and low res tilings before pinch zoom.
813 SetupTrees(pending_pile, active_pile); 841 SetupTrees(pending_pile, active_pile);
814 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 842 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
815 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, false); 843 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, false);
816 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 844 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
817 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); 845 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
818 EXPECT_FLOAT_EQ( 846 EXPECT_FLOAT_EQ(
819 1.0f, 847 1.0f,
820 active_layer_->tilings()->tiling_at(0)->contents_scale()); 848 active_layer_->tilings()->tiling_at(0)->contents_scale());
821 EXPECT_FLOAT_EQ( 849 EXPECT_FLOAT_EQ(
822 1.0f * low_res_factor, 850 1.0f * low_res_factor,
823 active_layer_->tilings()->tiling_at(1)->contents_scale()); 851 active_layer_->tilings()->tiling_at(1)->contents_scale());
824 852
825 // Start a pinch gesture. 853 // Start a pinch gesture.
826 host_impl_.PinchGestureBegin(); 854 host_impl_.PinchGestureBegin();
827 855
828 // Zoom out by a small amount. We should create a tiling at half 856 // Zoom out by a small amount. We should create a tiling at half
829 // the scale (1/kMaxScaleRatioDuringPinch). 857 // the scale (1/kMaxScaleRatioDuringPinch).
830 SetContentsScaleOnBothLayers(0.90f, 1.0f, 0.9f, false); 858 SetContentsScaleOnBothLayers(0.90f, 1.0f, 0.9f, 1.0f, false);
831 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); 859 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings());
832 EXPECT_FLOAT_EQ( 860 EXPECT_FLOAT_EQ(
833 1.0f, 861 1.0f,
834 active_layer_->tilings()->tiling_at(0)->contents_scale()); 862 active_layer_->tilings()->tiling_at(0)->contents_scale());
835 EXPECT_FLOAT_EQ( 863 EXPECT_FLOAT_EQ(
836 0.5f, 864 0.5f,
837 active_layer_->tilings()->tiling_at(1)->contents_scale()); 865 active_layer_->tilings()->tiling_at(1)->contents_scale());
838 EXPECT_FLOAT_EQ( 866 EXPECT_FLOAT_EQ(
839 1.0f * low_res_factor, 867 1.0f * low_res_factor,
840 active_layer_->tilings()->tiling_at(2)->contents_scale()); 868 active_layer_->tilings()->tiling_at(2)->contents_scale());
841 869
842 // Zoom out further, close to our low-res scale factor. We should 870 // Zoom out further, close to our low-res scale factor. We should
843 // use that tiling as high-res, and not create a new tiling. 871 // use that tiling as high-res, and not create a new tiling.
844 SetContentsScaleOnBothLayers(low_res_factor, 1.0f, low_res_factor, false); 872 SetContentsScaleOnBothLayers(
873 low_res_factor, 1.0f, low_res_factor, 1.0f, false);
845 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); 874 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings());
846 875
847 // Zoom in a lot now. Since we increase by increments of 876 // Zoom in a lot now. Since we increase by increments of
848 // kMaxScaleRatioDuringPinch, this will first use 0.5, then 1.0 877 // kMaxScaleRatioDuringPinch, this will first use 0.5, then 1.0
849 // and then finally create a new tiling at 2.0. 878 // and then finally create a new tiling at 2.0.
850 SetContentsScaleOnBothLayers(2.1f, 1.0f, 2.1f, false); 879 SetContentsScaleOnBothLayers(2.1f, 1.0f, 2.1f, 1.f, false);
851 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); 880 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings());
852 SetContentsScaleOnBothLayers(2.1f, 1.0f, 2.1f, false); 881 SetContentsScaleOnBothLayers(2.1f, 1.0f, 2.1f, 1.f, false);
853 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); 882 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings());
854 SetContentsScaleOnBothLayers(2.1f, 1.0f, 2.1f, false); 883 SetContentsScaleOnBothLayers(2.1f, 1.0f, 2.1f, 1.f, false);
855 EXPECT_EQ(4u, active_layer_->tilings()->num_tilings()); 884 EXPECT_EQ(4u, active_layer_->tilings()->num_tilings());
856 EXPECT_FLOAT_EQ( 885 EXPECT_FLOAT_EQ(
857 2.0f, 886 2.0f,
858 active_layer_->tilings()->tiling_at(0)->contents_scale()); 887 active_layer_->tilings()->tiling_at(0)->contents_scale());
859 } 888 }
860 889
861 TEST_F(PictureLayerImplTest, CleanUpTilings) { 890 TEST_F(PictureLayerImplTest, CleanUpTilings) {
862 gfx::Size tile_size(400, 400); 891 gfx::Size tile_size(400, 400);
863 gfx::Size layer_bounds(1300, 1900); 892 gfx::Size layer_bounds(1300, 1900);
864 893
865 scoped_refptr<FakePicturePileImpl> pending_pile = 894 scoped_refptr<FakePicturePileImpl> pending_pile =
866 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 895 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
867 scoped_refptr<FakePicturePileImpl> active_pile = 896 scoped_refptr<FakePicturePileImpl> active_pile =
868 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 897 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
869 898
870 float result_scale_x, result_scale_y; 899 float result_scale_x, result_scale_y;
871 gfx::Size result_bounds; 900 gfx::Size result_bounds;
872 std::vector<PictureLayerTiling*> used_tilings; 901 std::vector<PictureLayerTiling*> used_tilings;
873 902
874 SetupTrees(pending_pile, active_pile); 903 SetupTrees(pending_pile, active_pile);
875 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 904 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
876 905
877 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 906 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
878 EXPECT_LT(low_res_factor, 1.f); 907 EXPECT_LT(low_res_factor, 1.f);
879 908
880 float device_scale = 1.7f; 909 float device_scale = 1.7f;
881 float page_scale = 3.2f; 910 float page_scale = 3.2f;
882 911
883 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, false); 912 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, false);
884 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 913 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
885 914
886 // We only have ideal tilings, so they aren't removed. 915 // We only have ideal tilings, so they aren't removed.
887 used_tilings.clear(); 916 used_tilings.clear();
888 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 917 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
889 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 918 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
890 919
891 // Changing the ideal but not creating new tilings. 920 // Changing the ideal but not creating new tilings.
892 SetContentsScaleOnBothLayers(1.5f, device_scale, page_scale, false); 921 SetContentsScaleOnBothLayers(1.5f, device_scale, page_scale, 1.f, false);
893 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 922 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
894 923
895 // The tilings are still our target scale, so they aren't removed. 924 // The tilings are still our target scale, so they aren't removed.
896 used_tilings.clear(); 925 used_tilings.clear();
897 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 926 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
898 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 927 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
899 928
900 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. 929 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2.
901 page_scale = 1.2f; 930 page_scale = 1.2f;
902 SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, false); 931 SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, 1.f, false);
903 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); 932 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings());
904 EXPECT_FLOAT_EQ( 933 EXPECT_FLOAT_EQ(
905 1.f, 934 1.f,
906 active_layer_->tilings()->tiling_at(1)->contents_scale()); 935 active_layer_->tilings()->tiling_at(1)->contents_scale());
907 EXPECT_FLOAT_EQ( 936 EXPECT_FLOAT_EQ(
908 1.f * low_res_factor, 937 1.f * low_res_factor,
909 active_layer_->tilings()->tiling_at(3)->contents_scale()); 938 active_layer_->tilings()->tiling_at(3)->contents_scale());
910 939
911 // Mark the non-ideal tilings as used. They won't be removed. 940 // Mark the non-ideal tilings as used. They won't be removed.
912 used_tilings.clear(); 941 used_tilings.clear();
913 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); 942 used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
914 used_tilings.push_back(active_layer_->tilings()->tiling_at(3)); 943 used_tilings.push_back(active_layer_->tilings()->tiling_at(3));
915 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 944 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
916 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); 945 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings());
917 946
918 // Now move the ideal scale to 0.5. Our target stays 1.2. 947 // Now move the ideal scale to 0.5. Our target stays 1.2.
919 SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, false); 948 SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, 1.f, false);
920 949
921 // The high resolution tiling is between target and ideal, so is not 950 // The high resolution tiling is between target and ideal, so is not
922 // removed. The low res tiling for the old ideal=1.0 scale is removed. 951 // removed. The low res tiling for the old ideal=1.0 scale is removed.
923 used_tilings.clear(); 952 used_tilings.clear();
924 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 953 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
925 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); 954 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
926 955
927 // Now move the ideal scale to 1.0. Our target stays 1.2. 956 // Now move the ideal scale to 1.0. Our target stays 1.2.
928 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, false); 957 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, false);
929 958
930 // All the tilings are between are target and the ideal, so they are not 959 // All the tilings are between are target and the ideal, so they are not
931 // removed. 960 // removed.
932 used_tilings.clear(); 961 used_tilings.clear();
933 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 962 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
934 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); 963 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
935 964
936 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. 965 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2.
937 active_layer_->CalculateContentsScale(1.1f, 966 active_layer_->CalculateContentsScale(1.1f,
938 device_scale, 967 device_scale,
939 page_scale, 968 page_scale,
969 1.f,
940 false, 970 false,
941 &result_scale_x, 971 &result_scale_x,
942 &result_scale_y, 972 &result_scale_y,
943 &result_bounds); 973 &result_bounds);
944 974
945 // Because the pending layer's ideal scale is still 1.0, our tilings fall 975 // Because the pending layer's ideal scale is still 1.0, our tilings fall
946 // in the range [1.0,1.2] and are kept. 976 // in the range [1.0,1.2] and are kept.
947 used_tilings.clear(); 977 used_tilings.clear();
948 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 978 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
949 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); 979 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
950 980
951 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays 981 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays
952 // 1.2 still. 982 // 1.2 still.
953 pending_layer_->CalculateContentsScale(1.1f, 983 pending_layer_->CalculateContentsScale(1.1f,
954 device_scale, 984 device_scale,
955 page_scale, 985 page_scale,
986 1.f,
956 false, 987 false,
957 &result_scale_x, 988 &result_scale_x,
958 &result_scale_y, 989 &result_scale_y,
959 &result_bounds); 990 &result_bounds);
960 991
961 // Our 1.0 tiling now falls outside the range between our ideal scale and our 992 // Our 1.0 tiling now falls outside the range between our ideal scale and our
962 // target raster scale. But it is in our used tilings set, so nothing is 993 // target raster scale. But it is in our used tilings set, so nothing is
963 // deleted. 994 // deleted.
964 used_tilings.clear(); 995 used_tilings.clear();
965 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); 996 used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
(...skipping 19 matching lines...) Expand all
985 gfx::Size tile_size(host_impl_.settings().default_tile_size); 1016 gfx::Size tile_size(host_impl_.settings().default_tile_size);
986 SetupDefaultTrees(gfx::Size(tile_size.width() + 1, tile_size.height() + 1)); 1017 SetupDefaultTrees(gfx::Size(tile_size.width() + 1, tile_size.height() + 1));
987 // Avoid max untiled layer size heuristics via fixed tile size. 1018 // Avoid max untiled layer size heuristics via fixed tile size.
988 pending_layer_->set_fixed_tile_size(tile_size); 1019 pending_layer_->set_fixed_tile_size(tile_size);
989 active_layer_->set_fixed_tile_size(tile_size); 1020 active_layer_->set_fixed_tile_size(tile_size);
990 1021
991 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 1022 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
992 float contents_scale = 1.f; 1023 float contents_scale = 1.f;
993 float device_scale = 1.f; 1024 float device_scale = 1.f;
994 float page_scale = 1.f; 1025 float page_scale = 1.f;
1026 float maximum_animation_scale = 1.f;
995 bool animating_transform = true; 1027 bool animating_transform = true;
996 1028
997 // Animating, so don't create low res even if there isn't one already. 1029 // Animating, so don't create low res even if there isn't one already.
998 SetContentsScaleOnBothLayers( 1030 SetContentsScaleOnBothLayers(contents_scale,
999 contents_scale, device_scale, page_scale, animating_transform); 1031 device_scale,
1032 page_scale,
1033 maximum_animation_scale,
1034 animating_transform);
1000 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 1035 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
1001 EXPECT_BOTH_EQ(num_tilings(), 1u); 1036 EXPECT_BOTH_EQ(num_tilings(), 1u);
1002 1037
1003 // Stop animating, low res gets created. 1038 // Stop animating, low res gets created.
1004 animating_transform = false; 1039 animating_transform = false;
1005 SetContentsScaleOnBothLayers( 1040 SetContentsScaleOnBothLayers(contents_scale,
1006 contents_scale, device_scale, page_scale, animating_transform); 1041 device_scale,
1042 page_scale,
1043 maximum_animation_scale,
1044 animating_transform);
1007 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 1045 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
1008 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); 1046 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
1009 EXPECT_BOTH_EQ(num_tilings(), 2u); 1047 EXPECT_BOTH_EQ(num_tilings(), 2u);
1010 1048
1011 // Page scale animation, new high res, but not new low res because animating. 1049 // Page scale animation, new high res, but not new low res because animating.
1012 contents_scale = 2.f; 1050 contents_scale = 2.f;
1013 page_scale = 2.f; 1051 page_scale = 2.f;
1014 animating_transform = true; 1052 animating_transform = true;
1015 SetContentsScaleOnBothLayers( 1053 SetContentsScaleOnBothLayers(contents_scale,
1016 contents_scale, device_scale, page_scale, animating_transform); 1054 device_scale,
1055 page_scale,
1056 maximum_animation_scale,
1057 animating_transform);
1017 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); 1058 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
1018 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); 1059 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
1019 EXPECT_BOTH_EQ(num_tilings(), 3u); 1060 EXPECT_BOTH_EQ(num_tilings(), 3u);
1020 1061
1021 // Stop animating, new low res gets created for final page scale. 1062 // Stop animating, new low res gets created for final page scale.
1022 animating_transform = false; 1063 animating_transform = false;
1023 SetContentsScaleOnBothLayers( 1064 SetContentsScaleOnBothLayers(contents_scale,
1024 contents_scale, device_scale, page_scale, animating_transform); 1065 device_scale,
1066 page_scale,
1067 maximum_animation_scale,
1068 animating_transform);
1025 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); 1069 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
1026 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 2.f * low_res_factor); 1070 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 2.f * low_res_factor);
1027 EXPECT_BOTH_EQ(num_tilings(), 4u); 1071 EXPECT_BOTH_EQ(num_tilings(), 4u);
1028 } 1072 }
1029 1073
1030 TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { 1074 TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
1031 gfx::Size tile_size(host_impl_.settings().default_tile_size); 1075 gfx::Size tile_size(host_impl_.settings().default_tile_size);
1032 SetupDefaultTrees(tile_size); 1076 SetupDefaultTrees(tile_size);
1033 1077
1034 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 1078 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
1035 float device_scale = 1.f; 1079 float device_scale = 1.f;
1036 float page_scale = 1.f; 1080 float page_scale = 1.f;
1081 float maximum_animation_scale = 1.f;
1037 bool animating_transform = false; 1082 bool animating_transform = false;
1038 1083
1039 // Contents exactly fit on one tile at scale 1, no low res. 1084 // Contents exactly fit on one tile at scale 1, no low res.
1040 float contents_scale = 1.f; 1085 float contents_scale = 1.f;
1041 SetContentsScaleOnBothLayers( 1086 SetContentsScaleOnBothLayers(contents_scale,
1042 contents_scale, device_scale, page_scale, animating_transform); 1087 device_scale,
1088 page_scale,
1089 maximum_animation_scale,
1090 animating_transform);
1043 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); 1091 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
1044 EXPECT_BOTH_EQ(num_tilings(), 1u); 1092 EXPECT_BOTH_EQ(num_tilings(), 1u);
1045 1093
1046 ResetTilingsAndRasterScales(); 1094 ResetTilingsAndRasterScales();
1047 1095
1048 // Contents that are smaller than one tile, no low res. 1096 // Contents that are smaller than one tile, no low res.
1049 contents_scale = 0.123f; 1097 contents_scale = 0.123f;
1050 SetContentsScaleOnBothLayers( 1098 SetContentsScaleOnBothLayers(contents_scale,
1051 contents_scale, device_scale, page_scale, animating_transform); 1099 device_scale,
1100 page_scale,
1101 maximum_animation_scale,
1102 animating_transform);
1052 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); 1103 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
1053 EXPECT_BOTH_EQ(num_tilings(), 1u); 1104 EXPECT_BOTH_EQ(num_tilings(), 1u);
1054 1105
1055 ResetTilingsAndRasterScales(); 1106 ResetTilingsAndRasterScales();
1056 1107
1057 // Any content bounds that would create more than one tile will 1108 // Any content bounds that would create more than one tile will
1058 // generate a low res tiling. 1109 // generate a low res tiling.
1059 contents_scale = 2.5f; 1110 contents_scale = 2.5f;
1060 SetContentsScaleOnBothLayers( 1111 SetContentsScaleOnBothLayers(contents_scale,
1061 contents_scale, device_scale, page_scale, animating_transform); 1112 device_scale,
1113 page_scale,
1114 maximum_animation_scale,
1115 animating_transform);
1062 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); 1116 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
1063 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 1117 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(),
1064 contents_scale * low_res_factor); 1118 contents_scale * low_res_factor);
1065 EXPECT_BOTH_EQ(num_tilings(), 2u); 1119 EXPECT_BOTH_EQ(num_tilings(), 2u);
1066 1120
1067 ResetTilingsAndRasterScales(); 1121 ResetTilingsAndRasterScales();
1068 1122
1069 // Mask layers dont create low res since they always fit on one tile. 1123 // Mask layers dont create low res since they always fit on one tile.
1070 pending_layer_->SetIsMask(true); 1124 pending_layer_->SetIsMask(true);
1071 active_layer_->SetIsMask(true); 1125 active_layer_->SetIsMask(true);
1072 SetContentsScaleOnBothLayers( 1126 SetContentsScaleOnBothLayers(contents_scale,
1073 contents_scale, device_scale, page_scale, animating_transform); 1127 device_scale,
1128 page_scale,
1129 maximum_animation_scale,
1130 animating_transform);
1074 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); 1131 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
1075 EXPECT_BOTH_EQ(num_tilings(), 1u); 1132 EXPECT_BOTH_EQ(num_tilings(), 1u);
1076 } 1133 }
1077 1134
1078 TEST_F(PictureLayerImplTest, ReleaseResources) { 1135 TEST_F(PictureLayerImplTest, ReleaseResources) {
1079 gfx::Size tile_size(400, 400); 1136 gfx::Size tile_size(400, 400);
1080 gfx::Size layer_bounds(1300, 1900); 1137 gfx::Size layer_bounds(1300, 1900);
1081 1138
1082 scoped_refptr<FakePicturePileImpl> pending_pile = 1139 scoped_refptr<FakePicturePileImpl> pending_pile =
1083 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1140 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1084 scoped_refptr<FakePicturePileImpl> active_pile = 1141 scoped_refptr<FakePicturePileImpl> active_pile =
1085 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1142 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1086 1143
1087 float result_scale_x, result_scale_y; 1144 float result_scale_x, result_scale_y;
1088 gfx::Size result_bounds; 1145 gfx::Size result_bounds;
1089 1146
1090 SetupTrees(pending_pile, active_pile); 1147 SetupTrees(pending_pile, active_pile);
1091 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1148 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1092 1149
1093 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale 1150 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale
1094 2.7f, // device scale 1151 2.7f, // device scale
1095 3.2f, // page cale 1152 3.2f, // page scale
1153 1.f, // maximum animation scale
1096 false, 1154 false,
1097 &result_scale_x, 1155 &result_scale_x,
1098 &result_scale_y, 1156 &result_scale_y,
1099 &result_bounds); 1157 &result_bounds);
1100 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); 1158 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings());
1101 1159
1102 // All tilings should be removed when losing output surface. 1160 // All tilings should be removed when losing output surface.
1103 active_layer_->ReleaseResources(); 1161 active_layer_->ReleaseResources();
1104 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 1162 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
1105 pending_layer_->ReleaseResources(); 1163 pending_layer_->ReleaseResources();
1106 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1164 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1107 1165
1108 // This should create new tilings. 1166 // This should create new tilings.
1109 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale 1167 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale
1110 2.7f, // device scale 1168 2.7f, // device scale
1111 3.2f, // page cale 1169 3.2f, // page scale
1170 1.f, // maximum animation scale
1112 false, 1171 false,
1113 &result_scale_x, 1172 &result_scale_x,
1114 &result_scale_y, 1173 &result_scale_y,
1115 &result_bounds); 1174 &result_bounds);
1116 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); 1175 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings());
1117 } 1176 }
1118 1177
1119 TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) { 1178 TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) {
1120 // The default max tile size is larger than 400x400. 1179 // The default max tile size is larger than 400x400.
1121 gfx::Size tile_size(400, 400); 1180 gfx::Size tile_size(400, 400);
1122 gfx::Size layer_bounds(5000, 5000); 1181 gfx::Size layer_bounds(5000, 5000);
1123 1182
1124 scoped_refptr<FakePicturePileImpl> pending_pile = 1183 scoped_refptr<FakePicturePileImpl> pending_pile =
1125 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1184 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1126 scoped_refptr<FakePicturePileImpl> active_pile = 1185 scoped_refptr<FakePicturePileImpl> active_pile =
1127 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1186 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1128 1187
1129 float result_scale_x, result_scale_y; 1188 float result_scale_x, result_scale_y;
1130 gfx::Size result_bounds; 1189 gfx::Size result_bounds;
1131 1190
1132 SetupTrees(pending_pile, active_pile); 1191 SetupTrees(pending_pile, active_pile);
1133 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1192 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1134 1193
1135 pending_layer_->CalculateContentsScale( 1194 pending_layer_->CalculateContentsScale(1.f,
1136 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1195 1.f,
1196 1.f,
1197 1.f,
1198 false,
1199 &result_scale_x,
1200 &result_scale_y,
1201 &result_bounds);
1137 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 1202 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
1138 1203
1139 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1204 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1140 1205
1141 // The default value. 1206 // The default value.
1142 EXPECT_EQ(gfx::Size(256, 256).ToString(), 1207 EXPECT_EQ(gfx::Size(256, 256).ToString(),
1143 host_impl_.settings().default_tile_size.ToString()); 1208 host_impl_.settings().default_tile_size.ToString());
1144 1209
1145 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 1210 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0];
1146 EXPECT_EQ(gfx::Size(256, 256).ToString(), 1211 EXPECT_EQ(gfx::Size(256, 256).ToString(),
1147 tile->content_rect().size().ToString()); 1212 tile->content_rect().size().ToString());
1148 1213
1149 pending_layer_->ReleaseResources(); 1214 pending_layer_->ReleaseResources();
1150 1215
1151 // Change the max texture size on the output surface context. 1216 // Change the max texture size on the output surface context.
1152 scoped_ptr<TestWebGraphicsContext3D> context = 1217 scoped_ptr<TestWebGraphicsContext3D> context =
1153 TestWebGraphicsContext3D::Create(); 1218 TestWebGraphicsContext3D::Create();
1154 context->set_max_texture_size(140); 1219 context->set_max_texture_size(140);
1155 host_impl_.DidLoseOutputSurface(); 1220 host_impl_.DidLoseOutputSurface();
1156 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( 1221 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d(
1157 context.Pass()).PassAs<OutputSurface>()); 1222 context.Pass()).PassAs<OutputSurface>());
1158 1223
1159 pending_layer_->CalculateContentsScale( 1224 pending_layer_->CalculateContentsScale(1.f,
1160 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1225 1.f,
1226 1.f,
1227 1.f,
1228 false,
1229 &result_scale_x,
1230 &result_scale_y,
1231 &result_bounds);
1161 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 1232 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
1162 1233
1163 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1234 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1164 1235
1165 // Verify the tiles are not larger than the context's max texture size. 1236 // Verify the tiles are not larger than the context's max texture size.
1166 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 1237 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0];
1167 EXPECT_GE(140, tile->content_rect().width()); 1238 EXPECT_GE(140, tile->content_rect().width());
1168 EXPECT_GE(140, tile->content_rect().height()); 1239 EXPECT_GE(140, tile->content_rect().height());
1169 } 1240 }
1170 1241
1171 TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) { 1242 TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) {
1172 // The default max tile size is larger than 400x400. 1243 // The default max tile size is larger than 400x400.
1173 gfx::Size tile_size(400, 400); 1244 gfx::Size tile_size(400, 400);
1174 gfx::Size layer_bounds(500, 500); 1245 gfx::Size layer_bounds(500, 500);
1175 1246
1176 scoped_refptr<FakePicturePileImpl> pending_pile = 1247 scoped_refptr<FakePicturePileImpl> pending_pile =
1177 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1248 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1178 scoped_refptr<FakePicturePileImpl> active_pile = 1249 scoped_refptr<FakePicturePileImpl> active_pile =
1179 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1250 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1180 1251
1181 float result_scale_x, result_scale_y; 1252 float result_scale_x, result_scale_y;
1182 gfx::Size result_bounds; 1253 gfx::Size result_bounds;
1183 1254
1184 SetupTrees(pending_pile, active_pile); 1255 SetupTrees(pending_pile, active_pile);
1185 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1256 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1186 1257
1187 pending_layer_->CalculateContentsScale( 1258 pending_layer_->CalculateContentsScale(1.f,
1188 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1259 1.f,
1260 1.f,
1261 1.f,
1262 false,
1263 &result_scale_x,
1264 &result_scale_y,
1265 &result_bounds);
1189 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings()); 1266 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings());
1190 1267
1191 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1268 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1192 1269
1193 // The default value. The layer is smaller than this. 1270 // The default value. The layer is smaller than this.
1194 EXPECT_EQ(gfx::Size(512, 512).ToString(), 1271 EXPECT_EQ(gfx::Size(512, 512).ToString(),
1195 host_impl_.settings().max_untiled_layer_size.ToString()); 1272 host_impl_.settings().max_untiled_layer_size.ToString());
1196 1273
1197 // There should be a single tile since the layer is small. 1274 // There should be a single tile since the layer is small.
1198 PictureLayerTiling* high_res_tiling = pending_layer_->tilings()->tiling_at(0); 1275 PictureLayerTiling* high_res_tiling = pending_layer_->tilings()->tiling_at(0);
1199 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size()); 1276 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size());
1200 1277
1201 pending_layer_->ReleaseResources(); 1278 pending_layer_->ReleaseResources();
1202 1279
1203 // Change the max texture size on the output surface context. 1280 // Change the max texture size on the output surface context.
1204 scoped_ptr<TestWebGraphicsContext3D> context = 1281 scoped_ptr<TestWebGraphicsContext3D> context =
1205 TestWebGraphicsContext3D::Create(); 1282 TestWebGraphicsContext3D::Create();
1206 context->set_max_texture_size(140); 1283 context->set_max_texture_size(140);
1207 host_impl_.DidLoseOutputSurface(); 1284 host_impl_.DidLoseOutputSurface();
1208 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( 1285 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d(
1209 context.Pass()).PassAs<OutputSurface>()); 1286 context.Pass()).PassAs<OutputSurface>());
1210 1287
1211 pending_layer_->CalculateContentsScale( 1288 pending_layer_->CalculateContentsScale(1.f,
1212 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1289 1.f,
1290 1.f,
1291 1.f,
1292 false,
1293 &result_scale_x,
1294 &result_scale_y,
1295 &result_bounds);
1213 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings()); 1296 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings());
1214 1297
1215 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1298 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1216 1299
1217 // There should be more than one tile since the max texture size won't cover 1300 // There should be more than one tile since the max texture size won't cover
1218 // the layer. 1301 // the layer.
1219 high_res_tiling = pending_layer_->tilings()->tiling_at(0); 1302 high_res_tiling = pending_layer_->tilings()->tiling_at(0);
1220 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); 1303 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size());
1221 1304
1222 // Verify the tiles are not larger than the context's max texture size. 1305 // Verify the tiles are not larger than the context's max texture size.
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 TEST_F(PictureLayerImplTest, TilingWithoutGpuRasterization) { 1588 TEST_F(PictureLayerImplTest, TilingWithoutGpuRasterization) {
1506 gfx::Size default_tile_size(host_impl_.settings().default_tile_size); 1589 gfx::Size default_tile_size(host_impl_.settings().default_tile_size);
1507 gfx::Size layer_bounds(default_tile_size.width() * 4, 1590 gfx::Size layer_bounds(default_tile_size.width() * 4,
1508 default_tile_size.height() * 4); 1591 default_tile_size.height() * 4);
1509 float result_scale_x, result_scale_y; 1592 float result_scale_x, result_scale_y;
1510 gfx::Size result_bounds; 1593 gfx::Size result_bounds;
1511 1594
1512 SetupDefaultTrees(layer_bounds); 1595 SetupDefaultTrees(layer_bounds);
1513 EXPECT_FALSE(pending_layer_->ShouldUseGpuRasterization()); 1596 EXPECT_FALSE(pending_layer_->ShouldUseGpuRasterization());
1514 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1597 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1515 pending_layer_->CalculateContentsScale( 1598 pending_layer_->CalculateContentsScale(1.f,
1516 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1599 1.f,
1600 1.f,
1601 1.f,
1602 false,
1603 &result_scale_x,
1604 &result_scale_y,
1605 &result_bounds);
1517 // Should have a low-res and a high-res tiling. 1606 // Should have a low-res and a high-res tiling.
1518 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 1607 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
1519 } 1608 }
1520 1609
1521 TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) { 1610 TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) {
1522 // Set up layers with tilings. 1611 // Set up layers with tilings.
1523 SetupDefaultTrees(gfx::Size(10, 10)); 1612 SetupDefaultTrees(gfx::Size(10, 10));
1524 SetContentsScaleOnBothLayers(1.f, 1.f, 1.f, false); 1613 SetContentsScaleOnBothLayers(1.f, 1.f, 1.f, 1.f, false);
1525 pending_layer_->PushPropertiesTo(active_layer_); 1614 pending_layer_->PushPropertiesTo(active_layer_);
1526 EXPECT_TRUE(pending_layer_->DrawsContent()); 1615 EXPECT_TRUE(pending_layer_->DrawsContent());
1527 EXPECT_TRUE(pending_layer_->CanHaveTilings()); 1616 EXPECT_TRUE(pending_layer_->CanHaveTilings());
1528 EXPECT_GE(pending_layer_->num_tilings(), 0u); 1617 EXPECT_GE(pending_layer_->num_tilings(), 0u);
1529 EXPECT_GE(active_layer_->num_tilings(), 0u); 1618 EXPECT_GE(active_layer_->num_tilings(), 0u);
1530 1619
1531 // Set content to false, which should make CanHaveTilings return false. 1620 // Set content to false, which should make CanHaveTilings return false.
1532 pending_layer_->SetDrawsContent(false); 1621 pending_layer_->SetDrawsContent(false);
1533 EXPECT_FALSE(pending_layer_->DrawsContent()); 1622 EXPECT_FALSE(pending_layer_->DrawsContent());
1534 EXPECT_FALSE(pending_layer_->CanHaveTilings()); 1623 EXPECT_FALSE(pending_layer_->CanHaveTilings());
1535 1624
1536 // No tilings should be pushed to active layer. 1625 // No tilings should be pushed to active layer.
1537 pending_layer_->PushPropertiesTo(active_layer_); 1626 pending_layer_->PushPropertiesTo(active_layer_);
1538 EXPECT_EQ(0u, active_layer_->num_tilings()); 1627 EXPECT_EQ(0u, active_layer_->num_tilings());
1539 } 1628 }
1540 1629
1541 TEST_F(PictureLayerImplTest, FirstTilingDuringPinch) { 1630 TEST_F(PictureLayerImplTest, FirstTilingDuringPinch) {
1542 SetupDefaultTrees(gfx::Size(10, 10)); 1631 SetupDefaultTrees(gfx::Size(10, 10));
1543 host_impl_.PinchGestureBegin(); 1632 host_impl_.PinchGestureBegin();
1544 float high_res_scale = 2.3f; 1633 float high_res_scale = 2.3f;
1545 SetContentsScaleOnBothLayers(high_res_scale, 1.f, 1.f, false); 1634 SetContentsScaleOnBothLayers(high_res_scale, 1.f, 1.f, 1.f, false);
1546 1635
1547 ASSERT_GE(pending_layer_->num_tilings(), 0u); 1636 ASSERT_GE(pending_layer_->num_tilings(), 0u);
1548 EXPECT_FLOAT_EQ(high_res_scale, 1637 EXPECT_FLOAT_EQ(high_res_scale,
1549 pending_layer_->HighResTiling()->contents_scale()); 1638 pending_layer_->HighResTiling()->contents_scale());
1550 } 1639 }
1551 1640
1552 TEST_F(PictureLayerImplTest, FirstTilingTooSmall) { 1641 TEST_F(PictureLayerImplTest, FirstTilingTooSmall) {
1553 SetupDefaultTrees(gfx::Size(10, 10)); 1642 SetupDefaultTrees(gfx::Size(10, 10));
1554 host_impl_.PinchGestureBegin(); 1643 host_impl_.PinchGestureBegin();
1555 float high_res_scale = 0.0001f; 1644 float high_res_scale = 0.0001f;
1556 EXPECT_GT(pending_layer_->MinimumContentsScale(), high_res_scale); 1645 EXPECT_GT(pending_layer_->MinimumContentsScale(), high_res_scale);
1557 1646
1558 SetContentsScaleOnBothLayers(high_res_scale, 1.f, 1.f, false); 1647 SetContentsScaleOnBothLayers(high_res_scale, 1.f, 1.f, 1.f, false);
1559 1648
1560 ASSERT_GE(pending_layer_->num_tilings(), 0u); 1649 ASSERT_GE(pending_layer_->num_tilings(), 0u);
1561 EXPECT_FLOAT_EQ(pending_layer_->MinimumContentsScale(), 1650 EXPECT_FLOAT_EQ(pending_layer_->MinimumContentsScale(),
1562 pending_layer_->HighResTiling()->contents_scale()); 1651 pending_layer_->HighResTiling()->contents_scale());
1563 } 1652 }
1564 1653
1565 TEST_F(PictureLayerImplTest, PinchingTooSmall) { 1654 TEST_F(PictureLayerImplTest, PinchingTooSmall) {
1566 SetupDefaultTrees(gfx::Size(10, 10)); 1655 SetupDefaultTrees(gfx::Size(10, 10));
1567 1656
1568 float contents_scale = 0.15f; 1657 float contents_scale = 0.15f;
1569 SetContentsScaleOnBothLayers(contents_scale, 1.f, 1.f, false); 1658 SetContentsScaleOnBothLayers(contents_scale, 1.f, 1.f, 1.f, false);
1570 1659
1571 ASSERT_GE(pending_layer_->num_tilings(), 0u); 1660 ASSERT_GE(pending_layer_->num_tilings(), 0u);
1572 EXPECT_FLOAT_EQ(contents_scale, 1661 EXPECT_FLOAT_EQ(contents_scale,
1573 pending_layer_->HighResTiling()->contents_scale()); 1662 pending_layer_->HighResTiling()->contents_scale());
1574 1663
1575 host_impl_.PinchGestureBegin(); 1664 host_impl_.PinchGestureBegin();
1576 1665
1577 float page_scale = 0.0001f; 1666 float page_scale = 0.0001f;
1578 EXPECT_LT(page_scale * contents_scale, 1667 EXPECT_LT(page_scale * contents_scale,
1579 pending_layer_->MinimumContentsScale()); 1668 pending_layer_->MinimumContentsScale());
1580 1669
1581 1670 SetContentsScaleOnBothLayers(contents_scale, 1.f, page_scale, 1.f, false);
1582 SetContentsScaleOnBothLayers(contents_scale, 1.f, page_scale, false);
1583 ASSERT_GE(pending_layer_->num_tilings(), 0u); 1671 ASSERT_GE(pending_layer_->num_tilings(), 0u);
1584 EXPECT_FLOAT_EQ(pending_layer_->MinimumContentsScale(), 1672 EXPECT_FLOAT_EQ(pending_layer_->MinimumContentsScale(),
1585 pending_layer_->HighResTiling()->contents_scale()); 1673 pending_layer_->HighResTiling()->contents_scale());
1586 } 1674 }
1587 1675
1588 class DeferredInitPictureLayerImplTest : public PictureLayerImplTest { 1676 class DeferredInitPictureLayerImplTest : public PictureLayerImplTest {
1589 public: 1677 public:
1590 virtual void InitializeRenderer() OVERRIDE { 1678 virtual void InitializeRenderer() OVERRIDE {
1591 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDeferredGL( 1679 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDeferredGL(
1592 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)) 1680 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice))
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 TEST_F(HybridRasterizationPictureLayerImplTest, Tiling) { 1728 TEST_F(HybridRasterizationPictureLayerImplTest, Tiling) {
1641 gfx::Size default_tile_size(host_impl_.settings().default_tile_size); 1729 gfx::Size default_tile_size(host_impl_.settings().default_tile_size);
1642 gfx::Size layer_bounds(default_tile_size.width() * 4, 1730 gfx::Size layer_bounds(default_tile_size.width() * 4,
1643 default_tile_size.height() * 4); 1731 default_tile_size.height() * 4);
1644 float result_scale_x, result_scale_y; 1732 float result_scale_x, result_scale_y;
1645 gfx::Size result_bounds; 1733 gfx::Size result_bounds;
1646 1734
1647 SetupDefaultTrees(layer_bounds); 1735 SetupDefaultTrees(layer_bounds);
1648 EXPECT_FALSE(pending_layer_->ShouldUseGpuRasterization()); 1736 EXPECT_FALSE(pending_layer_->ShouldUseGpuRasterization());
1649 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1737 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1650 pending_layer_->CalculateContentsScale( 1738 pending_layer_->CalculateContentsScale(1.f,
1651 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1739 1.f,
1740 1.f,
1741 1.f,
1742 false,
1743 &result_scale_x,
1744 &result_scale_y,
1745 &result_bounds);
1652 // Should have a low-res and a high-res tiling. 1746 // Should have a low-res and a high-res tiling.
1653 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 1747 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
1654 1748
1655 pending_layer_->SetHasGpuRasterizationHint(true); 1749 pending_layer_->SetHasGpuRasterizationHint(true);
1656 EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization()); 1750 EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization());
1657 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1751 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1658 pending_layer_->CalculateContentsScale( 1752 pending_layer_->CalculateContentsScale(1.f,
1659 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1753 1.f,
1754 1.f,
1755 1.f,
1756 false,
1757 &result_scale_x,
1758 &result_scale_y,
1759 &result_bounds);
1660 // Should only have the high-res tiling. 1760 // Should only have the high-res tiling.
1661 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1761 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
1662 } 1762 }
1663 1763
1664 TEST_F(HybridRasterizationPictureLayerImplTest, 1764 TEST_F(HybridRasterizationPictureLayerImplTest,
1665 HighResTilingDuringAnimationForCpuRasterization) { 1765 HighResTilingDuringAnimationForCpuRasterization) {
1666 gfx::Size tile_size(host_impl_.settings().default_tile_size); 1766 gfx::Size tile_size(host_impl_.settings().default_tile_size);
1667 SetupDefaultTrees(tile_size); 1767 SetupDefaultTrees(tile_size);
1668 pending_layer_->SetHasGpuRasterizationHint(false); 1768 pending_layer_->SetHasGpuRasterizationHint(false);
1669 active_layer_->SetHasGpuRasterizationHint(false); 1769 active_layer_->SetHasGpuRasterizationHint(false);
1670 1770
1671 float contents_scale = 1.f; 1771 float contents_scale = 1.f;
1672 float device_scale = 1.f; 1772 float device_scale = 1.f;
enne (OOO) 2014/04/08 19:18:47 Can you use a non-1 device and page scale in this
1673 float page_scale = 1.f; 1773 float page_scale = 1.f;
1774 float maximum_animation_scale = 1.f;
1674 bool animating_transform = false; 1775 bool animating_transform = false;
1675 1776
1676 SetContentsScaleOnBothLayers( 1777 SetContentsScaleOnBothLayers(contents_scale,
1677 contents_scale, device_scale, page_scale, animating_transform); 1778 device_scale,
1779 page_scale,
1780 maximum_animation_scale,
1781 animating_transform);
1678 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 1782 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
1679 1783
1680 // Changing contents scale shouldn't affect tiling resolution during the 1784 // Since we're CPU-rasterizing, starting an animation should cause tiling
1681 // animation, since we're CPU-rasterizing. 1785 // resolution to get set to the maximum animation scale factor.
1682 animating_transform = true; 1786 animating_transform = true;
1787 maximum_animation_scale = 3.f;
1683 contents_scale = 2.f; 1788 contents_scale = 2.f;
1684 1789
1685 SetContentsScaleOnBothLayers( 1790 SetContentsScaleOnBothLayers(contents_scale,
1686 contents_scale, device_scale, page_scale, animating_transform); 1791 device_scale,
1687 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 1792 page_scale,
1793 maximum_animation_scale,
1794 animating_transform);
1795 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
1796
1797 // Further changes to scale during the animation should not cause a new
1798 // high-res tiling to get created.
1799 contents_scale = 4.f;
1800 maximum_animation_scale = 5.f;
1801
1802 SetContentsScaleOnBothLayers(contents_scale,
1803 device_scale,
1804 page_scale,
1805 maximum_animation_scale,
1806 animating_transform);
1807 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
1688 1808
1689 // Once we stop animating, a new high-res tiling should be created. 1809 // Once we stop animating, a new high-res tiling should be created.
1690 animating_transform = false; 1810 animating_transform = false;
1691 SetContentsScaleOnBothLayers( 1811
1692 contents_scale, device_scale, page_scale, animating_transform); 1812 SetContentsScaleOnBothLayers(contents_scale,
1813 device_scale,
1814 page_scale,
1815 maximum_animation_scale,
1816 animating_transform);
1817 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
1818
1819 // When animating with an unknown maximum animation scale factor, a new
1820 // high-res tiling should be created at the animation's initial scale.
1821 animating_transform = true;
1822 contents_scale = 2.f;
1823 maximum_animation_scale = 0.f;
1824
1825 SetContentsScaleOnBothLayers(contents_scale,
1826 device_scale,
1827 page_scale,
1828 maximum_animation_scale,
1829 animating_transform);
1693 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); 1830 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
1831
1832 // Further changes to scale during the animation should not cause a new
1833 // high-res tiling to get created.
1834 contents_scale = 3.f;
1835
1836 SetContentsScaleOnBothLayers(contents_scale,
1837 device_scale,
1838 page_scale,
1839 maximum_animation_scale,
1840 animating_transform);
1841 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
1842
1843 // Once we stop animating, a new high-res tiling should be created.
1844 animating_transform = false;
1845 contents_scale = 4.f;
1846
1847 SetContentsScaleOnBothLayers(contents_scale,
1848 device_scale,
1849 page_scale,
1850 maximum_animation_scale,
1851 animating_transform);
1852 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
1694 } 1853 }
1695 1854
1696 TEST_F(HybridRasterizationPictureLayerImplTest, 1855 TEST_F(HybridRasterizationPictureLayerImplTest,
1697 HighResTilingDuringAnimationForGpuRasterization) { 1856 HighResTilingDuringAnimationForGpuRasterization) {
1698 gfx::Size tile_size(host_impl_.settings().default_tile_size); 1857 gfx::Size tile_size(host_impl_.settings().default_tile_size);
1699 SetupDefaultTrees(tile_size); 1858 SetupDefaultTrees(tile_size);
1700 pending_layer_->SetHasGpuRasterizationHint(true); 1859 pending_layer_->SetHasGpuRasterizationHint(true);
1701 active_layer_->SetHasGpuRasterizationHint(true); 1860 active_layer_->SetHasGpuRasterizationHint(true);
1702 1861
1703 float contents_scale = 1.f; 1862 float contents_scale = 1.f;
1704 float device_scale = 1.f; 1863 float device_scale = 1.f;
1705 float page_scale = 1.f; 1864 float page_scale = 1.f;
1865 float maximum_animation_scale = 1.f;
1706 bool animating_transform = false; 1866 bool animating_transform = false;
1707 1867
1708 SetContentsScaleOnBothLayers( 1868 SetContentsScaleOnBothLayers(contents_scale,
1709 contents_scale, device_scale, page_scale, animating_transform); 1869 device_scale,
1870 page_scale,
1871 maximum_animation_scale,
1872 animating_transform);
1710 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 1873 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
1711 1874
1712 // Changing contents scale during an animation should cause tiling resolution 1875 // Changing contents scale during an animation should cause tiling resolution
1713 // to change, since we're GPU-rasterizing. 1876 // to change, since we're GPU-rasterizing. The maximum animation scale should
1877 // not have any effect.
1714 animating_transform = true; 1878 animating_transform = true;
1715 contents_scale = 2.f; 1879 contents_scale = 2.f;
1880 maximum_animation_scale = 4.f;
1716 1881
1717 SetContentsScaleOnBothLayers( 1882 SetContentsScaleOnBothLayers(contents_scale,
1718 contents_scale, device_scale, page_scale, animating_transform); 1883 device_scale,
1884 page_scale,
1885 maximum_animation_scale,
1886 animating_transform);
1719 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); 1887 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
1720 1888
1721 // Since we're re-rasterizing during the animation, scales smaller than 1 1889 // Since we're re-rasterizing during the animation, scales smaller than 1
1722 // should be respected. 1890 // should be respected.
1723 contents_scale = 0.5f; 1891 contents_scale = 0.5f;
1724 SetContentsScaleOnBothLayers( 1892 SetContentsScaleOnBothLayers(contents_scale,
1725 contents_scale, device_scale, page_scale, animating_transform); 1893 device_scale,
1894 page_scale,
1895 maximum_animation_scale,
1896 animating_transform);
1726 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); 1897 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
1727 1898
1728 // Tiling resolution should also update once we stop animating. 1899 // Tiling resolution should also update once we stop animating.
1729 contents_scale = 4.f; 1900 contents_scale = 4.f;
1730 animating_transform = false; 1901 animating_transform = false;
1731 SetContentsScaleOnBothLayers( 1902 SetContentsScaleOnBothLayers(contents_scale,
1732 contents_scale, device_scale, page_scale, animating_transform); 1903 device_scale,
1904 page_scale,
1905 maximum_animation_scale,
1906 animating_transform);
1733 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); 1907 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
1734 } 1908 }
1735 1909
1736 class GpuRasterizationPictureLayerImplTest : public PictureLayerImplTest { 1910 class GpuRasterizationPictureLayerImplTest : public PictureLayerImplTest {
1737 public: 1911 public:
1738 GpuRasterizationPictureLayerImplTest() 1912 GpuRasterizationPictureLayerImplTest()
1739 : PictureLayerImplTest(GpuRasterizationSettings()) {} 1913 : PictureLayerImplTest(GpuRasterizationSettings()) {}
1740 }; 1914 };
1741 1915
1742 TEST_F(GpuRasterizationPictureLayerImplTest, Tiling) { 1916 TEST_F(GpuRasterizationPictureLayerImplTest, Tiling) {
1743 gfx::Size default_tile_size(host_impl_.settings().default_tile_size); 1917 gfx::Size default_tile_size(host_impl_.settings().default_tile_size);
1744 gfx::Size layer_bounds(default_tile_size.width() * 4, 1918 gfx::Size layer_bounds(default_tile_size.width() * 4,
1745 default_tile_size.height() * 4); 1919 default_tile_size.height() * 4);
1746 float result_scale_x, result_scale_y; 1920 float result_scale_x, result_scale_y;
1747 gfx::Size result_bounds; 1921 gfx::Size result_bounds;
1748 1922
1749 SetupDefaultTrees(layer_bounds); 1923 SetupDefaultTrees(layer_bounds);
1750 pending_layer_->SetHasGpuRasterizationHint(true); 1924 pending_layer_->SetHasGpuRasterizationHint(true);
1751 EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization()); 1925 EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization());
1752 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1926 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1753 pending_layer_->CalculateContentsScale( 1927 pending_layer_->CalculateContentsScale(1.f,
1754 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1928 1.f,
1929 1.f,
1930 1.f,
1931 false,
1932 &result_scale_x,
1933 &result_scale_y,
1934 &result_bounds);
1755 // Should only have the high-res tiling. 1935 // Should only have the high-res tiling.
1756 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1936 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
1757 1937
1758 pending_layer_->SetHasGpuRasterizationHint(false); 1938 pending_layer_->SetHasGpuRasterizationHint(false);
1759 EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization()); 1939 EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization());
1760 // Should still have the high-res tiling. 1940 // Should still have the high-res tiling.
1761 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1941 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
1762 pending_layer_->CalculateContentsScale( 1942 pending_layer_->CalculateContentsScale(1.f,
1763 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1943 1.f,
1944 1.f,
1945 1.f,
1946 false,
1947 &result_scale_x,
1948 &result_scale_y,
1949 &result_bounds);
1764 // Should still only have the high-res tiling. 1950 // Should still only have the high-res tiling.
1765 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1951 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
1766 } 1952 }
1767 1953
1768 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { 1954 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) {
1769 gfx::Size tile_size(100, 100); 1955 gfx::Size tile_size(100, 100);
1770 gfx::Size layer_bounds(1000, 1000); 1956 gfx::Size layer_bounds(1000, 1000);
1771 1957
1772 scoped_refptr<FakePicturePileImpl> pending_pile = 1958 scoped_refptr<FakePicturePileImpl> pending_pile =
1773 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1959 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]); 2184 EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]);
1999 unique_tiles.insert(tile); 2185 unique_tiles.insert(tile);
2000 } 2186 }
2001 2187
2002 EXPECT_TRUE(reached_required); 2188 EXPECT_TRUE(reached_required);
2003 EXPECT_EQ(all_tiles_set.size(), unique_tiles.size()); 2189 EXPECT_EQ(all_tiles_set.size(), unique_tiles.size());
2004 } 2190 }
2005 2191
2006 } // namespace 2192 } // namespace
2007 } // namespace cc 2193 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698