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/layers/picture_layer_impl_unittest.cc

Issue 1231453002: Compute if a layer is clipped outside CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DrawProperties is_clipped removed Created 5 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 SetupPendingTree(valid_pile); 1316 SetupPendingTree(valid_pile);
1317 1317
1318 scoped_ptr<FakePictureLayerImpl> mask_ptr = 1318 scoped_ptr<FakePictureLayerImpl> mask_ptr =
1319 FakePictureLayerImpl::CreateMaskWithRasterSource( 1319 FakePictureLayerImpl::CreateMaskWithRasterSource(
1320 host_impl_.pending_tree(), 3, valid_pile); 1320 host_impl_.pending_tree(), 3, valid_pile);
1321 mask_ptr->SetBounds(layer_bounds); 1321 mask_ptr->SetBounds(layer_bounds);
1322 mask_ptr->SetDrawsContent(true); 1322 mask_ptr->SetDrawsContent(true);
1323 pending_layer_->SetMaskLayer(mask_ptr.Pass()); 1323 pending_layer_->SetMaskLayer(mask_ptr.Pass());
1324 pending_layer_->SetHasRenderSurface(true); 1324 pending_layer_->SetHasRenderSurface(true);
1325 1325
1326 host_impl_.pending_tree()->BuildPropertyTreesForTesting();
1326 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1327 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1327 bool update_lcd_text = false; 1328 bool update_lcd_text = false;
1329 host_impl_.pending_tree()->BuildPropertyTreesForTesting();
ajuma 2015/07/09 14:50:15 Do we need to rebuild property trees again? (Has a
jaydasika 2015/07/09 15:11:49 Done. Its not required here.
1328 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 1330 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
1329 1331
1330 FakePictureLayerImpl* pending_mask = 1332 FakePictureLayerImpl* pending_mask =
1331 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); 1333 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer());
1332 1334
1333 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); 1335 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale());
1334 EXPECT_EQ(1u, pending_mask->num_tilings()); 1336 EXPECT_EQ(1u, pending_mask->num_tilings());
1335 1337
1336 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( 1338 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
1337 pending_mask->HighResTiling()->AllTilesForTesting()); 1339 pending_mask->HighResTiling()->AllTilesForTesting());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 SetupPendingTree(valid_pile); 1447 SetupPendingTree(valid_pile);
1446 1448
1447 scoped_ptr<FakePictureLayerImpl> mask_ptr = 1449 scoped_ptr<FakePictureLayerImpl> mask_ptr =
1448 FakePictureLayerImpl::CreateMaskWithRasterSource( 1450 FakePictureLayerImpl::CreateMaskWithRasterSource(
1449 host_impl_.pending_tree(), 3, valid_pile); 1451 host_impl_.pending_tree(), 3, valid_pile);
1450 mask_ptr->SetBounds(layer_bounds); 1452 mask_ptr->SetBounds(layer_bounds);
1451 mask_ptr->SetDrawsContent(true); 1453 mask_ptr->SetDrawsContent(true);
1452 pending_layer_->SetMaskLayer(mask_ptr.Pass()); 1454 pending_layer_->SetMaskLayer(mask_ptr.Pass());
1453 pending_layer_->SetHasRenderSurface(true); 1455 pending_layer_->SetHasRenderSurface(true);
1454 1456
1457 host_impl_.pending_tree()->BuildPropertyTreesForTesting();
1455 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1458 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1456 bool update_lcd_text = false; 1459 bool update_lcd_text = false;
1460 host_impl_.pending_tree()->BuildPropertyTreesForTesting();
ajuma 2015/07/09 14:50:15 Here too, do we need to rebuild again?
jaydasika 2015/07/09 15:11:49 Done. Not required here too
1457 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 1461 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
1458 1462
1459 FakePictureLayerImpl* pending_mask = 1463 FakePictureLayerImpl* pending_mask =
1460 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); 1464 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer());
1461 1465
1462 // Masks are scaled, and do not have a low res tiling. 1466 // Masks are scaled, and do not have a low res tiling.
1463 EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale()); 1467 EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale());
1464 EXPECT_EQ(1u, pending_mask->num_tilings()); 1468 EXPECT_EQ(1u, pending_mask->num_tilings());
1465 1469
1466 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( 1470 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
(...skipping 3484 matching lines...) Expand 10 before | Expand all | Expand 10 after
4951 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4955 result = layer->CalculateTileSize(gfx::Size(447, 400));
4952 EXPECT_EQ(result.width(), 448); 4956 EXPECT_EQ(result.width(), 448);
4953 EXPECT_EQ(result.height(), 448); 4957 EXPECT_EQ(result.height(), 448);
4954 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4958 result = layer->CalculateTileSize(gfx::Size(500, 499));
4955 EXPECT_EQ(result.width(), 512); 4959 EXPECT_EQ(result.width(), 512);
4956 EXPECT_EQ(result.height(), 500 + 2); 4960 EXPECT_EQ(result.height(), 500 + 2);
4957 } 4961 }
4958 4962
4959 } // namespace 4963 } // namespace
4960 } // namespace cc 4964 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698