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

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

Powered by Google App Engine
This is Rietveld 408576698