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

Side by Side Diff: cc/layers/picture_layer_impl.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 | « no previous file | cc/layers/picture_layer_impl_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 10
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 476 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
477 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( 477 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime(
478 current_frame_time_in_seconds)) { 478 current_frame_time_in_seconds)) {
479 tiling_needs_update = true; 479 tiling_needs_update = true;
480 break; 480 break;
481 } 481 }
482 } 482 }
483 if (!tiling_needs_update) 483 if (!tiling_needs_update)
484 return; 484 return;
485 485
486 gfx::Rect visible_layer_rect = GetViewportForTilePriorityInContentSpace(); 486 gfx::Rect viewport_rect_in_layer_space =
487 GetViewportForTilePriorityInContentSpace();
487 WhichTree tree = 488 WhichTree tree =
488 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; 489 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
489 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 490 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
490 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since 491 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since
491 // they are the same space in picture lbayer, as contents scale is always 1. 492 // they are the same space in picture lbayer, as contents scale is always 1.
492 tilings_->tiling_at(i)->UpdateTilePriorities(tree, 493 tilings_->tiling_at(i)->UpdateTilePriorities(tree,
493 visible_layer_rect, 494 viewport_rect_in_layer_space,
494 ideal_contents_scale_, 495 ideal_contents_scale_,
495 current_frame_time_in_seconds, 496 current_frame_time_in_seconds,
496 occlusion_in_content_space); 497 occlusion_in_content_space);
497 } 498 }
498 499
499 // Tile priorities were modified. 500 // Tile priorities were modified.
500 layer_tree_impl()->DidModifyTilePriorities(); 501 layer_tree_impl()->DidModifyTilePriorities();
501 } 502 }
502 503
503 gfx::Rect PictureLayerImpl::GetViewportForTilePriorityInContentSpace() const { 504 gfx::Rect PictureLayerImpl::GetViewportForTilePriorityInContentSpace() const {
504 // If visible_rect_for_tile_priority_ is empty or 505 // If visible_rect_for_tile_priority_ is empty or
505 // viewport_rect_for_tile_priority_ is set to be different from the device 506 // viewport_rect_for_tile_priority_ is set to be different from the device
506 // viewport, try to inverse project the viewport into layer space and use 507 // viewport, try to inverse project the viewport into layer space and use
507 // that. Otherwise just use visible_rect_for_tile_priority_ 508 // that. Otherwise just use visible_rect_for_tile_priority_
508 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; 509 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_;
509 510
510 if (visible_rect_in_content_space.IsEmpty() || 511 if (visible_rect_in_content_space.IsEmpty() ||
511 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority_) { 512 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority_) {
512 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); 513 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization);
513 514
514 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) { 515 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) {
515 // Transform from view space to content space. 516 // Transform from view space to content space.
516 visible_rect_in_content_space = 517 visible_rect_in_content_space =
517 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( 518 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect(
518 view_to_layer, viewport_rect_for_tile_priority_)); 519 view_to_layer, viewport_rect_for_tile_priority_));
519
520 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds()));
521 } 520 }
522 } 521 }
523
524 visible_rect_in_content_space.Intersect(visible_content_rect());
525 return visible_rect_in_content_space; 522 return visible_rect_in_content_space;
526 } 523 }
527 524
528 PictureLayerImpl* PictureLayerImpl::GetRecycledTwinLayer() { 525 PictureLayerImpl* PictureLayerImpl::GetRecycledTwinLayer() {
529 // TODO(vmpstr): Maintain recycled twin as a member. crbug.com/407418 526 // TODO(vmpstr): Maintain recycled twin as a member. crbug.com/407418
530 return static_cast<PictureLayerImpl*>( 527 return static_cast<PictureLayerImpl*>(
531 layer_tree_impl()->FindRecycleTreeLayerById(id())); 528 layer_tree_impl()->FindRecycleTreeLayerById(id()));
532 } 529 }
533 530
534 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { 531 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 780
784 // First, early out for layers with no visible content. 781 // First, early out for layers with no visible content.
785 if (visible_content_rect().IsEmpty()) 782 if (visible_content_rect().IsEmpty())
786 return; 783 return;
787 784
788 // Only mark tiles inside the viewport for tile priority as required for 785 // Only mark tiles inside the viewport for tile priority as required for
789 // activation. This viewport is normally the same as the draw viewport but 786 // activation. This viewport is normally the same as the draw viewport but
790 // can be independently overridden by embedders like Android WebView with 787 // can be independently overridden by embedders like Android WebView with
791 // SetExternalDrawConstraints. 788 // SetExternalDrawConstraints.
792 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); 789 gfx::Rect rect = GetViewportForTilePriorityInContentSpace();
790 rect.Intersect(visible_content_rect());
793 791
794 float min_acceptable_scale = 792 float min_acceptable_scale =
795 std::min(raster_contents_scale_, ideal_contents_scale_); 793 std::min(raster_contents_scale_, ideal_contents_scale_);
796 794
797 if (PictureLayerImpl* twin = twin_layer_) { 795 if (PictureLayerImpl* twin = twin_layer_) {
798 float twin_min_acceptable_scale = 796 float twin_min_acceptable_scale =
799 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); 797 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_);
800 // Ignore 0 scale in case CalculateContentsScale() has never been 798 // Ignore 0 scale in case CalculateContentsScale() has never been
801 // called for active twin. 799 // called for active twin.
802 if (twin_min_acceptable_scale != 0.0f) { 800 if (twin_min_acceptable_scale != 0.0f) {
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); 1756 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange();
1759 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; 1757 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start;
1760 return tiling_range.end - 1 - current_tiling_range_offset; 1758 return tiling_range.end - 1 - current_tiling_range_offset;
1761 } 1759 }
1762 } 1760 }
1763 NOTREACHED(); 1761 NOTREACHED();
1764 return 0; 1762 return 0;
1765 } 1763 }
1766 1764
1767 } // namespace cc 1765 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698