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

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

Issue 2781483006: cc : Compute render surface is_clipped outside property tree building (Closed)
Patch Set: . Created 3 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 3758 matching lines...) Expand 10 before | Expand all | Expand 10 after
3769 3769
3770 layer1->test_properties()->force_render_surface = true; 3770 layer1->test_properties()->force_render_surface = true;
3771 layer1->test_properties()->should_flatten_transform = true; 3771 layer1->test_properties()->should_flatten_transform = true;
3772 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 3772 host_impl_->active_tree()->BuildPropertyTreesForTesting();
3773 3773
3774 EXPECT_FALSE(root->did_draw_called()); 3774 EXPECT_FALSE(root->did_draw_called());
3775 EXPECT_FALSE(layer1->did_draw_called()); 3775 EXPECT_FALSE(layer1->did_draw_called());
3776 EXPECT_FALSE(layer2->did_draw_called()); 3776 EXPECT_FALSE(layer2->did_draw_called());
3777 3777
3778 TestFrameData frame; 3778 TestFrameData frame;
3779 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(
3780 *host_impl_->active_tree()->begin());
3781 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3779 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3782 host_impl_->DrawLayers(&frame); 3780 host_impl_->DrawLayers(&frame);
3783 host_impl_->DidDrawAllLayers(frame); 3781 host_impl_->DidDrawAllLayers(frame);
3784 3782
3785 EXPECT_TRUE(root->did_draw_called()); 3783 EXPECT_TRUE(root->did_draw_called());
3786 EXPECT_TRUE(layer1->did_draw_called()); 3784 EXPECT_TRUE(layer1->did_draw_called());
3787 EXPECT_TRUE(layer2->did_draw_called()); 3785 EXPECT_TRUE(layer2->did_draw_called());
3788 3786
3789 EXPECT_NE(root->GetRenderSurface(), layer1->GetRenderSurface()); 3787 EXPECT_NE(root->GetRenderSurface(), layer1->GetRenderSurface());
3790 EXPECT_TRUE(layer1->GetRenderSurface()); 3788 EXPECT_TRUE(layer1->GetRenderSurface());
(...skipping 3458 matching lines...) Expand 10 before | Expand all | Expand 10 after
7249 // Child layer with opaque content, drawn without blending (parent surface 7247 // Child layer with opaque content, drawn without blending (parent surface
7250 // carries the inherited opacity). 7248 // carries the inherited opacity).
7251 layer1->SetContentsOpaque(true); 7249 layer1->SetContentsOpaque(true);
7252 layer1->test_properties()->opacity = 0.5f; 7250 layer1->test_properties()->opacity = 0.5f;
7253 layer1->NoteLayerPropertyChanged(); 7251 layer1->NoteLayerPropertyChanged();
7254 layer1->test_properties()->force_render_surface = true; 7252 layer1->test_properties()->force_render_surface = true;
7255 layer1->SetExpectation(false, true); 7253 layer1->SetExpectation(false, true);
7256 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 7254 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
7257 layer2->SetExpectation(false, false); 7255 layer2->SetExpectation(false, false);
7258 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 7256 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
7259 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(
7260 host_impl_->active_tree()->root_layer_for_testing());
7261 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 7257 host_impl_->active_tree()->BuildPropertyTreesForTesting();
7262 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 7258 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
7263 host_impl_->DrawLayers(&frame); 7259 host_impl_->DrawLayers(&frame);
7264 EXPECT_TRUE(layer1->quads_appended()); 7260 EXPECT_TRUE(layer1->quads_appended());
7265 EXPECT_TRUE(layer2->quads_appended()); 7261 EXPECT_TRUE(layer2->quads_appended());
7266 host_impl_->DidDrawAllLayers(frame); 7262 host_impl_->DidDrawAllLayers(frame);
7267 layer1->test_properties()->force_render_surface = false; 7263 layer1->test_properties()->force_render_surface = false;
7268 7264
7269 // Draw again, but with child non-opaque, to make sure 7265 // Draw again, but with child non-opaque, to make sure
7270 // layer1 not culled. 7266 // layer1 not culled.
(...skipping 4823 matching lines...) Expand 10 before | Expand all | Expand 10 after
12094 else 12090 else
12095 EXPECT_FALSE(tile->HasRasterTask()); 12091 EXPECT_FALSE(tile->HasRasterTask());
12096 } 12092 }
12097 Region expected_invalidation( 12093 Region expected_invalidation(
12098 raster_source->GetRectForImage(checkerable_image->uniqueID())); 12094 raster_source->GetRectForImage(checkerable_image->uniqueID()));
12099 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); 12095 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation()));
12100 } 12096 }
12101 12097
12102 } // namespace 12098 } // namespace
12103 } // namespace cc 12099 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698