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

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

Issue 1918593002: cc : Stop pushing properties not used by LayerImpl to LayerImpl (3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/test/fake_layer_tree_host_impl.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 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/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 EXPECT_TRUE(layer->transform_is_invertible()); 1792 EXPECT_TRUE(layer->transform_is_invertible());
1793 1793
1794 gfx::Transform singular_transform; 1794 gfx::Transform singular_transform;
1795 singular_transform.Scale3d( 1795 singular_transform.Scale3d(
1796 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0)); 1796 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0));
1797 1797
1798 layer->SetTransform(singular_transform); 1798 layer->SetTransform(singular_transform);
1799 layer->PushPropertiesTo(impl_layer.get()); 1799 layer->PushPropertiesTo(impl_layer.get());
1800 1800
1801 EXPECT_FALSE(layer->transform_is_invertible()); 1801 EXPECT_FALSE(layer->transform_is_invertible());
1802 EXPECT_FALSE(impl_layer->transform_is_invertible()); 1802 EXPECT_FALSE(impl_layer->transform().IsInvertible());
1803 1803
1804 gfx::Transform rotation_transform; 1804 gfx::Transform rotation_transform;
1805 rotation_transform.RotateAboutZAxis(-45.0); 1805 rotation_transform.RotateAboutZAxis(-45.0);
1806 1806
1807 layer->SetTransform(rotation_transform); 1807 layer->SetTransform(rotation_transform);
1808 layer->PushPropertiesTo(impl_layer.get()); 1808 layer->PushPropertiesTo(impl_layer.get());
1809 EXPECT_TRUE(layer->transform_is_invertible()); 1809 EXPECT_TRUE(layer->transform_is_invertible());
1810 EXPECT_TRUE(impl_layer->transform_is_invertible()); 1810 EXPECT_TRUE(impl_layer->transform().IsInvertible());
1811 1811
1812 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 1812 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
1813 } 1813 }
1814 1814
1815 TEST_F(LayerTest, TransformIsInvertibleAnimation) { 1815 TEST_F(LayerTest, TransformIsInvertibleAnimation) {
1816 scoped_refptr<Layer> layer = Layer::Create(); 1816 scoped_refptr<Layer> layer = Layer::Create();
1817 std::unique_ptr<LayerImpl> impl_layer = 1817 std::unique_ptr<LayerImpl> impl_layer =
1818 LayerImpl::Create(host_impl_.active_tree(), 1); 1818 LayerImpl::Create(host_impl_.active_tree(), 1);
1819 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1); 1819 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1);
1820 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); 1820 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
1821 layer_tree_host_->SetRootLayer(layer); 1821 layer_tree_host_->SetRootLayer(layer);
1822 1822
1823 EXPECT_TRUE(layer->transform_is_invertible()); 1823 EXPECT_TRUE(layer->transform_is_invertible());
1824 1824
1825 gfx::Transform singular_transform; 1825 gfx::Transform singular_transform;
1826 singular_transform.Scale3d( 1826 singular_transform.Scale3d(
1827 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0)); 1827 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0));
1828 1828
1829 layer->SetTransform(singular_transform); 1829 layer->SetTransform(singular_transform);
1830 layer->PushPropertiesTo(impl_layer.get()); 1830 layer->PushPropertiesTo(impl_layer.get());
1831 1831
1832 EXPECT_FALSE(layer->transform_is_invertible()); 1832 EXPECT_FALSE(layer->transform_is_invertible());
1833 EXPECT_FALSE(impl_layer->transform_is_invertible()); 1833 EXPECT_FALSE(impl_layer->transform().IsInvertible());
1834 1834
1835 gfx::Transform identity_transform; 1835 gfx::Transform identity_transform;
1836 1836
1837 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times(1); 1837 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times(1);
1838 layer->SetTransform(identity_transform); 1838 layer->SetTransform(identity_transform);
1839 layer->OnTransformAnimated(singular_transform); 1839 layer->OnTransformAnimated(singular_transform);
1840 layer->PushPropertiesTo(impl_layer.get()); 1840 layer->PushPropertiesTo(impl_layer.get());
1841 EXPECT_FALSE(layer->transform_is_invertible()); 1841 EXPECT_FALSE(layer->transform_is_invertible());
1842 EXPECT_FALSE(impl_layer->transform_is_invertible()); 1842 EXPECT_FALSE(impl_layer->transform().IsInvertible());
1843 1843
1844 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 1844 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
1845 } 1845 }
1846 1846
1847 class LayerTreeHostFactory { 1847 class LayerTreeHostFactory {
1848 public: 1848 public:
1849 LayerTreeHostFactory() : client_(FakeLayerTreeHostClient::DIRECT_3D) {} 1849 LayerTreeHostFactory() : client_(FakeLayerTreeHostClient::DIRECT_3D) {}
1850 1850
1851 std::unique_ptr<LayerTreeHost> Create() { 1851 std::unique_ptr<LayerTreeHost> Create() {
1852 return Create(LayerTreeSettings()); 1852 return Create(LayerTreeSettings());
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); 2512 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
2513 2513
2514 test_layer->PushPropertiesTo(impl_layer.get()); 2514 test_layer->PushPropertiesTo(impl_layer.get());
2515 2515
2516 EXPECT_EQ(2lu, impl_layer->element_id()); 2516 EXPECT_EQ(2lu, impl_layer->element_id());
2517 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 2517 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
2518 } 2518 }
2519 2519
2520 } // namespace 2520 } // namespace
2521 } // namespace cc 2521 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/test/fake_layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698