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

Side by Side Diff: cc/resources/picture_layer_tiling.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/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_perftest.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/resources/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
11 11
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/debug/trace_event_argument.h" 13 #include "base/debug/trace_event_argument.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "cc/base/math_util.h" 15 #include "cc/base/math_util.h"
16 #include "cc/resources/tile.h" 16 #include "cc/resources/tile.h"
17 #include "cc/resources/tile_priority.h" 17 #include "cc/resources/tile_priority.h"
18 #include "cc/trees/occlusion_tracker.h"
18 #include "ui/gfx/point_conversions.h" 19 #include "ui/gfx/point_conversions.h"
19 #include "ui/gfx/rect_conversions.h" 20 #include "ui/gfx/rect_conversions.h"
20 #include "ui/gfx/safe_integer_conversions.h" 21 #include "ui/gfx/safe_integer_conversions.h"
21 #include "ui/gfx/size_conversions.h" 22 #include "ui/gfx/size_conversions.h"
22 23
23 namespace cc { 24 namespace cc {
24 namespace { 25 namespace {
25 26
26 const float kSoonBorderDistanceInScreenPixels = 312.f; 27 const float kSoonBorderDistanceInScreenPixels = 312.f;
27 28
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // Finally, ensure that visible rect is contained in the skewport. 533 // Finally, ensure that visible rect is contained in the skewport.
533 skewport.Union(visible_rect_in_content_space); 534 skewport.Union(visible_rect_in_content_space);
534 return skewport; 535 return skewport;
535 } 536 }
536 537
537 void PictureLayerTiling::UpdateTilePriorities( 538 void PictureLayerTiling::UpdateTilePriorities(
538 WhichTree tree, 539 WhichTree tree,
539 const gfx::Rect& visible_layer_rect, 540 const gfx::Rect& visible_layer_rect,
540 float ideal_contents_scale, 541 float ideal_contents_scale,
541 double current_frame_time_in_seconds, 542 double current_frame_time_in_seconds,
542 const Occlusion& occlusion_in_layer_space) { 543 const OcclusionTracker<LayerImpl>* occlusion_tracker,
544 const LayerImpl* render_target,
545 const gfx::Transform& draw_transform) {
543 if (!NeedsUpdateForFrameAtTime(current_frame_time_in_seconds)) { 546 if (!NeedsUpdateForFrameAtTime(current_frame_time_in_seconds)) {
544 // This should never be zero for the purposes of has_ever_been_updated(). 547 // This should never be zero for the purposes of has_ever_been_updated().
545 DCHECK_NE(current_frame_time_in_seconds, 0.0); 548 DCHECK_NE(current_frame_time_in_seconds, 0.0);
546 return; 549 return;
547 } 550 }
548 551
549 gfx::Rect visible_rect_in_content_space = 552 gfx::Rect visible_rect_in_content_space =
550 gfx::ScaleToEnclosingRect(visible_layer_rect, contents_scale_); 553 gfx::ScaleToEnclosingRect(visible_layer_rect, contents_scale_);
551 554
552 if (tiling_size().IsEmpty()) { 555 if (tiling_size().IsEmpty()) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 ++iter) { 598 ++iter) {
596 TileMap::iterator find = tiles_.find(iter.index()); 599 TileMap::iterator find = tiles_.find(iter.index());
597 if (find == tiles_.end()) 600 if (find == tiles_.end())
598 continue; 601 continue;
599 has_visible_rect_tiles_ = true; 602 has_visible_rect_tiles_ = true;
600 Tile* tile = find->second.get(); 603 Tile* tile = find->second.get();
601 604
602 tile->SetPriority(tree, now_priority); 605 tile->SetPriority(tree, now_priority);
603 606
604 // Set whether tile is occluded or not. 607 // Set whether tile is occluded or not.
605 gfx::Rect tile_query_rect = ScaleToEnclosingRect( 608 bool is_occluded = false;
606 IntersectRects(tile->content_rect(), visible_rect_in_content_space), 609 if (occlusion_tracker) {
607 1.0f / contents_scale_); 610 gfx::Rect tile_query_rect = ScaleToEnclosingRect(
608 bool is_occluded = occlusion_in_layer_space.IsOccluded(tile_query_rect); 611 IntersectRects(tile->content_rect(), visible_rect_in_content_space),
612 1.0f / contents_scale_);
613 // TODO(vmpstr): Remove render_target and draw_transform from the
614 // parameters so they can be hidden from the tiling.
615 is_occluded = occlusion_tracker->Occluded(
616 render_target, tile_query_rect, draw_transform);
617 }
609 tile->set_is_occluded(tree, is_occluded); 618 tile->set_is_occluded(tree, is_occluded);
610 } 619 }
611 620
612 // Assign soon priority to skewport tiles. 621 // Assign soon priority to skewport tiles.
613 has_skewport_rect_tiles_ = false; 622 has_skewport_rect_tiles_ = false;
614 for (TilingData::DifferenceIterator iter( 623 for (TilingData::DifferenceIterator iter(
615 &tiling_data_, skewport, visible_rect_in_content_space); 624 &tiling_data_, skewport, visible_rect_in_content_space);
616 iter; 625 iter;
617 ++iter) { 626 ++iter) {
618 TileMap::iterator find = tiles_.find(iter.index()); 627 TileMap::iterator find = tiles_.find(iter.index());
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 DCHECK(*this); 1200 DCHECK(*this);
1192 do { 1201 do {
1193 ++current_eviction_tiles_index_; 1202 ++current_eviction_tiles_index_;
1194 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && 1203 } while (current_eviction_tiles_index_ != eviction_tiles_->size() &&
1195 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); 1204 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources());
1196 1205
1197 return *this; 1206 return *this;
1198 } 1207 }
1199 1208
1200 } // namespace cc 1209 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698