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

Side by Side Diff: cc/layers/layer_impl_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.cc ('k') | cc/layers/layer_unittest.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_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "cc/output/filter_operation.h" 7 #include "cc/output/filter_operation.h"
8 #include "cc/output/filter_operations.h" 8 #include "cc/output/filter_operations.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } else { 379 } else {
380 EXPECT_NE(SkColorGetA(safe_color), 255u) 380 EXPECT_NE(SkColorGetA(safe_color), 255u)
381 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " 381 << "Flags: " << contents_opaque << ", " << layer_opaque << ", "
382 << host_opaque << "\n"; 382 << host_opaque << "\n";
383 } 383 }
384 } 384 }
385 } 385 }
386 } 386 }
387 } 387 }
388 388
389 TEST(LayerImplTest, TransformInvertibility) {
390 FakeImplProxy proxy;
391 TestSharedBitmapManager shared_bitmap_manager;
392 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
393
394 scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
395 EXPECT_TRUE(layer->transform().IsInvertible());
396 EXPECT_TRUE(layer->transform_is_invertible());
397
398 gfx::Transform transform;
399 transform.Scale3d(
400 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0));
401 layer->SetTransform(transform);
402 EXPECT_FALSE(layer->transform().IsInvertible());
403 EXPECT_FALSE(layer->transform_is_invertible());
404
405 transform.MakeIdentity();
406 transform.ApplyPerspectiveDepth(SkDoubleToMScalar(100.0));
407 transform.RotateAboutZAxis(75.0);
408 transform.RotateAboutXAxis(32.2);
409 transform.RotateAboutZAxis(-75.0);
410 transform.Translate3d(SkDoubleToMScalar(50.5),
411 SkDoubleToMScalar(42.42),
412 SkDoubleToMScalar(-100.25));
413
414 layer->SetTransform(transform);
415 EXPECT_TRUE(layer->transform().IsInvertible());
416 EXPECT_TRUE(layer->transform_is_invertible());
417 }
418
389 class LayerImplScrollTest : public testing::Test { 419 class LayerImplScrollTest : public testing::Test {
390 public: 420 public:
391 LayerImplScrollTest() 421 LayerImplScrollTest()
392 : host_impl_(&proxy_, &shared_bitmap_manager_), root_id_(7) { 422 : host_impl_(&proxy_, &shared_bitmap_manager_), root_id_(7) {
393 host_impl_.active_tree()->SetRootLayer( 423 host_impl_.active_tree()->SetRootLayer(
394 LayerImpl::Create(host_impl_.active_tree(), root_id_)); 424 LayerImpl::Create(host_impl_.active_tree(), root_id_));
395 host_impl_.active_tree()->root_layer()->AddChild( 425 host_impl_.active_tree()->root_layer()->AddChild(
396 LayerImpl::Create(host_impl_.active_tree(), root_id_ + 1)); 426 LayerImpl::Create(host_impl_.active_tree(), root_id_ + 1));
397 layer()->SetScrollClipLayer(root_id_); 427 layer()->SetScrollClipLayer(root_id_);
398 // Set the max scroll offset by noting that the root layer has bounds (1,1), 428 // Set the max scroll offset by noting that the root layer has bounds (1,1),
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 layer()->set_user_scrollable_vertical(false); 673 layer()->set_user_scrollable_vertical(false);
644 layer()->SetScrollOffset(scroll_offset); 674 layer()->SetScrollOffset(scroll_offset);
645 gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta); 675 gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta);
646 676
647 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled); 677 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled);
648 EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset()); 678 EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset());
649 } 679 }
650 680
651 } // namespace 681 } // namespace
652 } // namespace cc 682 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698