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

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

Issue 666273002: cc: Added raster source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 static void VerifyAllTilesExistAndHavePile( 181 static void VerifyAllTilesExistAndHavePile(
182 const PictureLayerTiling* tiling, 182 const PictureLayerTiling* tiling,
183 PicturePileImpl* pile) { 183 PicturePileImpl* pile) {
184 for (PictureLayerTiling::CoverageIterator iter( 184 for (PictureLayerTiling::CoverageIterator iter(
185 tiling, 185 tiling,
186 tiling->contents_scale(), 186 tiling->contents_scale(),
187 gfx::Rect(tiling->tiling_size())); 187 gfx::Rect(tiling->tiling_size()));
188 iter; 188 iter;
189 ++iter) { 189 ++iter) {
190 EXPECT_TRUE(*iter); 190 EXPECT_TRUE(*iter);
191 EXPECT_EQ(pile, iter->picture_pile()); 191 EXPECT_EQ(pile, iter->raster_source());
192 } 192 }
193 } 193 }
194 194
195 void SetContentsScaleOnBothLayers(float contents_scale, 195 void SetContentsScaleOnBothLayers(float contents_scale,
196 float device_scale_factor, 196 float device_scale_factor,
197 float page_scale_factor, 197 float page_scale_factor,
198 float maximum_animation_contents_scale, 198 float maximum_animation_contents_scale,
199 bool animating_transform) { 199 bool animating_transform) {
200 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 200 SetupDrawPropertiesAndUpdateTiles(pending_layer_,
201 contents_scale, 201 contents_scale,
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 tiling->contents_scale()); 533 tiling->contents_scale());
534 for (PictureLayerTiling::CoverageIterator iter( 534 for (PictureLayerTiling::CoverageIterator iter(
535 tiling, 535 tiling,
536 tiling->contents_scale(), 536 tiling->contents_scale(),
537 gfx::Rect(tiling->tiling_size())); 537 gfx::Rect(tiling->tiling_size()));
538 iter; 538 iter;
539 ++iter) { 539 ++iter) {
540 EXPECT_TRUE(*iter); 540 EXPECT_TRUE(*iter);
541 EXPECT_FALSE(iter.geometry_rect().IsEmpty()); 541 EXPECT_FALSE(iter.geometry_rect().IsEmpty());
542 if (iter.geometry_rect().Intersects(content_invalidation)) 542 if (iter.geometry_rect().Intersects(content_invalidation))
543 EXPECT_EQ(pending_pile.get(), iter->picture_pile()); 543 EXPECT_EQ(pending_pile.get(), iter->raster_source());
544 else 544 else
545 EXPECT_EQ(active_pile.get(), iter->picture_pile()); 545 EXPECT_EQ(active_pile.get(), iter->raster_source());
546 } 546 }
547 } 547 }
548 } 548 }
549 549
550 TEST_F(PictureLayerImplTest, CloneFullInvalidation) { 550 TEST_F(PictureLayerImplTest, CloneFullInvalidation) {
551 gfx::Size tile_size(90, 80); 551 gfx::Size tile_size(90, 80);
552 gfx::Size layer_bounds(300, 500); 552 gfx::Size layer_bounds(300, 500);
553 553
554 scoped_refptr<FakePicturePileImpl> pending_pile = 554 scoped_refptr<FakePicturePileImpl> pending_pile =
555 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 555 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 ++iter) { 602 ++iter) {
603 EXPECT_TRUE(*iter); 603 EXPECT_TRUE(*iter);
604 EXPECT_FALSE(iter.geometry_rect().IsEmpty()); 604 EXPECT_FALSE(iter.geometry_rect().IsEmpty());
605 std::vector<Tile*> active_tiles = 605 std::vector<Tile*> active_tiles =
606 active_layer_->tilings()->tiling_at(i)->AllTilesForTesting(); 606 active_layer_->tilings()->tiling_at(i)->AllTilesForTesting();
607 std::vector<Tile*> pending_tiles = tiling->AllTilesForTesting(); 607 std::vector<Tile*> pending_tiles = tiling->AllTilesForTesting();
608 if (iter.geometry_rect().right() >= active_content_bounds.width() || 608 if (iter.geometry_rect().right() >= active_content_bounds.width() ||
609 iter.geometry_rect().bottom() >= active_content_bounds.height() || 609 iter.geometry_rect().bottom() >= active_content_bounds.height() ||
610 active_tiles[0]->content_rect().size() != 610 active_tiles[0]->content_rect().size() !=
611 pending_tiles[0]->content_rect().size()) { 611 pending_tiles[0]->content_rect().size()) {
612 EXPECT_EQ(pending_pile.get(), iter->picture_pile()); 612 EXPECT_EQ(pending_pile.get(), iter->raster_source());
613 } else { 613 } else {
614 EXPECT_EQ(active_pile.get(), iter->picture_pile()); 614 EXPECT_EQ(active_pile.get(), iter->raster_source());
615 } 615 }
616 } 616 }
617 } 617 }
618 } 618 }
619 619
620 TEST_F(PictureLayerImplTest, AddTilesFromNewRecording) { 620 TEST_F(PictureLayerImplTest, AddTilesFromNewRecording) {
621 gfx::Size tile_size(400, 400); 621 gfx::Size tile_size(400, 400);
622 gfx::Size layer_bounds(1300, 1900); 622 gfx::Size layer_bounds(1300, 1900);
623 623
624 scoped_refptr<FakePicturePileImpl> pending_pile = 624 scoped_refptr<FakePicturePileImpl> pending_pile =
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 iter; 657 iter;
658 ++iter) { 658 ++iter) {
659 EXPECT_FALSE(iter.full_tile_geometry_rect().IsEmpty()); 659 EXPECT_FALSE(iter.full_tile_geometry_rect().IsEmpty());
660 // Ensure there is a recording for this tile. 660 // Ensure there is a recording for this tile.
661 bool in_pending = pending_pile->CanRaster(tiling->contents_scale(), 661 bool in_pending = pending_pile->CanRaster(tiling->contents_scale(),
662 iter.full_tile_geometry_rect()); 662 iter.full_tile_geometry_rect());
663 bool in_active = active_pile->CanRaster(tiling->contents_scale(), 663 bool in_active = active_pile->CanRaster(tiling->contents_scale(),
664 iter.full_tile_geometry_rect()); 664 iter.full_tile_geometry_rect());
665 665
666 if (in_pending && !in_active) 666 if (in_pending && !in_active)
667 EXPECT_EQ(pending_pile.get(), iter->picture_pile()); 667 EXPECT_EQ(pending_pile.get(), iter->raster_source());
668 else if (in_active) 668 else if (in_active)
669 EXPECT_EQ(active_pile.get(), iter->picture_pile()); 669 EXPECT_EQ(active_pile.get(), iter->raster_source());
670 else 670 else
671 EXPECT_FALSE(*iter); 671 EXPECT_FALSE(*iter);
672 } 672 }
673 } 673 }
674 } 674 }
675 675
676 TEST_F(PictureLayerImplTest, ManageTilingsWithNoRecording) { 676 TEST_F(PictureLayerImplTest, ManageTilingsWithNoRecording) {
677 gfx::Size tile_size(400, 400); 677 gfx::Size tile_size(400, 400);
678 gfx::Size layer_bounds(1300, 1900); 678 gfx::Size layer_bounds(1300, 1900);
679 679
(...skipping 4063 matching lines...) Expand 10 before | Expand all | Expand 10 after
4743 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4743 result = layer->CalculateTileSize(gfx::Size(447, 400));
4744 EXPECT_EQ(result.width(), 448); 4744 EXPECT_EQ(result.width(), 448);
4745 EXPECT_EQ(result.height(), 448); 4745 EXPECT_EQ(result.height(), 448);
4746 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4746 result = layer->CalculateTileSize(gfx::Size(500, 499));
4747 EXPECT_EQ(result.width(), 512); 4747 EXPECT_EQ(result.width(), 512);
4748 EXPECT_EQ(result.height(), 500 + 2); 4748 EXPECT_EQ(result.height(), 500 + 2);
4749 } 4749 }
4750 4750
4751 } // namespace 4751 } // namespace
4752 } // namespace cc 4752 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698