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

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

Issue 1906003002: cc: Stop cache transform invertibility at Layer and LayerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup 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
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/animation/mutable_properties.h" 7 #include "cc/animation/mutable_properties.h"
8 #include "cc/layers/painted_scrollbar_layer_impl.h" 8 #include "cc/layers/painted_scrollbar_layer_impl.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
10 #include "cc/output/filter_operation.h" 10 #include "cc/output/filter_operation.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 TEST(LayerImplTest, TransformInvertibility) { 464 TEST(LayerImplTest, TransformInvertibility) {
465 FakeImplTaskRunnerProvider task_runner_provider; 465 FakeImplTaskRunnerProvider task_runner_provider;
466 TestSharedBitmapManager shared_bitmap_manager; 466 TestSharedBitmapManager shared_bitmap_manager;
467 TestTaskGraphRunner task_graph_runner; 467 TestTaskGraphRunner task_graph_runner;
468 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 468 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
469 &task_graph_runner); 469 &task_graph_runner);
470 470
471 std::unique_ptr<LayerImpl> layer = 471 std::unique_ptr<LayerImpl> layer =
472 LayerImpl::Create(host_impl.active_tree(), 1); 472 LayerImpl::Create(host_impl.active_tree(), 1);
473 EXPECT_TRUE(layer->transform().IsInvertible()); 473 EXPECT_TRUE(layer->transform().IsInvertible());
474 EXPECT_TRUE(layer->transform_is_invertible());
475 474
476 gfx::Transform transform; 475 gfx::Transform transform;
477 transform.Scale3d( 476 transform.Scale3d(
478 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0)); 477 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0));
479 layer->SetTransform(transform); 478 layer->SetTransform(transform);
480 EXPECT_FALSE(layer->transform().IsInvertible()); 479 EXPECT_FALSE(layer->transform().IsInvertible());
481 EXPECT_FALSE(layer->transform_is_invertible());
482 480
483 transform.MakeIdentity(); 481 transform.MakeIdentity();
484 transform.ApplyPerspectiveDepth(SkDoubleToMScalar(100.0)); 482 transform.ApplyPerspectiveDepth(SkDoubleToMScalar(100.0));
485 transform.RotateAboutZAxis(75.0); 483 transform.RotateAboutZAxis(75.0);
486 transform.RotateAboutXAxis(32.2); 484 transform.RotateAboutXAxis(32.2);
487 transform.RotateAboutZAxis(-75.0); 485 transform.RotateAboutZAxis(-75.0);
488 transform.Translate3d(SkDoubleToMScalar(50.5), 486 transform.Translate3d(SkDoubleToMScalar(50.5),
489 SkDoubleToMScalar(42.42), 487 SkDoubleToMScalar(42.42),
490 SkDoubleToMScalar(-100.25)); 488 SkDoubleToMScalar(-100.25));
491 489
492 layer->SetTransform(transform); 490 layer->SetTransform(transform);
493 EXPECT_TRUE(layer->transform().IsInvertible()); 491 EXPECT_TRUE(layer->transform().IsInvertible());
494 EXPECT_TRUE(layer->transform_is_invertible());
495 } 492 }
496 493
497 class LayerImplScrollTest : public testing::Test { 494 class LayerImplScrollTest : public testing::Test {
498 public: 495 public:
499 LayerImplScrollTest() 496 LayerImplScrollTest()
500 : host_impl_(settings(), 497 : host_impl_(settings(),
501 &task_runner_provider_, 498 &task_runner_provider_,
502 &shared_bitmap_manager_, 499 &shared_bitmap_manager_,
503 &task_graph_runner_), 500 &task_graph_runner_),
504 root_id_(7) { 501 root_id_(7) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 664
668 pending_layer->PushPropertiesTo(layer()); 665 pending_layer->PushPropertiesTo(layer());
669 666
670 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 667 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
671 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 668 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
672 pending_layer->CurrentScrollOffset()); 669 pending_layer->CurrentScrollOffset());
673 } 670 }
674 671
675 } // namespace 672 } // namespace
676 } // namespace cc 673 } // namespace cc
OLDNEW
« cc/layers/layer.cc ('K') | « 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