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

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

Issue 647253002: cc: Stop converting update rect from int to float to int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: displayrectint: ccperftests Created 6 years, 2 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/trees/damage_tracker_unittest.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('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_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 3824 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 host_impl_->resource_provider())); 3835 host_impl_->resource_provider()));
3836 BlendStateCheckLayer* layer1 = 3836 BlendStateCheckLayer* layer1 =
3837 static_cast<BlendStateCheckLayer*>(root->children()[0]); 3837 static_cast<BlendStateCheckLayer*>(root->children()[0]);
3838 layer1->SetPosition(gfx::PointF(2.f, 2.f)); 3838 layer1->SetPosition(gfx::PointF(2.f, 2.f));
3839 3839
3840 LayerTreeHostImpl::FrameData frame; 3840 LayerTreeHostImpl::FrameData frame;
3841 3841
3842 // Opaque layer, drawn without blending. 3842 // Opaque layer, drawn without blending.
3843 layer1->SetContentsOpaque(true); 3843 layer1->SetContentsOpaque(true);
3844 layer1->SetExpectation(false, false); 3844 layer1->SetExpectation(false, false);
3845 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3845 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3846 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3846 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3847 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3847 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3848 EXPECT_TRUE(layer1->quads_appended()); 3848 EXPECT_TRUE(layer1->quads_appended());
3849 host_impl_->DidDrawAllLayers(frame); 3849 host_impl_->DidDrawAllLayers(frame);
3850 3850
3851 // Layer with translucent content and painting, so drawn with blending. 3851 // Layer with translucent content and painting, so drawn with blending.
3852 layer1->SetContentsOpaque(false); 3852 layer1->SetContentsOpaque(false);
3853 layer1->SetExpectation(true, false); 3853 layer1->SetExpectation(true, false);
3854 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3854 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3855 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3855 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3856 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3856 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3857 EXPECT_TRUE(layer1->quads_appended()); 3857 EXPECT_TRUE(layer1->quads_appended());
3858 host_impl_->DidDrawAllLayers(frame); 3858 host_impl_->DidDrawAllLayers(frame);
3859 3859
3860 // Layer with translucent opacity, drawn with blending. 3860 // Layer with translucent opacity, drawn with blending.
3861 layer1->SetContentsOpaque(true); 3861 layer1->SetContentsOpaque(true);
3862 layer1->SetOpacity(0.5f); 3862 layer1->SetOpacity(0.5f);
3863 layer1->SetExpectation(true, false); 3863 layer1->SetExpectation(true, false);
3864 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3864 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3865 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3865 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3866 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3866 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3867 EXPECT_TRUE(layer1->quads_appended()); 3867 EXPECT_TRUE(layer1->quads_appended());
3868 host_impl_->DidDrawAllLayers(frame); 3868 host_impl_->DidDrawAllLayers(frame);
3869 3869
3870 // Layer with translucent opacity and painting, drawn with blending. 3870 // Layer with translucent opacity and painting, drawn with blending.
3871 layer1->SetContentsOpaque(true); 3871 layer1->SetContentsOpaque(true);
3872 layer1->SetOpacity(0.5f); 3872 layer1->SetOpacity(0.5f);
3873 layer1->SetExpectation(true, false); 3873 layer1->SetExpectation(true, false);
3874 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3874 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3875 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3875 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3876 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3876 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3877 EXPECT_TRUE(layer1->quads_appended()); 3877 EXPECT_TRUE(layer1->quads_appended());
3878 host_impl_->DidDrawAllLayers(frame); 3878 host_impl_->DidDrawAllLayers(frame);
3879 3879
3880 layer1->AddChild( 3880 layer1->AddChild(
3881 BlendStateCheckLayer::Create(host_impl_->active_tree(), 3881 BlendStateCheckLayer::Create(host_impl_->active_tree(),
3882 3, 3882 3,
3883 host_impl_->resource_provider())); 3883 host_impl_->resource_provider()));
3884 BlendStateCheckLayer* layer2 = 3884 BlendStateCheckLayer* layer2 =
3885 static_cast<BlendStateCheckLayer*>(layer1->children()[0]); 3885 static_cast<BlendStateCheckLayer*>(layer1->children()[0]);
3886 layer2->SetPosition(gfx::PointF(4.f, 4.f)); 3886 layer2->SetPosition(gfx::PointF(4.f, 4.f));
3887 3887
3888 // 2 opaque layers, drawn without blending. 3888 // 2 opaque layers, drawn without blending.
3889 layer1->SetContentsOpaque(true); 3889 layer1->SetContentsOpaque(true);
3890 layer1->SetOpacity(1.f); 3890 layer1->SetOpacity(1.f);
3891 layer1->SetExpectation(false, false); 3891 layer1->SetExpectation(false, false);
3892 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3892 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3893 layer2->SetContentsOpaque(true); 3893 layer2->SetContentsOpaque(true);
3894 layer2->SetOpacity(1.f); 3894 layer2->SetOpacity(1.f);
3895 layer2->SetExpectation(false, false); 3895 layer2->SetExpectation(false, false);
3896 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3896 layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3897 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3897 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3898 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3898 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3899 EXPECT_TRUE(layer1->quads_appended()); 3899 EXPECT_TRUE(layer1->quads_appended());
3900 EXPECT_TRUE(layer2->quads_appended()); 3900 EXPECT_TRUE(layer2->quads_appended());
3901 host_impl_->DidDrawAllLayers(frame); 3901 host_impl_->DidDrawAllLayers(frame);
3902 3902
3903 // Parent layer with translucent content, drawn with blending. 3903 // Parent layer with translucent content, drawn with blending.
3904 // Child layer with opaque content, drawn without blending. 3904 // Child layer with opaque content, drawn without blending.
3905 layer1->SetContentsOpaque(false); 3905 layer1->SetContentsOpaque(false);
3906 layer1->SetExpectation(true, false); 3906 layer1->SetExpectation(true, false);
3907 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3907 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3908 layer2->SetExpectation(false, false); 3908 layer2->SetExpectation(false, false);
3909 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3909 layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3910 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3910 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3911 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3911 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3912 EXPECT_TRUE(layer1->quads_appended()); 3912 EXPECT_TRUE(layer1->quads_appended());
3913 EXPECT_TRUE(layer2->quads_appended()); 3913 EXPECT_TRUE(layer2->quads_appended());
3914 host_impl_->DidDrawAllLayers(frame); 3914 host_impl_->DidDrawAllLayers(frame);
3915 3915
3916 // Parent layer with translucent content but opaque painting, drawn without 3916 // Parent layer with translucent content but opaque painting, drawn without
3917 // blending. 3917 // blending.
3918 // Child layer with opaque content, drawn without blending. 3918 // Child layer with opaque content, drawn without blending.
3919 layer1->SetContentsOpaque(true); 3919 layer1->SetContentsOpaque(true);
3920 layer1->SetExpectation(false, false); 3920 layer1->SetExpectation(false, false);
3921 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3921 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3922 layer2->SetExpectation(false, false); 3922 layer2->SetExpectation(false, false);
3923 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3923 layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3924 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3924 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3925 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3925 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3926 EXPECT_TRUE(layer1->quads_appended()); 3926 EXPECT_TRUE(layer1->quads_appended());
3927 EXPECT_TRUE(layer2->quads_appended()); 3927 EXPECT_TRUE(layer2->quads_appended());
3928 host_impl_->DidDrawAllLayers(frame); 3928 host_impl_->DidDrawAllLayers(frame);
3929 3929
3930 // Parent layer with translucent opacity and opaque content. Since it has a 3930 // Parent layer with translucent opacity and opaque content. Since it has a
3931 // drawing child, it's drawn to a render surface which carries the opacity, 3931 // drawing child, it's drawn to a render surface which carries the opacity,
3932 // so it's itself drawn without blending. 3932 // so it's itself drawn without blending.
3933 // Child layer with opaque content, drawn without blending (parent surface 3933 // Child layer with opaque content, drawn without blending (parent surface
3934 // carries the inherited opacity). 3934 // carries the inherited opacity).
3935 layer1->SetContentsOpaque(true); 3935 layer1->SetContentsOpaque(true);
3936 layer1->SetOpacity(0.5f); 3936 layer1->SetOpacity(0.5f);
3937 layer1->SetExpectation(false, true); 3937 layer1->SetExpectation(false, true);
3938 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3938 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3939 layer2->SetExpectation(false, false); 3939 layer2->SetExpectation(false, false);
3940 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3940 layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3941 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( 3941 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(
3942 host_impl_->active_tree()->root_layer()); 3942 host_impl_->active_tree()->root_layer());
3943 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3943 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3944 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3944 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3945 EXPECT_TRUE(layer1->quads_appended()); 3945 EXPECT_TRUE(layer1->quads_appended());
3946 EXPECT_TRUE(layer2->quads_appended()); 3946 EXPECT_TRUE(layer2->quads_appended());
3947 host_impl_->DidDrawAllLayers(frame); 3947 host_impl_->DidDrawAllLayers(frame);
3948 3948
3949 // Draw again, but with child non-opaque, to make sure 3949 // Draw again, but with child non-opaque, to make sure
3950 // layer1 not culled. 3950 // layer1 not culled.
3951 layer1->SetContentsOpaque(true); 3951 layer1->SetContentsOpaque(true);
3952 layer1->SetOpacity(1.f); 3952 layer1->SetOpacity(1.f);
3953 layer1->SetExpectation(false, false); 3953 layer1->SetExpectation(false, false);
3954 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3954 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3955 layer2->SetContentsOpaque(true); 3955 layer2->SetContentsOpaque(true);
3956 layer2->SetOpacity(0.5f); 3956 layer2->SetOpacity(0.5f);
3957 layer2->SetExpectation(true, false); 3957 layer2->SetExpectation(true, false);
3958 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3958 layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3959 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3959 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3960 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3960 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3961 EXPECT_TRUE(layer1->quads_appended()); 3961 EXPECT_TRUE(layer1->quads_appended());
3962 EXPECT_TRUE(layer2->quads_appended()); 3962 EXPECT_TRUE(layer2->quads_appended());
3963 host_impl_->DidDrawAllLayers(frame); 3963 host_impl_->DidDrawAllLayers(frame);
3964 3964
3965 // A second way of making the child non-opaque. 3965 // A second way of making the child non-opaque.
3966 layer1->SetContentsOpaque(true); 3966 layer1->SetContentsOpaque(true);
3967 layer1->SetOpacity(1.f); 3967 layer1->SetOpacity(1.f);
3968 layer1->SetExpectation(false, false); 3968 layer1->SetExpectation(false, false);
3969 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3969 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3970 layer2->SetContentsOpaque(false); 3970 layer2->SetContentsOpaque(false);
3971 layer2->SetOpacity(1.f); 3971 layer2->SetOpacity(1.f);
3972 layer2->SetExpectation(true, false); 3972 layer2->SetExpectation(true, false);
3973 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3973 layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3974 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3974 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3975 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3975 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3976 EXPECT_TRUE(layer1->quads_appended()); 3976 EXPECT_TRUE(layer1->quads_appended());
3977 EXPECT_TRUE(layer2->quads_appended()); 3977 EXPECT_TRUE(layer2->quads_appended());
3978 host_impl_->DidDrawAllLayers(frame); 3978 host_impl_->DidDrawAllLayers(frame);
3979 3979
3980 // And when the layer says its not opaque but is painted opaque, it is not 3980 // And when the layer says its not opaque but is painted opaque, it is not
3981 // blended. 3981 // blended.
3982 layer1->SetContentsOpaque(true); 3982 layer1->SetContentsOpaque(true);
3983 layer1->SetOpacity(1.f); 3983 layer1->SetOpacity(1.f);
3984 layer1->SetExpectation(false, false); 3984 layer1->SetExpectation(false, false);
3985 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3985 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3986 layer2->SetContentsOpaque(true); 3986 layer2->SetContentsOpaque(true);
3987 layer2->SetOpacity(1.f); 3987 layer2->SetOpacity(1.f);
3988 layer2->SetExpectation(false, false); 3988 layer2->SetExpectation(false, false);
3989 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3989 layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
3990 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3990 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3991 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3991 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3992 EXPECT_TRUE(layer1->quads_appended()); 3992 EXPECT_TRUE(layer1->quads_appended());
3993 EXPECT_TRUE(layer2->quads_appended()); 3993 EXPECT_TRUE(layer2->quads_appended());
3994 host_impl_->DidDrawAllLayers(frame); 3994 host_impl_->DidDrawAllLayers(frame);
3995 3995
3996 // Layer with partially opaque contents, drawn with blending. 3996 // Layer with partially opaque contents, drawn with blending.
3997 layer1->SetContentsOpaque(false); 3997 layer1->SetContentsOpaque(false);
3998 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); 3998 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
3999 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 5)); 3999 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 5));
4000 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); 4000 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
4001 layer1->SetExpectation(true, false); 4001 layer1->SetExpectation(true, false);
4002 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 4002 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
4003 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4003 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4004 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4004 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
4005 EXPECT_TRUE(layer1->quads_appended()); 4005 EXPECT_TRUE(layer1->quads_appended());
4006 host_impl_->DidDrawAllLayers(frame); 4006 host_impl_->DidDrawAllLayers(frame);
4007 4007
4008 // Layer with partially opaque contents partially culled, drawn with blending. 4008 // Layer with partially opaque contents partially culled, drawn with blending.
4009 layer1->SetContentsOpaque(false); 4009 layer1->SetContentsOpaque(false);
4010 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); 4010 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
4011 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 2)); 4011 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 2));
4012 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); 4012 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
4013 layer1->SetExpectation(true, false); 4013 layer1->SetExpectation(true, false);
4014 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 4014 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
4015 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4015 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4016 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4016 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
4017 EXPECT_TRUE(layer1->quads_appended()); 4017 EXPECT_TRUE(layer1->quads_appended());
4018 host_impl_->DidDrawAllLayers(frame); 4018 host_impl_->DidDrawAllLayers(frame);
4019 4019
4020 // Layer with partially opaque contents culled, drawn with blending. 4020 // Layer with partially opaque contents culled, drawn with blending.
4021 layer1->SetContentsOpaque(false); 4021 layer1->SetContentsOpaque(false);
4022 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); 4022 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
4023 layer1->SetQuadVisibleRect(gfx::Rect(7, 5, 3, 5)); 4023 layer1->SetQuadVisibleRect(gfx::Rect(7, 5, 3, 5));
4024 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); 4024 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
4025 layer1->SetExpectation(true, false); 4025 layer1->SetExpectation(true, false);
4026 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 4026 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
4027 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4027 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4028 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4028 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
4029 EXPECT_TRUE(layer1->quads_appended()); 4029 EXPECT_TRUE(layer1->quads_appended());
4030 host_impl_->DidDrawAllLayers(frame); 4030 host_impl_->DidDrawAllLayers(frame);
4031 4031
4032 // Layer with partially opaque contents and translucent contents culled, drawn 4032 // Layer with partially opaque contents and translucent contents culled, drawn
4033 // without blending. 4033 // without blending.
4034 layer1->SetContentsOpaque(false); 4034 layer1->SetContentsOpaque(false);
4035 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); 4035 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
4036 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 2, 5)); 4036 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 2, 5));
4037 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); 4037 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
4038 layer1->SetExpectation(false, false); 4038 layer1->SetExpectation(false, false);
4039 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 4039 layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
4040 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4040 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4041 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4041 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
4042 EXPECT_TRUE(layer1->quads_appended()); 4042 EXPECT_TRUE(layer1->quads_appended());
4043 host_impl_->DidDrawAllLayers(frame); 4043 host_impl_->DidDrawAllLayers(frame);
4044 } 4044 }
4045 4045
4046 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest { 4046 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
4047 protected: 4047 protected:
4048 LayerTreeHostImplViewportCoveredTest() : 4048 LayerTreeHostImplViewportCoveredTest() :
4049 gutter_quad_material_(DrawQuad::SOLID_COLOR), 4049 gutter_quad_material_(DrawQuad::SOLID_COLOR),
(...skipping 3221 matching lines...) Expand 10 before | Expand all | Expand 10 after
7271 // surface. 7271 // surface.
7272 EXPECT_EQ(0, num_lost_surfaces_); 7272 EXPECT_EQ(0, num_lost_surfaces_);
7273 host_impl_->DidLoseOutputSurface(); 7273 host_impl_->DidLoseOutputSurface();
7274 EXPECT_EQ(1, num_lost_surfaces_); 7274 EXPECT_EQ(1, num_lost_surfaces_);
7275 host_impl_->DidLoseOutputSurface(); 7275 host_impl_->DidLoseOutputSurface();
7276 EXPECT_LE(1, num_lost_surfaces_); 7276 EXPECT_LE(1, num_lost_surfaces_);
7277 } 7277 }
7278 7278
7279 } // namespace 7279 } // namespace
7280 } // namespace cc 7280 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698