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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 577753002: cc: Don't clip tile priority visible rect to content bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +comment Created 6 years, 3 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/layers/picture_layer_impl.cc ('k') | cc/resources/picture_layer_tiling.h » ('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 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 transform_for_tile_priority, 390 transform_for_tile_priority,
391 resourceless_software_draw); 391 resourceless_software_draw);
392 active_layer_->draw_properties().visible_content_rect = viewport; 392 active_layer_->draw_properties().visible_content_rect = viewport;
393 active_layer_->draw_properties().screen_space_transform = transform; 393 active_layer_->draw_properties().screen_space_transform = transform;
394 active_layer_->UpdateTiles(Occlusion()); 394 active_layer_->UpdateTiles(Occlusion());
395 395
396 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization); 396 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization);
397 bool success = transform_for_tile_priority.GetInverse(&screen_to_view); 397 bool success = transform_for_tile_priority.GetInverse(&screen_to_view);
398 EXPECT_TRUE(success); 398 EXPECT_TRUE(success);
399 399
400 // Note that we don't clip this to the layer bounds, since it is expected that
401 // the rect will sometimes be outside of the layer bounds. If we clip to
402 // bounds, then tile priorities will end up being incorrect in cases of fully
403 // offscreen layer.
400 viewport_rect_for_tile_priority_in_view_space = 404 viewport_rect_for_tile_priority_in_view_space =
401 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( 405 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect(
402 screen_to_view, viewport_rect_for_tile_priority)); 406 screen_to_view, viewport_rect_for_tile_priority));
403 407
404 // Verify the viewport rect for tile priority is used in PictureLayerImpl. 408 // Verify the viewport rect for tile priority is used in PictureLayerImpl.
405 EXPECT_EQ(active_layer_->viewport_rect_for_tile_priority(), 409 EXPECT_EQ(active_layer_->viewport_rect_for_tile_priority(),
406 viewport_rect_for_tile_priority_in_view_space); 410 viewport_rect_for_tile_priority_in_view_space);
407 411
408 // Interset viewport_rect_for_tile_priority_in_view_space with the layer
409 // bounds and the result should be used in PictureLayerTiling.
410 viewport_rect_for_tile_priority_in_view_space.Intersect(
411 gfx::Rect(layer_bounds));
412 tilings = active_layer_->tilings(); 412 tilings = active_layer_->tilings();
413 for (size_t i = 0; i < tilings->num_tilings(); i++) { 413 for (size_t i = 0; i < tilings->num_tilings(); i++) {
414 PictureLayerTiling* tiling = tilings->tiling_at(i); 414 PictureLayerTiling* tiling = tilings->tiling_at(i);
415 EXPECT_EQ( 415 EXPECT_EQ(
416 tiling->GetCurrentVisibleRectForTesting(), 416 tiling->GetCurrentVisibleRectForTesting(),
417 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, 417 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space,
418 tiling->contents_scale())); 418 tiling->contents_scale()));
419 } 419 }
420 } 420 }
421 421
(...skipping 3795 matching lines...) Expand 10 before | Expand all | Expand 10 after
4217 ActivateTree(); 4217 ActivateTree();
4218 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); 4218 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer());
4219 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); 4219 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer());
4220 4220
4221 host_impl_.ResetRecycleTreeForTesting(); 4221 host_impl_.ResetRecycleTreeForTesting();
4222 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); 4222 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer());
4223 } 4223 }
4224 4224
4225 } // namespace 4225 } // namespace
4226 } // namespace cc 4226 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698