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

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

Issue 1479883002: cc: Fix draw transform computation for non-drawn layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove LayerImpl::draw_transform() Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/animation/animation_curve.h" 7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
9 #include "cc/animation/animation_id_provider.h" 9 #include "cc/animation/animation_id_provider.h"
10 #include "cc/animation/animation_player.h" 10 #include "cc/animation/animation_player.h"
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 layer_->AddChild(Layer::Create(layer_settings())); 912 layer_->AddChild(Layer::Create(layer_settings()));
913 break; 913 break;
914 } 914 }
915 } 915 }
916 916
917 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 917 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
918 if (host_impl->active_tree()->source_frame_number() < 2) 918 if (host_impl->active_tree()->source_frame_number() < 2)
919 return; 919 return;
920 gfx::Transform expected_transform; 920 gfx::Transform expected_transform;
921 expected_transform.Translate(10.f, 10.f); 921 expected_transform.Translate(10.f, 10.f);
922 EXPECT_EQ(expected_transform, host_impl->active_tree() 922 EXPECT_EQ(
923 ->root_layer() 923 expected_transform,
924 ->children()[0] 924 host_impl->active_tree()->root_layer()->children()[0]->DrawTransform());
925 ->draw_transform());
926 EndTest(); 925 EndTest();
927 } 926 }
928 927
929 void AfterTest() override {} 928 void AfterTest() override {}
930 929
931 private: 930 private:
932 scoped_refptr<Layer> layer_; 931 scoped_refptr<Layer> layer_;
933 FakeContentLayerClient client_; 932 FakeContentLayerClient client_;
934 }; 933 };
935 934
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 971 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
973 switch (host_impl->sync_tree()->source_frame_number()) { 972 switch (host_impl->sync_tree()->source_frame_number()) {
974 case 1: 973 case 1:
975 PostSetNeedsCommitToMainThread(); 974 PostSetNeedsCommitToMainThread();
976 break; 975 break;
977 case 2: 976 case 2:
978 gfx::Transform expected_transform; 977 gfx::Transform expected_transform;
979 expected_transform.Translate(5.f, 5.f); 978 expected_transform.Translate(5.f, 5.f);
980 LayerImpl* layer_impl = 979 LayerImpl* layer_impl =
981 host_impl->sync_tree()->root_layer()->children()[0].get(); 980 host_impl->sync_tree()->root_layer()->children()[0].get();
982 EXPECT_EQ(expected_transform, layer_impl->draw_transform()); 981 EXPECT_EQ(expected_transform, layer_impl->DrawTransform());
983 EndTest(); 982 EndTest();
984 break; 983 break;
985 } 984 }
986 } 985 }
987 986
988 void UpdateAnimationState(LayerTreeHostImpl* host_impl, 987 void UpdateAnimationState(LayerTreeHostImpl* host_impl,
989 bool has_unfinished_animation) override { 988 bool has_unfinished_animation) override {
990 if (host_impl->active_tree()->source_frame_number() == 1 && 989 if (host_impl->active_tree()->source_frame_number() == 1 &&
991 !has_unfinished_animation) { 990 !has_unfinished_animation) {
992 // The animation has finished, so allow the main thread to commit. 991 // The animation has finished, so allow the main thread to commit.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 private: 1131 private:
1133 scoped_refptr<Layer> layer_; 1132 scoped_refptr<Layer> layer_;
1134 FakeContentLayerClient client_; 1133 FakeContentLayerClient client_;
1135 }; 1134 };
1136 1135
1137 MULTI_THREAD_TEST_F( 1136 MULTI_THREAD_TEST_F(
1138 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit); 1137 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit);
1139 1138
1140 } // namespace 1139 } // namespace
1141 } // namespace cc 1140 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698