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

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

Issue 373113003: Keeping track of descendants that draw content instead of recalcualting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 static_cast<DidDrawCheckLayer*>(layer1->children()[0]); 1855 static_cast<DidDrawCheckLayer*>(layer1->children()[0]);
1856 1856
1857 layer1->SetOpacity(0.3f); 1857 layer1->SetOpacity(0.3f);
1858 layer1->SetShouldFlattenTransform(true); 1858 layer1->SetShouldFlattenTransform(true);
1859 1859
1860 EXPECT_FALSE(root->did_draw_called()); 1860 EXPECT_FALSE(root->did_draw_called());
1861 EXPECT_FALSE(layer1->did_draw_called()); 1861 EXPECT_FALSE(layer1->did_draw_called());
1862 EXPECT_FALSE(layer2->did_draw_called()); 1862 EXPECT_FALSE(layer2->did_draw_called());
1863 1863
1864 LayerTreeHostImpl::FrameData frame; 1864 LayerTreeHostImpl::FrameData frame;
1865 FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties(
danakj 2014/08/06 14:57:08 PrepareToDraw does an UpdateDrawProps, why do we n
awoloszyn 2014/08/08 15:53:21 We do not need it. Will change.
1866 host_impl_->active_tree());
1865 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1867 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1866 host_impl_->DrawLayers(&frame); 1868 host_impl_->DrawLayers(&frame);
1867 host_impl_->DidDrawAllLayers(frame); 1869 host_impl_->DidDrawAllLayers(frame);
1868 1870
1869 EXPECT_TRUE(root->did_draw_called()); 1871 EXPECT_TRUE(root->did_draw_called());
1870 EXPECT_TRUE(layer1->did_draw_called()); 1872 EXPECT_TRUE(layer1->did_draw_called());
1871 EXPECT_TRUE(layer2->did_draw_called()); 1873 EXPECT_TRUE(layer2->did_draw_called());
1872 1874
1873 EXPECT_NE(root->render_surface(), layer1->render_surface()); 1875 EXPECT_NE(root->render_surface(), layer1->render_surface());
1874 EXPECT_TRUE(!!layer1->render_surface()); 1876 EXPECT_TRUE(!!layer1->render_surface());
(...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after
3688 // drawing child, it's drawn to a render surface which carries the opacity, 3690 // drawing child, it's drawn to a render surface which carries the opacity,
3689 // so it's itself drawn without blending. 3691 // so it's itself drawn without blending.
3690 // Child layer with opaque content, drawn without blending (parent surface 3692 // Child layer with opaque content, drawn without blending (parent surface
3691 // carries the inherited opacity). 3693 // carries the inherited opacity).
3692 layer1->SetContentsOpaque(true); 3694 layer1->SetContentsOpaque(true);
3693 layer1->SetOpacity(0.5f); 3695 layer1->SetOpacity(0.5f);
3694 layer1->SetExpectation(false, true); 3696 layer1->SetExpectation(false, true);
3695 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3697 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3696 layer2->SetExpectation(false, false); 3698 layer2->SetExpectation(false, false);
3697 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3699 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3700 FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties(
danakj 2014/08/06 14:57:08 Same question
awoloszyn 2014/08/08 15:53:21 Same.
3701 host_impl_->active_tree());
3698 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3702 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3699 host_impl_->DrawLayers(&frame); 3703 host_impl_->DrawLayers(&frame);
3700 EXPECT_TRUE(layer1->quads_appended()); 3704 EXPECT_TRUE(layer1->quads_appended());
3701 EXPECT_TRUE(layer2->quads_appended()); 3705 EXPECT_TRUE(layer2->quads_appended());
3702 host_impl_->DidDrawAllLayers(frame); 3706 host_impl_->DidDrawAllLayers(frame);
3703 3707
3704 // Draw again, but with child non-opaque, to make sure 3708 // Draw again, but with child non-opaque, to make sure
3705 // layer1 not culled. 3709 // layer1 not culled.
3706 layer1->SetContentsOpaque(true); 3710 layer1->SetContentsOpaque(true);
3707 layer1->SetOpacity(1.f); 3711 layer1->SetOpacity(1.f);
(...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after
6762 6766
6763 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); 6767 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200));
6764 host_impl_->UpdateAnimationState(true); 6768 host_impl_->UpdateAnimationState(true);
6765 6769
6766 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); 6770 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset());
6767 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); 6771 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer());
6768 } 6772 }
6769 6773
6770 } // namespace 6774 } // namespace
6771 } // namespace cc 6775 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698