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

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

Issue 217313003: Stop displaying layers with non-invertible transforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test comment for cases 2-3. Created 6 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/trees/layer_tree_host_common.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 "cc/animation/keyframed_animation_curve.h" 7 #include "cc/animation/keyframed_animation_curve.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
10 #include "cc/resources/layer_painter.h" 10 #include "cc/resources/layer_painter.h"
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 EXPECT_EQ(NULL, mask->parent()); 797 EXPECT_EQ(NULL, mask->parent());
798 EXPECT_EQ(child, mask_replacement->parent()); 798 EXPECT_EQ(child, mask_replacement->parent());
799 799
800 child->SetReplicaLayer(replica_replacement.get()); 800 child->SetReplicaLayer(replica_replacement.get());
801 EXPECT_EQ(NULL, replica->parent()); 801 EXPECT_EQ(NULL, replica->parent());
802 EXPECT_EQ(child, replica_replacement->parent()); 802 EXPECT_EQ(child, replica_replacement->parent());
803 803
804 EXPECT_EQ(replica, replica->mask_layer()->parent()); 804 EXPECT_EQ(replica, replica->mask_layer()->parent());
805 } 805 }
806 806
807 TEST_F(LayerTest, CheckTranformIsInvertible) {
808 scoped_refptr<Layer> layer = Layer::Create();
809 scoped_ptr<LayerImpl> impl_layer =
810 LayerImpl::Create(host_impl_.active_tree(), 1);
811 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1);
812 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
813 layer_tree_host_->SetRootLayer(layer);
814
815 EXPECT_TRUE(layer->transform_is_invertible());
816
817 gfx::Transform singular_transform;
818 singular_transform.Scale3d(
819 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0));
820
821 layer->SetTransform(singular_transform);
822 layer->PushPropertiesTo(impl_layer.get());
823
824 EXPECT_FALSE(layer->transform_is_invertible());
825 EXPECT_FALSE(impl_layer->transform_is_invertible());
826
827 gfx::Transform rotation_transform;
828 rotation_transform.RotateAboutZAxis(-45.0);
829
830 layer->SetTransform(rotation_transform);
831 layer->PushPropertiesTo(impl_layer.get());
832 EXPECT_TRUE(layer->transform_is_invertible());
833 EXPECT_TRUE(impl_layer->transform_is_invertible());
834
835 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
836 }
837
807 class LayerTreeHostFactory { 838 class LayerTreeHostFactory {
808 public: 839 public:
809 LayerTreeHostFactory() 840 LayerTreeHostFactory()
810 : client_(FakeLayerTreeHostClient::DIRECT_3D), 841 : client_(FakeLayerTreeHostClient::DIRECT_3D),
811 shared_bitmap_manager_(new TestSharedBitmapManager()) {} 842 shared_bitmap_manager_(new TestSharedBitmapManager()) {}
812 843
813 scoped_ptr<LayerTreeHost> Create() { 844 scoped_ptr<LayerTreeHost> Create() {
814 return LayerTreeHost::CreateSingleThreaded(&client_, 845 return LayerTreeHost::CreateSingleThreaded(&client_,
815 &client_, 846 &client_,
816 shared_bitmap_manager_.get(), 847 shared_bitmap_manager_.get(),
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " 1111 << "Flags: " << contents_opaque << ", " << layer_opaque << ", "
1081 << host_opaque << "\n"; 1112 << host_opaque << "\n";
1082 } 1113 }
1083 } 1114 }
1084 } 1115 }
1085 } 1116 }
1086 } 1117 }
1087 1118
1088 } // namespace 1119 } // namespace
1089 } // namespace cc 1120 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698