OLD | NEW |
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_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 // Since the layer is transparent, render_surface1->render_surface() should | 1182 // Since the layer is transparent, render_surface1->render_surface() should |
1183 // not have gotten added anywhere. Also, the drawable content rect should not | 1183 // not have gotten added anywhere. Also, the drawable content rect should not |
1184 // have been extended by the children. | 1184 // have been extended by the children. |
1185 ASSERT_TRUE(parent->render_surface()); | 1185 ASSERT_TRUE(parent->render_surface()); |
1186 EXPECT_EQ(0U, parent->render_surface()->layer_list().size()); | 1186 EXPECT_EQ(0U, parent->render_surface()->layer_list().size()); |
1187 EXPECT_EQ(1U, render_surface_layer_list.size()); | 1187 EXPECT_EQ(1U, render_surface_layer_list.size()); |
1188 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); | 1188 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); |
1189 EXPECT_EQ(gfx::Rect(), parent->drawable_content_rect()); | 1189 EXPECT_EQ(gfx::Rect(), parent->drawable_content_rect()); |
1190 } | 1190 } |
1191 | 1191 |
| 1192 TEST_F(LayerTreeHostCommonTest, |
| 1193 RenderSurfaceListForTransparentChildWithBackgroundFilter) { |
| 1194 LayerImpl* parent = root_layer(); |
| 1195 LayerImpl* render_surface1 = AddChild<LayerImpl>(parent); |
| 1196 LayerImpl* child = AddChild<LayerImpl>(render_surface1); |
| 1197 child->SetDrawsContent(true); |
| 1198 |
| 1199 const gfx::Transform identity_matrix; |
| 1200 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| 1201 gfx::PointF(), gfx::Size(10, 10), true, false, |
| 1202 true); |
| 1203 SetLayerPropertiesForTesting(render_surface1, identity_matrix, gfx::Point3F(), |
| 1204 gfx::PointF(), gfx::Size(10, 10), true, false, |
| 1205 true); |
| 1206 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), |
| 1207 gfx::PointF(), gfx::Size(10, 10), true, false, |
| 1208 false); |
| 1209 render_surface1->SetOpacity(0.f); |
| 1210 FilterOperations filters; |
| 1211 filters.Append(FilterOperation::CreateBlurFilter(1.5f)); |
| 1212 render_surface1->SetBackgroundFilters(filters); |
| 1213 |
| 1214 LayerImplList render_surface_layer_list; |
| 1215 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 1216 parent, parent->bounds(), &render_surface_layer_list); |
| 1217 inputs.can_adjust_raster_scales = true; |
| 1218 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 1219 |
| 1220 // The layer is fully transparent, but has a background filter, so it |
| 1221 // shouldn't be skipped. |
| 1222 ASSERT_TRUE(parent->render_surface()); |
| 1223 EXPECT_EQ(1U, parent->render_surface()->layer_list().size()); |
| 1224 EXPECT_EQ(2U, render_surface_layer_list.size()); |
| 1225 EXPECT_EQ(gfx::Rect(0, 0, 10, 10), parent->drawable_content_rect()); |
| 1226 } |
| 1227 |
1192 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { | 1228 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { |
1193 LayerImpl* parent = root_layer(); | 1229 LayerImpl* parent = root_layer(); |
1194 LayerImpl* child = AddChild<LayerImpl>(parent); | 1230 LayerImpl* child = AddChild<LayerImpl>(parent); |
1195 child->SetDrawsContent(true); | 1231 child->SetDrawsContent(true); |
1196 | 1232 |
1197 const gfx::Transform identity_matrix; | 1233 const gfx::Transform identity_matrix; |
1198 const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; | 1234 const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; |
1199 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | 1235 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
1200 gfx::PointF(), gfx::Size(10, 10), true, false, | 1236 gfx::PointF(), gfx::Size(10, 10), true, false, |
1201 true); | 1237 true); |
(...skipping 6598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7800 gfx::PointF(), gfx::Size(30, 30), true, false, | 7836 gfx::PointF(), gfx::Size(30, 30), true, false, |
7801 false); | 7837 false); |
7802 | 7838 |
7803 ExecuteCalculateDrawProperties(root); | 7839 ExecuteCalculateDrawProperties(root); |
7804 | 7840 |
7805 EXPECT_EQ(test_layer->clip_rect(), gfx::RectF(-4, -4, 30, 30)); | 7841 EXPECT_EQ(test_layer->clip_rect(), gfx::RectF(-4, -4, 30, 30)); |
7806 } | 7842 } |
7807 | 7843 |
7808 } // namespace | 7844 } // namespace |
7809 } // namespace cc | 7845 } // namespace cc |
OLD | NEW |