| Index: cc/layers/picture_image_layer_impl_unittest.cc
|
| diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
|
| index 6ae23a76fce5317100199dc35e9ebd1a0ff7cf33..fcaacc77cf859bad1d2cea9cbb60fe85c54a8f91 100644
|
| --- a/cc/layers/picture_image_layer_impl_unittest.cc
|
| +++ b/cc/layers/picture_image_layer_impl_unittest.cc
|
| @@ -10,7 +10,7 @@
|
| #include "cc/test/fake_impl_proxy.h"
|
| #include "cc/test/fake_layer_tree_host_impl.h"
|
| #include "cc/test/fake_output_surface.h"
|
| -#include "cc/test/fake_picture_layer_tiling_client.h"
|
| +#include "cc/test/fake_picture_pile_impl.h"
|
| #include "cc/test/impl_side_painting_settings.h"
|
| #include "cc/test/test_shared_bitmap_manager.h"
|
| #include "cc/trees/layer_tree_impl.h"
|
| @@ -40,7 +40,6 @@ class PictureImageLayerImplTest : public testing::Test {
|
| host_impl_(ImplSidePaintingSettings(),
|
| &proxy_,
|
| &shared_bitmap_manager_) {
|
| - tiling_client_.SetTileSize(ImplSidePaintingSettings().default_tile_size);
|
| host_impl_.CreatePendingTree();
|
| host_impl_.InitializeRenderer(FakeOutputSurface::Create3d());
|
| }
|
| @@ -61,10 +60,9 @@ class PictureImageLayerImplTest : public testing::Test {
|
| }
|
| TestablePictureImageLayerImpl* layer =
|
| new TestablePictureImageLayerImpl(tree, id);
|
| - layer->SetBounds(gfx::Size(100, 200));
|
| - layer->SetContentBounds(gfx::Size(100, 200));
|
| - layer->tilings_.reset(new PictureLayerTilingSet(&tiling_client_));
|
| - layer->pile_ = tiling_client_.GetPile();
|
| + layer->pile_ = FakePicturePileImpl::CreateInfiniteFilledPile();
|
| + layer->SetBounds(layer->pile_->tiling_size());
|
| + layer->SetContentBounds(layer->pile_->tiling_size());
|
| return make_scoped_ptr(layer);
|
| }
|
|
|
| @@ -73,7 +71,8 @@ class PictureImageLayerImplTest : public testing::Test {
|
| float device_scale_factor,
|
| float page_scale_factor,
|
| float maximum_animation_contents_scale,
|
| - bool animating_transform_to_screen) {
|
| + bool animating_transform_to_screen,
|
| + gfx::Rect viewport_rect) {
|
| layer->draw_properties().ideal_contents_scale = ideal_contents_scale;
|
| layer->draw_properties().device_scale_factor = device_scale_factor;
|
| layer->draw_properties().page_scale_factor = page_scale_factor;
|
| @@ -81,6 +80,7 @@ class PictureImageLayerImplTest : public testing::Test {
|
| maximum_animation_contents_scale;
|
| layer->draw_properties().screen_space_transform_is_animating =
|
| animating_transform_to_screen;
|
| + layer->draw_properties().visible_content_rect = viewport_rect;
|
| bool resourceless_software_draw = false;
|
| layer->UpdateTiles(Occlusion(), resourceless_software_draw);
|
| }
|
| @@ -89,14 +89,16 @@ class PictureImageLayerImplTest : public testing::Test {
|
| FakeImplProxy proxy_;
|
| FakeLayerTreeHostImpl host_impl_;
|
| TestSharedBitmapManager shared_bitmap_manager_;
|
| - FakePictureLayerTilingClient tiling_client_;
|
| };
|
|
|
| TEST_F(PictureImageLayerImplTest, CalculateContentsScale) {
|
| scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE));
|
| layer->SetDrawsContent(true);
|
| + layer->DoPostCommitInitializationIfNeeded();
|
|
|
| - SetupDrawPropertiesAndUpdateTiles(layer.get(), 2.f, 3.f, 4.f, 1.f, false);
|
| + gfx::Rect viewport(100, 200);
|
| + SetupDrawPropertiesAndUpdateTiles(
|
| + layer.get(), 2.f, 3.f, 4.f, 1.f, false, viewport);
|
|
|
| EXPECT_FLOAT_EQ(1.f, layer->contents_scale_x());
|
| EXPECT_FLOAT_EQ(1.f, layer->contents_scale_y());
|
| @@ -108,6 +110,8 @@ TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) {
|
| CreateLayer(1, PENDING_TREE));
|
| pending_layer->SetDrawsContent(true);
|
|
|
| + gfx::Rect viewport(100, 200);
|
| +
|
| // Set PictureLayerImpl::ideal_contents_scale_ to 2.f which is not equal
|
| // to the content scale used by PictureImageLayerImpl.
|
| const float suggested_ideal_contents_scale = 2.f;
|
| @@ -120,12 +124,14 @@ TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) {
|
| device_scale_factor,
|
| page_scale_factor,
|
| maximum_animation_contents_scale,
|
| - animating_transform_to_screen);
|
| + animating_transform_to_screen,
|
| + viewport);
|
| EXPECT_EQ(1.f, pending_layer->tilings()->tiling_at(0)->contents_scale());
|
|
|
| // Push to active layer.
|
| host_impl_.pending_tree()->SetRootLayer(pending_layer.Pass());
|
| host_impl_.ActivateSyncTree();
|
| +
|
| TestablePictureImageLayerImpl* active_layer =
|
| static_cast<TestablePictureImageLayerImpl*>(
|
| host_impl_.active_tree()->root_layer());
|
| @@ -134,17 +140,15 @@ TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) {
|
| device_scale_factor,
|
| page_scale_factor,
|
| maximum_animation_contents_scale,
|
| - animating_transform_to_screen);
|
| + animating_transform_to_screen,
|
| + viewport);
|
| EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale());
|
|
|
| - // Create tile and resource.
|
| - active_layer->tilings()->tiling_at(0)->CreateAllTilesForTesting();
|
| + // Create resources for the tiles.
|
| host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
|
| active_layer->tilings()->tiling_at(0)->AllTilesForTesting());
|
|
|
| // Draw.
|
| - active_layer->draw_properties().visible_content_rect =
|
| - gfx::Rect(active_layer->bounds());
|
| scoped_ptr<RenderPass> render_pass = RenderPass::Create();
|
| AppendQuadsData data;
|
| active_layer->WillDraw(DRAW_MODE_SOFTWARE, nullptr);
|
|
|