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

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

Issue 1968803002: cc : Use effect node data to determine which opacity wins at commit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/trees/layer_tree_impl.h » ('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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 void AfterTest() override {} 828 void AfterTest() override {}
829 829
830 private: 830 private:
831 int index_; 831 int index_;
832 scoped_refptr<Layer> root_; 832 scoped_refptr<Layer> root_;
833 scoped_refptr<Layer> child_; 833 scoped_refptr<Layer> child_;
834 }; 834 };
835 835
836 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); 836 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync);
837 837
838 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest {
839 protected:
840 void SetupTree() override {
841 root_ = Layer::Create();
842 layer_tree_host()->SetRootLayer(root_);
843 LayerTreeHostTest::SetupTree();
844 }
845
846 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
847
848 void DidCommit() override {
849 EffectTree& effect_tree = layer_tree_host()->property_trees()->effect_tree;
850 EffectNode* node = effect_tree.Node(root_->effect_tree_index());
851 switch (layer_tree_host()->source_frame_number()) {
852 case 1:
853 node->data.opacity = 0.5f;
854 node->data.is_currently_animating_opacity = true;
855 break;
856 case 2:
857 node->data.is_currently_animating_opacity = false;
858 break;
859 }
860 }
861
862 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
863 EffectTree& effect_tree = impl->sync_tree()->property_trees()->effect_tree;
864 EffectNode* node =
865 effect_tree.Node(impl->sync_tree()->root_layer()->effect_tree_index());
866 switch (impl->sync_tree()->source_frame_number()) {
867 case 0:
868 impl->sync_tree()->root_layer()->OnOpacityAnimated(0.75f);
869 PostSetNeedsCommitToMainThread();
870 break;
871 case 1:
872 EXPECT_EQ(node->data.opacity, 0.75f);
873 impl->sync_tree()->root_layer()->OnOpacityAnimated(0.75f);
874 PostSetNeedsCommitToMainThread();
875 break;
876 case 2:
877 EXPECT_EQ(node->data.opacity, 0.5f);
878 EndTest();
879 break;
880 }
881 }
882
883 void AfterTest() override {}
884
885 private:
886 scoped_refptr<Layer> root_;
887 };
888
889 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync);
890
838 // Verify damage status is updated even when the transform tree doesn't need 891 // Verify damage status is updated even when the transform tree doesn't need
839 // to be updated at draw time. 892 // to be updated at draw time.
840 class LayerTreeHostTestTransformTreeDamageIsUpdated : public LayerTreeHostTest { 893 class LayerTreeHostTestTransformTreeDamageIsUpdated : public LayerTreeHostTest {
841 protected: 894 protected:
842 void SetupTree() override { 895 void SetupTree() override {
843 root_ = Layer::Create(); 896 root_ = Layer::Create();
844 child_ = Layer::Create(); 897 child_ = Layer::Create();
845 grand_child_ = Layer::Create(); 898 grand_child_ = Layer::Create();
846 899
847 root_->SetBounds(gfx::Size(50, 50)); 900 root_->SetBounds(gfx::Size(50, 50));
(...skipping 5577 matching lines...) Expand 10 before | Expand all | Expand 10 after
6425 EndTest(); 6478 EndTest();
6426 } 6479 }
6427 6480
6428 void AfterTest() override {} 6481 void AfterTest() override {}
6429 }; 6482 };
6430 6483
6431 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6484 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6432 6485
6433 } // namespace 6486 } // namespace
6434 } // namespace cc 6487 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698