| OLD | NEW |
| 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> |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 skewport.Union(visible_rect_in_content_space); | 533 skewport.Union(visible_rect_in_content_space); |
| 534 return skewport; | 534 return skewport; |
| 535 } | 535 } |
| 536 | 536 |
| 537 void PictureLayerTiling::UpdateTilePriorities( | 537 void PictureLayerTiling::UpdateTilePriorities( |
| 538 WhichTree tree, | 538 WhichTree tree, |
| 539 const gfx::Rect& viewport_in_layer_space, | 539 const gfx::Rect& viewport_in_layer_space, |
| 540 float ideal_contents_scale, | 540 float ideal_contents_scale, |
| 541 double current_frame_time_in_seconds, | 541 double current_frame_time_in_seconds, |
| 542 const Occlusion& occlusion_in_layer_space) { | 542 const Occlusion& occlusion_in_layer_space) { |
| 543 if (!NeedsUpdateForFrameAtTime(current_frame_time_in_seconds)) { | 543 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, |
| 544 viewport_in_layer_space)) { |
| 544 // This should never be zero for the purposes of has_ever_been_updated(). | 545 // This should never be zero for the purposes of has_ever_been_updated(). |
| 545 DCHECK_NE(current_frame_time_in_seconds, 0.0); | 546 DCHECK_NE(current_frame_time_in_seconds, 0.0); |
| 546 return; | 547 return; |
| 547 } | 548 } |
| 548 | 549 |
| 549 gfx::Rect visible_rect_in_content_space = | 550 gfx::Rect visible_rect_in_content_space = |
| 550 gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_); | 551 gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_); |
| 551 | 552 |
| 552 if (tiling_size().IsEmpty()) { | 553 if (tiling_size().IsEmpty()) { |
| 553 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; | 554 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; |
| 555 last_viewport_in_layer_space_ = viewport_in_layer_space; |
| 554 last_visible_rect_in_content_space_ = visible_rect_in_content_space; | 556 last_visible_rect_in_content_space_ = visible_rect_in_content_space; |
| 555 return; | 557 return; |
| 556 } | 558 } |
| 557 | 559 |
| 558 size_t max_tiles_for_interest_area = client_->GetMaxTilesForInterestArea(); | 560 size_t max_tiles_for_interest_area = client_->GetMaxTilesForInterestArea(); |
| 559 | 561 |
| 560 gfx::Size tile_size = tiling_data_.max_texture_size(); | 562 gfx::Size tile_size = tiling_data_.max_texture_size(); |
| 561 int64 eventually_rect_area = | 563 int64 eventually_rect_area = |
| 562 max_tiles_for_interest_area * tile_size.width() * tile_size.height(); | 564 max_tiles_for_interest_area * tile_size.width() * tile_size.height(); |
| 563 | 565 |
| 564 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, | 566 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, |
| 565 visible_rect_in_content_space); | 567 visible_rect_in_content_space); |
| 566 DCHECK(skewport.Contains(visible_rect_in_content_space)); | 568 DCHECK(skewport.Contains(visible_rect_in_content_space)); |
| 567 | 569 |
| 568 gfx::Rect eventually_rect = | 570 gfx::Rect eventually_rect = |
| 569 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space, | 571 ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space, |
| 570 eventually_rect_area, | 572 eventually_rect_area, |
| 571 gfx::Rect(tiling_size()), | 573 gfx::Rect(tiling_size()), |
| 572 &expansion_cache_); | 574 &expansion_cache_); |
| 573 | 575 |
| 574 DCHECK(eventually_rect.IsEmpty() || | 576 DCHECK(eventually_rect.IsEmpty() || |
| 575 gfx::Rect(tiling_size()).Contains(eventually_rect)) | 577 gfx::Rect(tiling_size()).Contains(eventually_rect)) |
| 576 << "tiling_size: " << tiling_size().ToString() | 578 << "tiling_size: " << tiling_size().ToString() |
| 577 << " eventually_rect: " << eventually_rect.ToString(); | 579 << " eventually_rect: " << eventually_rect.ToString(); |
| 578 | 580 |
| 579 SetLiveTilesRect(eventually_rect); | 581 SetLiveTilesRect(eventually_rect); |
| 580 | 582 |
| 581 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; | 583 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; |
| 584 last_viewport_in_layer_space_ = viewport_in_layer_space; |
| 582 last_visible_rect_in_content_space_ = visible_rect_in_content_space; | 585 last_visible_rect_in_content_space_ = visible_rect_in_content_space; |
| 583 | 586 |
| 584 eviction_tiles_cache_valid_ = false; | 587 eviction_tiles_cache_valid_ = false; |
| 585 | 588 |
| 586 TilePriority now_priority(resolution_, TilePriority::NOW, 0); | 589 TilePriority now_priority(resolution_, TilePriority::NOW, 0); |
| 587 float content_to_screen_scale = ideal_contents_scale / contents_scale_; | 590 float content_to_screen_scale = ideal_contents_scale / contents_scale_; |
| 588 | 591 |
| 589 // Assign now priority to all visible tiles. | 592 // Assign now priority to all visible tiles. |
| 590 bool include_borders = false; | 593 bool include_borders = false; |
| 591 has_visible_rect_tiles_ = false; | 594 has_visible_rect_tiles_ = false; |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 DCHECK(*this); | 1194 DCHECK(*this); |
| 1192 do { | 1195 do { |
| 1193 ++current_eviction_tiles_index_; | 1196 ++current_eviction_tiles_index_; |
| 1194 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1197 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
| 1195 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1198 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
| 1196 | 1199 |
| 1197 return *this; | 1200 return *this; |
| 1198 } | 1201 } |
| 1199 | 1202 |
| 1200 } // namespace cc | 1203 } // namespace cc |
| OLD | NEW |