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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2011063002: cc: Use ScreenSpaceTransform to determine content scale (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make layout test need-auto-rebaseline Created 4 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/test/layer_tree_host_common_test.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 4607 matching lines...) Expand 10 before | Expand all | Expand 10 after
4618 gfx::Transform perspective_matrix; 4618 gfx::Transform perspective_matrix;
4619 perspective_matrix.ApplyPerspectiveDepth(2.0); 4619 perspective_matrix.ApplyPerspectiveDepth(2.0);
4620 4620
4621 gfx::Transform scale_small_matrix; 4621 gfx::Transform scale_small_matrix;
4622 scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f); 4622 scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f);
4623 4623
4624 LayerImpl* root = root_layer(); 4624 LayerImpl* root = root_layer();
4625 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 4625 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
4626 gfx::PointF(), gfx::Size(100, 100), false, true, 4626 gfx::PointF(), gfx::Size(100, 100), false, true,
4627 false); 4627 false);
4628 LayerImpl* parent = AddChildToRoot<LayerImpl>(); 4628
4629 LayerImpl* page_scale = AddChildToRoot<LayerImpl>();
4630 SetLayerPropertiesForTesting(page_scale, identity_matrix, gfx::Point3F(),
4631 gfx::PointF(), gfx::Size(100, 100), false, true,
4632 false);
4633
4634 LayerImpl* parent = AddChild<LayerImpl>(page_scale);
4629 parent->SetDrawsContent(true); 4635 parent->SetDrawsContent(true);
4630 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), 4636 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(),
4631 gfx::PointF(), gfx::Size(100, 100), false, true, 4637 gfx::PointF(), gfx::Size(100, 100), false, true,
4632 false); 4638 false);
4633 4639
4634 LayerImpl* perspective_surface = AddChild<LayerImpl>(parent); 4640 LayerImpl* perspective_surface = AddChild<LayerImpl>(parent);
4635 SetLayerPropertiesForTesting(perspective_surface, 4641 SetLayerPropertiesForTesting(perspective_surface,
4636 perspective_matrix * scale_small_matrix, 4642 perspective_matrix * scale_small_matrix,
4637 gfx::Point3F(), gfx::PointF(2.f, 2.f), 4643 gfx::Point3F(), gfx::PointF(2.f, 2.f),
4638 gfx::Size(10, 10), false, true, true); 4644 gfx::Size(10, 10), false, true, true);
4639 perspective_surface->SetDrawsContent(true); 4645 perspective_surface->SetDrawsContent(true);
4640 4646
4641 LayerImpl* scale_surface = AddChild<LayerImpl>(parent); 4647 LayerImpl* scale_surface = AddChild<LayerImpl>(parent);
4642 SetLayerPropertiesForTesting(scale_surface, scale_small_matrix, 4648 SetLayerPropertiesForTesting(scale_surface, scale_small_matrix,
4643 gfx::Point3F(), gfx::PointF(2.f, 2.f), 4649 gfx::Point3F(), gfx::PointF(2.f, 2.f),
4644 gfx::Size(10, 10), false, true, true); 4650 gfx::Size(10, 10), false, true, true);
4645 scale_surface->SetDrawsContent(true); 4651 scale_surface->SetDrawsContent(true);
4646 4652
4647 float device_scale_factor = 2.5f; 4653 float device_scale_factor = 2.5f;
4648 float page_scale_factor = 3.f; 4654 float page_scale_factor = 3.f;
4655 root->layer_tree_impl()->SetViewportLayersFromIds(
4656 Layer::INVALID_ID, page_scale->id(), Layer::INVALID_ID,
4657 Layer::INVALID_ID);
4658 root->layer_tree_impl()->SetDeviceScaleFactor(device_scale_factor);
4659 root->layer_tree_impl()->BuildPropertyTreesForTesting();
4660 root->layer_tree_impl()->SetPageScaleOnActiveTree(page_scale_factor);
4649 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, 4661 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor,
4650 root); 4662 root);
4651 4663
4652 EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor, parent); 4664 EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor, parent);
4653 EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor, 4665 EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor,
4654 perspective_surface); 4666 perspective_surface);
4655 // Ideal scale is the max 2d scale component of the combined transform up to 4667 // Ideal scale is the max 2d scale component of the combined transform up to
4656 // the nearest render target. Here this includes the layer transform as well 4668 // the nearest render target. Here this includes the layer transform as well
4657 // as the device and page scale factors. 4669 // as the device and page scale factors.
4658 gfx::Transform transform = scale_small_matrix; 4670 gfx::Transform transform = scale_small_matrix;
(...skipping 5429 matching lines...) Expand 10 before | Expand all | Expand 10 after
10088 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10100 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10089 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10101 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10090 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10102 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10091 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10103 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10092 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10104 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10093 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10105 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10094 } 10106 }
10095 10107
10096 } // namespace 10108 } // namespace
10097 } // namespace cc 10109 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_common_test.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698