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

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

Issue 1517693002: Accelerated filters should filter unpadded primitives. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do background rect outsetting before window intersection Created 4 years, 11 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_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 1355
1356 // The layer is fully transparent, but has a background filter, so it 1356 // The layer is fully transparent, but has a background filter, so it
1357 // shouldn't be skipped. 1357 // shouldn't be skipped.
1358 ASSERT_TRUE(parent->render_surface()); 1358 ASSERT_TRUE(parent->render_surface());
1359 EXPECT_EQ(1U, parent->render_surface()->layer_list().size()); 1359 EXPECT_EQ(1U, parent->render_surface()->layer_list().size());
1360 EXPECT_EQ(2U, render_surface_layer_list.size()); 1360 EXPECT_EQ(2U, render_surface_layer_list.size());
1361 EXPECT_EQ(gfx::RectF(0, 0, 10, 10), 1361 EXPECT_EQ(gfx::RectF(0, 0, 10, 10),
1362 parent->render_surface()->DrawableContentRect()); 1362 parent->render_surface()->DrawableContentRect());
1363 } 1363 }
1364 1364
1365 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForFilter) {
1366 LayerImpl* root = root_layer();
1367 LayerImpl* parent = AddChild<LayerImpl>(root);
1368 LayerImpl* child1 = AddChild<LayerImpl>(parent);
1369 LayerImpl* child2 = AddChild<LayerImpl>(parent);
1370 child1->SetDrawsContent(true);
1371 child2->SetDrawsContent(true);
1372
1373 const gfx::Transform identity_matrix;
1374 gfx::Transform scale_matrix;
1375 scale_matrix.Scale(2.0f, 2.0f);
1376 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
1377 gfx::PointF(), gfx::Size(100, 100), true, false,
1378 true);
1379 SetLayerPropertiesForTesting(parent, scale_matrix, gfx::Point3F(),
1380 gfx::PointF(), gfx::Size(), true, false, true);
1381 SetLayerPropertiesForTesting(child1, identity_matrix, gfx::Point3F(),
1382 gfx::PointF(0, 0), gfx::Size(25, 25), true,
1383 false, true);
1384 SetLayerPropertiesForTesting(child2, identity_matrix, gfx::Point3F(),
1385 gfx::PointF(25, 25), gfx::Size(25, 25), true,
1386 false, true);
1387 FilterOperations filters;
1388 filters.Append(FilterOperation::CreateBlurFilter(10.0f));
1389 parent->SetFilters(filters);
1390
1391 LayerImplList render_surface_layer_list;
1392 parent->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
1393 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
1394 root, root->bounds(), &render_surface_layer_list,
1395 root->layer_tree_impl()->current_render_surface_list_id());
1396 inputs.can_adjust_raster_scales = true;
1397 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
1398
1399 ASSERT_TRUE(parent->render_surface());
1400 EXPECT_EQ(2U, parent->render_surface()->layer_list().size());
1401 EXPECT_EQ(4U, render_surface_layer_list.size());
1402 EXPECT_EQ(gfx::RectF(-29, -29, 158, 158),
1403 parent->render_surface()->DrawableContentRect());
1404 }
1405
1365 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { 1406 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) {
1366 LayerImpl* parent = root_layer(); 1407 LayerImpl* parent = root_layer();
1367 LayerImpl* child = AddChild<LayerImpl>(parent); 1408 LayerImpl* child = AddChild<LayerImpl>(parent);
1368 child->SetDrawsContent(true); 1409 child->SetDrawsContent(true);
1369 1410
1370 const gfx::Transform identity_matrix; 1411 const gfx::Transform identity_matrix;
1371 const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; 1412 const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode;
1372 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), 1413 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(),
1373 gfx::PointF(), gfx::Size(10, 10), true, false, 1414 gfx::PointF(), gfx::Size(10, 10), true, false,
1374 true); 1415 true);
(...skipping 8297 matching lines...) Expand 10 before | Expand all | Expand 10 after
9672 proto::ScrollAndScaleSet proto; 9713 proto::ScrollAndScaleSet proto;
9673 scroll_and_scale_set.ToProtobuf(&proto); 9714 scroll_and_scale_set.ToProtobuf(&proto);
9674 ScrollAndScaleSet new_scroll_and_scale_set; 9715 ScrollAndScaleSet new_scroll_and_scale_set;
9675 new_scroll_and_scale_set.FromProtobuf(proto); 9716 new_scroll_and_scale_set.FromProtobuf(proto);
9676 9717
9677 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); 9718 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set));
9678 } 9719 }
9679 9720
9680 } // namespace 9721 } // namespace
9681 } // namespace cc 9722 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698