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

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

Issue 551463005: Revert of cc: Add occlusion checker as a fixed view of occlusion tracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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.h ('k') | 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 414
415 // Aggressively remove any tilings that are not seen to save memory. Note 415 // Aggressively remove any tilings that are not seen to save memory. Note
416 // that this is at the expense of doing cause more frequent re-painting. A 416 // that this is at the expense of doing cause more frequent re-painting. A
417 // better scheme would be to maintain a tighter visible_content_rect for the 417 // better scheme would be to maintain a tighter visible_content_rect for the
418 // finer tilings. 418 // finer tilings.
419 CleanUpTilingsOnActiveLayer(seen_tilings); 419 CleanUpTilingsOnActiveLayer(seen_tilings);
420 } 420 }
421 421
422 void PictureLayerImpl::UpdateTiles( 422 void PictureLayerImpl::UpdateTiles(
423 const Occlusion& occlusion_in_content_space) { 423 const OcclusionTracker<LayerImpl>* occlusion_tracker) {
424 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTiles"); 424 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTiles");
425 425
426 DoPostCommitInitializationIfNeeded(); 426 DoPostCommitInitializationIfNeeded();
427 427
428 // TODO(danakj): We should always get an occlusion tracker when we are using
429 // occlusion, so update this check when we don't use a pending tree in the
430 // browser compositor.
431 DCHECK(!occlusion_tracker ||
432 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization);
433
428 visible_rect_for_tile_priority_ = visible_content_rect(); 434 visible_rect_for_tile_priority_ = visible_content_rect();
429 viewport_rect_for_tile_priority_ = 435 viewport_rect_for_tile_priority_ =
430 layer_tree_impl()->ViewportRectForTilePriority(); 436 layer_tree_impl()->ViewportRectForTilePriority();
431 screen_space_transform_for_tile_priority_ = screen_space_transform(); 437 screen_space_transform_for_tile_priority_ = screen_space_transform();
432 438
433 if (!CanHaveTilings()) { 439 if (!CanHaveTilings()) {
434 ideal_page_scale_ = 0.f; 440 ideal_page_scale_ = 0.f;
435 ideal_device_scale_ = 0.f; 441 ideal_device_scale_ = 0.f;
436 ideal_contents_scale_ = 0.f; 442 ideal_contents_scale_ = 0.f;
437 ideal_source_scale_ = 0.f; 443 ideal_source_scale_ = 0.f;
(...skipping 14 matching lines...) Expand all
452 DCHECK(raster_device_scale_); 458 DCHECK(raster_device_scale_);
453 DCHECK(raster_source_scale_); 459 DCHECK(raster_source_scale_);
454 DCHECK(raster_contents_scale_); 460 DCHECK(raster_contents_scale_);
455 DCHECK(low_res_raster_contents_scale_); 461 DCHECK(low_res_raster_contents_scale_);
456 462
457 was_screen_space_transform_animating_ = 463 was_screen_space_transform_animating_ =
458 draw_properties().screen_space_transform_is_animating; 464 draw_properties().screen_space_transform_is_animating;
459 465
460 should_update_tile_priorities_ = true; 466 should_update_tile_priorities_ = true;
461 467
462 UpdateTilePriorities(occlusion_in_content_space); 468 UpdateTilePriorities(occlusion_tracker);
463 469
464 if (layer_tree_impl()->IsPendingTree()) 470 if (layer_tree_impl()->IsPendingTree())
465 MarkVisibleResourcesAsRequired(); 471 MarkVisibleResourcesAsRequired();
466 } 472 }
467 473
468 void PictureLayerImpl::UpdateTilePriorities( 474 void PictureLayerImpl::UpdateTilePriorities(
469 const Occlusion& occlusion_in_content_space) { 475 const OcclusionTracker<LayerImpl>* occlusion_tracker) {
470 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); 476 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities");
471 477
472 double current_frame_time_in_seconds = 478 double current_frame_time_in_seconds =
473 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - 479 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time -
474 base::TimeTicks()).InSecondsF(); 480 base::TimeTicks()).InSecondsF();
475 481
476 bool tiling_needs_update = false; 482 bool tiling_needs_update = false;
477 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 483 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
478 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( 484 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime(
479 current_frame_time_in_seconds)) { 485 current_frame_time_in_seconds)) {
480 tiling_needs_update = true; 486 tiling_needs_update = true;
481 break; 487 break;
482 } 488 }
483 } 489 }
484 if (!tiling_needs_update) 490 if (!tiling_needs_update)
485 return; 491 return;
486 492
487 gfx::Rect visible_rect_in_content_space( 493 gfx::Rect visible_rect_in_content_space(
488 GetViewportForTilePriorityInContentSpace()); 494 GetViewportForTilePriorityInContentSpace());
489 visible_rect_in_content_space.Intersect(visible_content_rect()); 495 visible_rect_in_content_space.Intersect(visible_content_rect());
490 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( 496 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect(
491 visible_rect_in_content_space, 1.f / contents_scale_x()); 497 visible_rect_in_content_space, 1.f / contents_scale_x());
492 WhichTree tree = 498 WhichTree tree =
493 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; 499 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
494 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 500 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
495 tilings_->tiling_at(i)->UpdateTilePriorities(tree, 501 tilings_->tiling_at(i)->UpdateTilePriorities(tree,
496 visible_layer_rect, 502 visible_layer_rect,
497 ideal_contents_scale_, 503 ideal_contents_scale_,
498 current_frame_time_in_seconds, 504 current_frame_time_in_seconds,
499 occlusion_in_content_space); 505 occlusion_tracker,
506 render_target(),
507 draw_transform());
500 } 508 }
501 509
502 // Tile priorities were modified. 510 // Tile priorities were modified.
503 layer_tree_impl()->DidModifyTilePriorities(); 511 layer_tree_impl()->DidModifyTilePriorities();
504 } 512 }
505 513
506 gfx::Rect PictureLayerImpl::GetViewportForTilePriorityInContentSpace() const { 514 gfx::Rect PictureLayerImpl::GetViewportForTilePriorityInContentSpace() const {
507 // If visible_rect_for_tile_priority_ is empty or 515 // If visible_rect_for_tile_priority_ is empty or
508 // viewport_rect_for_tile_priority_ is set to be different from the device 516 // viewport_rect_for_tile_priority_ is set to be different from the device
509 // viewport, try to inverse project the viewport into layer space and use 517 // viewport, try to inverse project the viewport into layer space and use
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 // If this tree needs update draw properties, then the tiling will 749 // If this tree needs update draw properties, then the tiling will
742 // get updated prior to drawing or activation. If this tree does not 750 // get updated prior to drawing or activation. If this tree does not
743 // need update draw properties, then its transforms are up to date and 751 // need update draw properties, then its transforms are up to date and
744 // we can create tiles for this tiling immediately. 752 // we can create tiles for this tiling immediately.
745 if (!layer_tree_impl()->needs_update_draw_properties() && 753 if (!layer_tree_impl()->needs_update_draw_properties() &&
746 should_update_tile_priorities_) { 754 should_update_tile_priorities_) {
747 // TODO(danakj): Add a DCHECK() that we are not using occlusion tracking 755 // TODO(danakj): Add a DCHECK() that we are not using occlusion tracking
748 // when we stop using the pending tree in the browser compositor. If we want 756 // when we stop using the pending tree in the browser compositor. If we want
749 // to support occlusion tracking here, we need to dirty the draw properties 757 // to support occlusion tracking here, we need to dirty the draw properties
750 // or save occlusion as a draw property. 758 // or save occlusion as a draw property.
751 UpdateTilePriorities(Occlusion()); 759 UpdateTilePriorities(NULL);
752 } 760 }
753 } 761 }
754 762
755 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const { 763 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const {
756 gfx::Rect content_rect(content_bounds()); 764 gfx::Rect content_rect(content_bounds());
757 float scale = MaximumTilingContentsScale(); 765 float scale = MaximumTilingContentsScale();
758 PictureLayerTilingSet::CoverageIterator iter( 766 PictureLayerTilingSet::CoverageIterator iter(
759 tilings_.get(), scale, content_rect, ideal_contents_scale_); 767 tilings_.get(), scale, content_rect, ideal_contents_scale_);
760 768
761 // Mask resource not ready yet. 769 // Mask resource not ready yet.
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); 1770 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange();
1763 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; 1771 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start;
1764 return tiling_range.end - 1 - current_tiling_range_offset; 1772 return tiling_range.end - 1 - current_tiling_range_offset;
1765 } 1773 }
1766 } 1774 }
1767 NOTREACHED(); 1775 NOTREACHED();
1768 return 0; 1776 return 0;
1769 } 1777 }
1770 1778
1771 } // namespace cc 1779 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698