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

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

Issue 2018833002: cc : Delete LayerImpl::opacity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 scroll->SetScrollClipLayer(clip->id()); 957 scroll->SetScrollClipLayer(clip->id());
958 scroll->SetDrawsContent(true); 958 scroll->SetDrawsContent(true);
959 959
960 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 960 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
961 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, 961 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0,
962 false, true); 962 false, true);
963 scrollbar->SetBounds(scrollbar_size); 963 scrollbar->SetBounds(scrollbar_size);
964 scrollbar->SetPosition(gfx::PointF(345, 0)); 964 scrollbar->SetPosition(gfx::PointF(345, 0));
965 scrollbar->SetScrollLayerId(scroll->id()); 965 scrollbar->SetScrollLayerId(scroll->id());
966 scrollbar->SetDrawsContent(true); 966 scrollbar->SetDrawsContent(true);
967 scrollbar->SetOpacity(1.f); 967 scrollbar->test_properties()->opacity = 1.f;
968 968
969 std::unique_ptr<LayerImpl> squash1 = LayerImpl::Create(layer_tree_impl, 5); 969 std::unique_ptr<LayerImpl> squash1 = LayerImpl::Create(layer_tree_impl, 5);
970 squash1->SetBounds(gfx::Size(140, 300)); 970 squash1->SetBounds(gfx::Size(140, 300));
971 squash1->SetPosition(gfx::PointF(220, 0)); 971 squash1->SetPosition(gfx::PointF(220, 0));
972 squash1->SetDrawsContent(true); 972 squash1->SetDrawsContent(true);
973 973
974 std::unique_ptr<LayerImpl> squash2 = LayerImpl::Create(layer_tree_impl, 6); 974 std::unique_ptr<LayerImpl> squash2 = LayerImpl::Create(layer_tree_impl, 6);
975 squash2->SetBounds(gfx::Size(140, 300)); 975 squash2->SetBounds(gfx::Size(140, 300));
976 squash2->SetPosition(gfx::PointF(220, 300)); 976 squash2->SetPosition(gfx::PointF(220, 300));
977 squash2->SetDrawsContent(true); 977 squash2->SetDrawsContent(true);
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 host_impl_->InitializeRenderer(output_surface_.get()); 2671 host_impl_->InitializeRenderer(output_surface_.get());
2672 2672
2673 SetupScrollAndContentsLayers(content_size); 2673 SetupScrollAndContentsLayers(content_size);
2674 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); 2674 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
2675 host_impl_->SetViewportSize( 2675 host_impl_->SetViewportSize(
2676 gfx::Size(content_size.width() / 2, content_size.height() / 2)); 2676 gfx::Size(content_size.width() / 2, content_size.height() / 2));
2677 2677
2678 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 2678 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
2679 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, 2679 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400,
2680 VERTICAL, 10, 0, false, true); 2680 VERTICAL, 10, 0, false, true);
2681 scrollbar->SetOpacity(0.f); 2681 scrollbar->test_properties()->opacity = 0.f;
2682 EXPECT_FLOAT_EQ(0.f, scrollbar->opacity()); 2682 EXPECT_FLOAT_EQ(0.f, scrollbar->test_properties()->opacity);
2683 2683
2684 LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer(); 2684 LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer();
2685 LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer(); 2685 LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer();
2686 scrollbar->SetScrollLayerId(scroll->id()); 2686 scrollbar->SetScrollLayerId(scroll->id());
2687 root->AddChild(std::move(scrollbar)); 2687 root->AddChild(std::move(scrollbar));
2688 2688
2689 host_impl_->active_tree()->DidBecomeActive(); 2689 host_impl_->active_tree()->DidBecomeActive();
2690 SetNeedsRebuildPropertyTrees(); 2690 SetNeedsRebuildPropertyTrees();
2691 DrawFrame(); 2691 DrawFrame();
2692 } 2692 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 settings.scrollbar_fade_delay_ms = 20; 2856 settings.scrollbar_fade_delay_ms = 20;
2857 settings.scrollbar_fade_duration_ms = 20; 2857 settings.scrollbar_fade_duration_ms = 20;
2858 gfx::Size content_size(100, 100); 2858 gfx::Size content_size(100, 100);
2859 2859
2860 CreateHostImpl(settings, CreateOutputSurface()); 2860 CreateHostImpl(settings, CreateOutputSurface());
2861 host_impl_->CreatePendingTree(); 2861 host_impl_->CreatePendingTree();
2862 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size); 2862 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size);
2863 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 2863 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
2864 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400, 2864 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400,
2865 VERTICAL, 10, 0, false, true); 2865 VERTICAL, 10, 0, false, true);
2866 scrollbar->SetOpacity(0.f); 2866 scrollbar->test_properties()->opacity = 0.f;
2867 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer(); 2867 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer();
2868 LayerImpl* root = host_impl_->pending_tree()->InnerViewportContainerLayer(); 2868 LayerImpl* root = host_impl_->pending_tree()->InnerViewportContainerLayer();
2869 scrollbar->SetScrollLayerId(scroll->id()); 2869 scrollbar->SetScrollLayerId(scroll->id());
2870 root->AddChild(std::move(scrollbar)); 2870 root->AddChild(std::move(scrollbar));
2871 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); 2871 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
2872 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); 2872 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
2873 host_impl_->ActivateSyncTree(); 2873 host_impl_->ActivateSyncTree();
2874 2874
2875 LayerImpl* scrollbar_layer = host_impl_->active_tree()->LayerById(400); 2875 LayerImpl* scrollbar_layer = host_impl_->active_tree()->LayerById(400);
2876 2876
2877 EffectNode* active_tree_node = 2877 EffectNode* active_tree_node =
2878 host_impl_->active_tree()->property_trees()->effect_tree.Node( 2878 host_impl_->active_tree()->property_trees()->effect_tree.Node(
2879 scrollbar_layer->effect_tree_index()); 2879 scrollbar_layer->effect_tree_index());
2880 EXPECT_FLOAT_EQ(scrollbar_layer->opacity(), active_tree_node->data.opacity); 2880 EXPECT_FLOAT_EQ(scrollbar_layer->Opacity(), active_tree_node->data.opacity);
2881 2881
2882 host_impl_->ScrollbarAnimationControllerForId(scroll->id()) 2882 host_impl_->ScrollbarAnimationControllerForId(scroll->id())
2883 ->DidMouseMoveNear(0); 2883 ->DidMouseMoveNear(0);
2884 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 2884 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
2885 InputHandler::WHEEL); 2885 InputHandler::WHEEL);
2886 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get()); 2886 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get());
2887 host_impl_->ScrollEnd(EndState().get()); 2887 host_impl_->ScrollEnd(EndState().get());
2888 host_impl_->CreatePendingTree(); 2888 host_impl_->CreatePendingTree();
2889 EffectNode* pending_tree_node = 2889 EffectNode* pending_tree_node =
2890 host_impl_->pending_tree()->property_trees()->effect_tree.Node( 2890 host_impl_->pending_tree()->property_trees()->effect_tree.Node(
2891 scrollbar_layer->effect_tree_index()); 2891 scrollbar_layer->effect_tree_index());
2892 host_impl_->pending_tree() 2892 host_impl_->pending_tree()
2893 ->property_trees() 2893 ->property_trees()
2894 ->always_use_active_tree_opacity_effect_ids.push_back(400); 2894 ->always_use_active_tree_opacity_effect_ids.push_back(400);
2895 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity); 2895 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity);
2896 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->opacity()); 2896 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->Opacity());
2897 EXPECT_FLOAT_EQ(0.f, pending_tree_node->data.opacity); 2897 EXPECT_FLOAT_EQ(0.f, pending_tree_node->data.opacity);
2898 host_impl_->ActivateSyncTree(); 2898 host_impl_->ActivateSyncTree();
2899 active_tree_node = 2899 active_tree_node =
2900 host_impl_->active_tree()->property_trees()->effect_tree.Node( 2900 host_impl_->active_tree()->property_trees()->effect_tree.Node(
2901 scrollbar_layer->effect_tree_index()); 2901 scrollbar_layer->effect_tree_index());
2902 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity); 2902 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity);
2903 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->opacity()); 2903 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->Opacity());
2904 } 2904 }
2905 }; 2905 };
2906 2906
2907 TEST_F(LayerTreeHostImplTestScrollbarOpacity, LinearFade) { 2907 TEST_F(LayerTreeHostImplTestScrollbarOpacity, LinearFade) {
2908 RunTest(LayerTreeSettings::LINEAR_FADE); 2908 RunTest(LayerTreeSettings::LINEAR_FADE);
2909 } 2909 }
2910 2910
2911 TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) { 2911 TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) {
2912 RunTest(LayerTreeSettings::THINNING); 2912 RunTest(LayerTreeSettings::THINNING);
2913 } 2913 }
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after
6236 layer1->SetExpectation(true, false); 6236 layer1->SetExpectation(true, false);
6237 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6237 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6238 SetNeedsRebuildPropertyTrees(); 6238 SetNeedsRebuildPropertyTrees();
6239 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6239 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6240 host_impl_->DrawLayers(&frame); 6240 host_impl_->DrawLayers(&frame);
6241 EXPECT_TRUE(layer1->quads_appended()); 6241 EXPECT_TRUE(layer1->quads_appended());
6242 host_impl_->DidDrawAllLayers(frame); 6242 host_impl_->DidDrawAllLayers(frame);
6243 6243
6244 // Layer with translucent opacity, drawn with blending. 6244 // Layer with translucent opacity, drawn with blending.
6245 layer1->SetContentsOpaque(true); 6245 layer1->SetContentsOpaque(true);
6246 layer1->SetOpacity(0.5f); 6246 layer1->test_properties()->opacity = 0.5f;
6247 layer1->NoteLayerPropertyChanged(); 6247 layer1->NoteLayerPropertyChanged();
6248 layer1->SetExpectation(true, false); 6248 layer1->SetExpectation(true, false);
6249 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6249 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6250 SetNeedsRebuildPropertyTrees(); 6250 SetNeedsRebuildPropertyTrees();
6251 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6251 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6252 host_impl_->DrawLayers(&frame); 6252 host_impl_->DrawLayers(&frame);
6253 EXPECT_TRUE(layer1->quads_appended()); 6253 EXPECT_TRUE(layer1->quads_appended());
6254 host_impl_->DidDrawAllLayers(frame); 6254 host_impl_->DidDrawAllLayers(frame);
6255 6255
6256 // Layer with translucent opacity and painting, drawn with blending. 6256 // Layer with translucent opacity and painting, drawn with blending.
6257 layer1->SetContentsOpaque(true); 6257 layer1->SetContentsOpaque(true);
6258 layer1->SetOpacity(0.5f); 6258 layer1->test_properties()->opacity = 0.5f;
6259 layer1->NoteLayerPropertyChanged(); 6259 layer1->NoteLayerPropertyChanged();
6260 layer1->SetExpectation(true, false); 6260 layer1->SetExpectation(true, false);
6261 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6261 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6262 SetNeedsRebuildPropertyTrees(); 6262 SetNeedsRebuildPropertyTrees();
6263 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6263 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6264 host_impl_->DrawLayers(&frame); 6264 host_impl_->DrawLayers(&frame);
6265 EXPECT_TRUE(layer1->quads_appended()); 6265 EXPECT_TRUE(layer1->quads_appended());
6266 host_impl_->DidDrawAllLayers(frame); 6266 host_impl_->DidDrawAllLayers(frame);
6267 6267
6268 layer1->AddChild( 6268 layer1->AddChild(
6269 BlendStateCheckLayer::Create(host_impl_->active_tree(), 6269 BlendStateCheckLayer::Create(host_impl_->active_tree(),
6270 3, 6270 3,
6271 host_impl_->resource_provider())); 6271 host_impl_->resource_provider()));
6272 BlendStateCheckLayer* layer2 = 6272 BlendStateCheckLayer* layer2 =
6273 static_cast<BlendStateCheckLayer*>(layer1->children()[0]); 6273 static_cast<BlendStateCheckLayer*>(layer1->children()[0]);
6274 layer2->SetPosition(gfx::PointF(4.f, 4.f)); 6274 layer2->SetPosition(gfx::PointF(4.f, 4.f));
6275 6275
6276 // 2 opaque layers, drawn without blending. 6276 // 2 opaque layers, drawn without blending.
6277 layer1->SetContentsOpaque(true); 6277 layer1->SetContentsOpaque(true);
6278 layer1->SetOpacity(1.f); 6278 layer1->test_properties()->opacity = 1.f;
6279 layer1->NoteLayerPropertyChanged(); 6279 layer1->NoteLayerPropertyChanged();
6280 layer1->SetExpectation(false, false); 6280 layer1->SetExpectation(false, false);
6281 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6281 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6282 layer2->SetContentsOpaque(true); 6282 layer2->SetContentsOpaque(true);
6283 layer2->SetOpacity(1.f); 6283 layer2->test_properties()->opacity = 1.f;
6284 layer2->NoteLayerPropertyChanged(); 6284 layer2->NoteLayerPropertyChanged();
6285 layer2->SetExpectation(false, false); 6285 layer2->SetExpectation(false, false);
6286 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6286 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6287 SetNeedsRebuildPropertyTrees(); 6287 SetNeedsRebuildPropertyTrees();
6288 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6288 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6289 host_impl_->DrawLayers(&frame); 6289 host_impl_->DrawLayers(&frame);
6290 EXPECT_TRUE(layer1->quads_appended()); 6290 EXPECT_TRUE(layer1->quads_appended());
6291 EXPECT_TRUE(layer2->quads_appended()); 6291 EXPECT_TRUE(layer2->quads_appended());
6292 host_impl_->DidDrawAllLayers(frame); 6292 host_impl_->DidDrawAllLayers(frame);
6293 6293
(...skipping 25 matching lines...) Expand all
6319 EXPECT_TRUE(layer1->quads_appended()); 6319 EXPECT_TRUE(layer1->quads_appended());
6320 EXPECT_TRUE(layer2->quads_appended()); 6320 EXPECT_TRUE(layer2->quads_appended());
6321 host_impl_->DidDrawAllLayers(frame); 6321 host_impl_->DidDrawAllLayers(frame);
6322 6322
6323 // Parent layer with translucent opacity and opaque content. Since it has a 6323 // Parent layer with translucent opacity and opaque content. Since it has a
6324 // drawing child, it's drawn to a render surface which carries the opacity, 6324 // drawing child, it's drawn to a render surface which carries the opacity,
6325 // so it's itself drawn without blending. 6325 // so it's itself drawn without blending.
6326 // Child layer with opaque content, drawn without blending (parent surface 6326 // Child layer with opaque content, drawn without blending (parent surface
6327 // carries the inherited opacity). 6327 // carries the inherited opacity).
6328 layer1->SetContentsOpaque(true); 6328 layer1->SetContentsOpaque(true);
6329 layer1->SetOpacity(0.5f); 6329 layer1->test_properties()->opacity = 0.5f;
6330 layer1->NoteLayerPropertyChanged(); 6330 layer1->NoteLayerPropertyChanged();
6331 layer1->test_properties()->force_render_surface = true; 6331 layer1->test_properties()->force_render_surface = true;
6332 layer1->SetExpectation(false, true); 6332 layer1->SetExpectation(false, true);
6333 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6333 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6334 layer2->SetExpectation(false, false); 6334 layer2->SetExpectation(false, false);
6335 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6335 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6336 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( 6336 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(
6337 host_impl_->active_tree()->root_layer()); 6337 host_impl_->active_tree()->root_layer());
6338 SetNeedsRebuildPropertyTrees(); 6338 SetNeedsRebuildPropertyTrees();
6339 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6339 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6340 host_impl_->DrawLayers(&frame); 6340 host_impl_->DrawLayers(&frame);
6341 EXPECT_TRUE(layer1->quads_appended()); 6341 EXPECT_TRUE(layer1->quads_appended());
6342 EXPECT_TRUE(layer2->quads_appended()); 6342 EXPECT_TRUE(layer2->quads_appended());
6343 host_impl_->DidDrawAllLayers(frame); 6343 host_impl_->DidDrawAllLayers(frame);
6344 layer1->test_properties()->force_render_surface = false; 6344 layer1->test_properties()->force_render_surface = false;
6345 6345
6346 // Draw again, but with child non-opaque, to make sure 6346 // Draw again, but with child non-opaque, to make sure
6347 // layer1 not culled. 6347 // layer1 not culled.
6348 layer1->SetContentsOpaque(true); 6348 layer1->SetContentsOpaque(true);
6349 layer1->SetOpacity(1.f); 6349 layer1->test_properties()->opacity = 1.f;
6350 layer1->NoteLayerPropertyChanged(); 6350 layer1->NoteLayerPropertyChanged();
6351 layer1->SetExpectation(false, false); 6351 layer1->SetExpectation(false, false);
6352 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6352 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6353 layer2->SetContentsOpaque(true); 6353 layer2->SetContentsOpaque(true);
6354 layer2->SetOpacity(0.5f); 6354 layer2->test_properties()->opacity = 0.5f;
6355 layer2->NoteLayerPropertyChanged(); 6355 layer2->NoteLayerPropertyChanged();
6356 layer2->SetExpectation(true, false); 6356 layer2->SetExpectation(true, false);
6357 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6357 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6358 SetNeedsRebuildPropertyTrees(); 6358 SetNeedsRebuildPropertyTrees();
6359 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6359 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6360 host_impl_->DrawLayers(&frame); 6360 host_impl_->DrawLayers(&frame);
6361 EXPECT_TRUE(layer1->quads_appended()); 6361 EXPECT_TRUE(layer1->quads_appended());
6362 EXPECT_TRUE(layer2->quads_appended()); 6362 EXPECT_TRUE(layer2->quads_appended());
6363 host_impl_->DidDrawAllLayers(frame); 6363 host_impl_->DidDrawAllLayers(frame);
6364 6364
6365 // A second way of making the child non-opaque. 6365 // A second way of making the child non-opaque.
6366 layer1->SetContentsOpaque(true); 6366 layer1->SetContentsOpaque(true);
6367 layer1->SetOpacity(1.f); 6367 layer1->test_properties()->opacity = 1.f;
6368 layer1->NoteLayerPropertyChanged(); 6368 layer1->NoteLayerPropertyChanged();
6369 layer1->SetExpectation(false, false); 6369 layer1->SetExpectation(false, false);
6370 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6370 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6371 layer2->SetContentsOpaque(false); 6371 layer2->SetContentsOpaque(false);
6372 layer2->SetOpacity(1.f); 6372 layer2->test_properties()->opacity = 1.f;
6373 layer2->NoteLayerPropertyChanged(); 6373 layer2->NoteLayerPropertyChanged();
6374 layer2->SetExpectation(true, false); 6374 layer2->SetExpectation(true, false);
6375 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6375 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6376 SetNeedsRebuildPropertyTrees(); 6376 SetNeedsRebuildPropertyTrees();
6377 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6377 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6378 host_impl_->DrawLayers(&frame); 6378 host_impl_->DrawLayers(&frame);
6379 EXPECT_TRUE(layer1->quads_appended()); 6379 EXPECT_TRUE(layer1->quads_appended());
6380 EXPECT_TRUE(layer2->quads_appended()); 6380 EXPECT_TRUE(layer2->quads_appended());
6381 host_impl_->DidDrawAllLayers(frame); 6381 host_impl_->DidDrawAllLayers(frame);
6382 6382
6383 // And when the layer says its not opaque but is painted opaque, it is not 6383 // And when the layer says its not opaque but is painted opaque, it is not
6384 // blended. 6384 // blended.
6385 layer1->SetContentsOpaque(true); 6385 layer1->SetContentsOpaque(true);
6386 layer1->SetOpacity(1.f); 6386 layer1->test_properties()->opacity = 1.f;
6387 layer1->NoteLayerPropertyChanged(); 6387 layer1->NoteLayerPropertyChanged();
6388 layer1->SetExpectation(false, false); 6388 layer1->SetExpectation(false, false);
6389 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6389 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6390 layer2->SetContentsOpaque(true); 6390 layer2->SetContentsOpaque(true);
6391 layer2->SetOpacity(1.f); 6391 layer2->test_properties()->opacity = 1.f;
6392 layer2->NoteLayerPropertyChanged(); 6392 layer2->NoteLayerPropertyChanged();
6393 layer2->SetExpectation(false, false); 6393 layer2->SetExpectation(false, false);
6394 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6394 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6395 SetNeedsRebuildPropertyTrees(); 6395 SetNeedsRebuildPropertyTrees();
6396 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6396 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6397 host_impl_->DrawLayers(&frame); 6397 host_impl_->DrawLayers(&frame);
6398 EXPECT_TRUE(layer1->quads_appended()); 6398 EXPECT_TRUE(layer1->quads_appended());
6399 EXPECT_TRUE(layer2->quads_appended()); 6399 EXPECT_TRUE(layer2->quads_appended());
6400 host_impl_->DidDrawAllLayers(frame); 6400 host_impl_->DidDrawAllLayers(frame);
6401 6401
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
7166 gfx::Rect child_rect(10, 10, 50, 50); 7166 gfx::Rect child_rect(10, 10, 50, 50);
7167 gfx::Rect grand_child_rect(5, 5, 150, 150); 7167 gfx::Rect grand_child_rect(5, 5, 150, 150);
7168 7168
7169 root->test_properties()->force_render_surface = true; 7169 root->test_properties()->force_render_surface = true;
7170 root->SetPosition(gfx::PointF(root_rect.origin())); 7170 root->SetPosition(gfx::PointF(root_rect.origin()));
7171 root->SetBounds(root_rect.size()); 7171 root->SetBounds(root_rect.size());
7172 root->draw_properties().visible_layer_rect = root_rect; 7172 root->draw_properties().visible_layer_rect = root_rect;
7173 root->SetDrawsContent(false); 7173 root->SetDrawsContent(false);
7174 7174
7175 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); 7175 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y()));
7176 child->SetOpacity(0.5f); 7176 child->test_properties()->opacity = 0.5f;
7177 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); 7177 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height()));
7178 child->draw_properties().visible_layer_rect = child_rect; 7178 child->draw_properties().visible_layer_rect = child_rect;
7179 child->SetDrawsContent(false); 7179 child->SetDrawsContent(false);
7180 child->test_properties()->force_render_surface = true; 7180 child->test_properties()->force_render_surface = true;
7181 7181
7182 grand_child->SetPosition(gfx::PointF(grand_child_rect.origin())); 7182 grand_child->SetPosition(gfx::PointF(grand_child_rect.origin()));
7183 grand_child->SetBounds(grand_child_rect.size()); 7183 grand_child->SetBounds(grand_child_rect.size());
7184 grand_child->draw_properties().visible_layer_rect = grand_child_rect; 7184 grand_child->draw_properties().visible_layer_rect = grand_child_rect;
7185 grand_child->SetDrawsContent(true); 7185 grand_child->SetDrawsContent(true);
7186 7186
(...skipping 3564 matching lines...) Expand 10 before | Expand all | Expand 10 after
10751 10751
10752 // Re-initialize with a software output surface. 10752 // Re-initialize with a software output surface.
10753 output_surface_ = FakeOutputSurface::CreateSoftware( 10753 output_surface_ = FakeOutputSurface::CreateSoftware(
10754 base::WrapUnique(new SoftwareOutputDevice)); 10754 base::WrapUnique(new SoftwareOutputDevice));
10755 host_impl_->InitializeRenderer(output_surface_.get()); 10755 host_impl_->InitializeRenderer(output_surface_.get());
10756 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 10756 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10757 } 10757 }
10758 10758
10759 } // namespace 10759 } // namespace
10760 } // namespace cc 10760 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698