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

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

Issue 1131383007: cc: Ensure that skewport.Contains(visible_rect) is always true. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits> 5 #include <limits>
6 #include <set> 6 #include <set>
7 7
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 // Move the skewport really far in one direction. 622 // Move the skewport really far in one direction.
623 gfx::Rect move_skewport_far = 623 gfx::Rect move_skewport_far =
624 tiling->ComputeSkewport(1.5, gfx::Rect(0, 5000, 100, 100)); 624 tiling->ComputeSkewport(1.5, gfx::Rect(0, 5000, 100, 100));
625 EXPECT_EQ(0, move_skewport_far.x()); 625 EXPECT_EQ(0, move_skewport_far.x());
626 EXPECT_EQ(5000, move_skewport_far.y()); 626 EXPECT_EQ(5000, move_skewport_far.y());
627 EXPECT_EQ(100, move_skewport_far.width()); 627 EXPECT_EQ(100, move_skewport_far.width());
628 EXPECT_EQ(175, move_skewport_far.height()); 628 EXPECT_EQ(175, move_skewport_far.height());
629 EXPECT_TRUE(move_skewport_far.Contains(gfx::Rect(0, 5000, 100, 100))); 629 EXPECT_TRUE(move_skewport_far.Contains(gfx::Rect(0, 5000, 100, 100)));
630 } 630 }
631 631
632 TEST(PictureLayerTilingTest, ComputeSkewportExtremeCases) {
633 FakePictureLayerTilingClient client;
634
635 gfx::Size layer_bounds(200, 200);
636 client.SetTileSize(gfx::Size(100, 100));
637 LayerTreeSettings settings;
638 scoped_refptr<FakePicturePileImpl> pile =
639 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
640 scoped_ptr<TestablePictureLayerTiling> tiling =
641 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, pile, &client,
642 settings);
643
644 gfx::Rect viewport1(-1918, 255860, 4010, 2356);
645 gfx::Rect viewport2(-7088, -91738, 14212, 8350);
646 gfx::Rect viewport3(-12730024, -158883296, 24607540, 14454512);
647 double time = 1.0;
648 tiling->ComputeTilePriorityRects(viewport1, 1.f, time, Occlusion());
649 time += 0.016;
650 EXPECT_TRUE(tiling->ComputeSkewport(time, viewport2).Contains(viewport2));
651 tiling->ComputeTilePriorityRects(viewport2, 1.f, time, Occlusion());
652 time += 0.016;
653 EXPECT_TRUE(tiling->ComputeSkewport(time, viewport3).Contains(viewport3));
654 }
655
632 TEST(PictureLayerTilingTest, ComputeSkewport) { 656 TEST(PictureLayerTilingTest, ComputeSkewport) {
633 FakePictureLayerTilingClient client; 657 FakePictureLayerTilingClient client;
634 658
635 gfx::Rect viewport(0, 0, 100, 100); 659 gfx::Rect viewport(0, 0, 100, 100);
636 gfx::Size layer_bounds(200, 200); 660 gfx::Size layer_bounds(200, 200);
637 661
638 client.SetTileSize(gfx::Size(100, 100)); 662 client.SetTileSize(gfx::Size(100, 100));
639 663
640 scoped_refptr<FakePicturePileImpl> pile = 664 scoped_refptr<FakePicturePileImpl> pile =
641 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); 665 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 tiling_->SetRasterSourceAndResize(pile); 1990 tiling_->SetRasterSourceAndResize(pile);
1967 1991
1968 // Tile size in the tiling should be resized to 250x200. 1992 // Tile size in the tiling should be resized to 250x200.
1969 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); 1993 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width());
1970 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); 1994 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height());
1971 EXPECT_EQ(0u, tiling_->AllTilesForTesting().size()); 1995 EXPECT_EQ(0u, tiling_->AllTilesForTesting().size());
1972 } 1996 }
1973 1997
1974 } // namespace 1998 } // namespace
1975 } // namespace cc 1999 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698