| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 skewport.Union(visible_rect_in_content_space); | 532 skewport.Union(visible_rect_in_content_space); |
| 533 return skewport; | 533 return skewport; |
| 534 } | 534 } |
| 535 | 535 |
| 536 void PictureLayerTiling::ComputeTilePriorityRects( | 536 void PictureLayerTiling::ComputeTilePriorityRects( |
| 537 WhichTree tree, | 537 WhichTree tree, |
| 538 const gfx::Rect& viewport_in_layer_space, | 538 const gfx::Rect& viewport_in_layer_space, |
| 539 float ideal_contents_scale, | 539 float ideal_contents_scale, |
| 540 double current_frame_time_in_seconds, | 540 double current_frame_time_in_seconds, |
| 541 const Occlusion& occlusion_in_layer_space) { | 541 const Occlusion& occlusion_in_layer_space) { |
| 542 if (!NeedsUpdateForFrameAtTime(current_frame_time_in_seconds)) { | 542 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, |
| 543 viewport_in_layer_space)) { |
| 543 // This should never be zero for the purposes of has_ever_been_updated(). | 544 // This should never be zero for the purposes of has_ever_been_updated(). |
| 544 DCHECK_NE(current_frame_time_in_seconds, 0.0); | 545 DCHECK_NE(current_frame_time_in_seconds, 0.0); |
| 545 return; | 546 return; |
| 546 } | 547 } |
| 547 | 548 |
| 548 gfx::Rect visible_rect_in_content_space = | 549 gfx::Rect visible_rect_in_content_space = |
| 549 gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_); | 550 gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_); |
| 550 | 551 |
| 551 if (tiling_size().IsEmpty()) { | 552 if (tiling_size().IsEmpty()) { |
| 552 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; | 553 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; |
| 554 last_viewport_in_layer_space_ = viewport_in_layer_space; |
| 553 last_visible_rect_in_content_space_ = visible_rect_in_content_space; | 555 last_visible_rect_in_content_space_ = visible_rect_in_content_space; |
| 554 return; | 556 return; |
| 555 } | 557 } |
| 556 | 558 |
| 557 // Calculate the skewport. | 559 // Calculate the skewport. |
| 558 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, | 560 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, |
| 559 visible_rect_in_content_space); | 561 visible_rect_in_content_space); |
| 560 DCHECK(skewport.Contains(visible_rect_in_content_space)); | 562 DCHECK(skewport.Contains(visible_rect_in_content_space)); |
| 561 | 563 |
| 562 // Calculate the eventually/live tiles rect. | 564 // Calculate the eventually/live tiles rect. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 580 // Calculate the soon border rect. | 582 // Calculate the soon border rect. |
| 581 content_to_screen_scale_ = ideal_contents_scale / contents_scale_; | 583 content_to_screen_scale_ = ideal_contents_scale / contents_scale_; |
| 582 gfx::Rect soon_border_rect = visible_rect_in_content_space; | 584 gfx::Rect soon_border_rect = visible_rect_in_content_space; |
| 583 float border = kSoonBorderDistanceInScreenPixels / content_to_screen_scale_; | 585 float border = kSoonBorderDistanceInScreenPixels / content_to_screen_scale_; |
| 584 soon_border_rect.Inset(-border, -border, -border, -border); | 586 soon_border_rect.Inset(-border, -border, -border, -border); |
| 585 | 587 |
| 586 // Update the tiling state. | 588 // Update the tiling state. |
| 587 SetLiveTilesRect(eventually_rect); | 589 SetLiveTilesRect(eventually_rect); |
| 588 | 590 |
| 589 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; | 591 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; |
| 592 last_viewport_in_layer_space_ = viewport_in_layer_space; |
| 590 last_visible_rect_in_content_space_ = visible_rect_in_content_space; | 593 last_visible_rect_in_content_space_ = visible_rect_in_content_space; |
| 591 | 594 |
| 592 eviction_tiles_cache_valid_ = false; | 595 eviction_tiles_cache_valid_ = false; |
| 593 | 596 |
| 594 current_visible_rect_ = visible_rect_in_content_space; | 597 current_visible_rect_ = visible_rect_in_content_space; |
| 595 current_skewport_rect_ = skewport; | 598 current_skewport_rect_ = skewport; |
| 596 current_soon_border_rect_ = soon_border_rect; | 599 current_soon_border_rect_ = soon_border_rect; |
| 597 current_eventually_rect_ = eventually_rect; | 600 current_eventually_rect_ = eventually_rect; |
| 598 current_occlusion_in_layer_space_ = occlusion_in_layer_space; | 601 current_occlusion_in_layer_space_ = occlusion_in_layer_space; |
| 599 | 602 |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 DCHECK(*this); | 1226 DCHECK(*this); |
| 1224 do { | 1227 do { |
| 1225 ++current_eviction_tiles_index_; | 1228 ++current_eviction_tiles_index_; |
| 1226 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1229 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
| 1227 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1230 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
| 1228 | 1231 |
| 1229 return *this; | 1232 return *this; |
| 1230 } | 1233 } |
| 1231 | 1234 |
| 1232 } // namespace cc | 1235 } // namespace cc |
| OLD | NEW |