| 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/picture_layer_impl.h" | 5 #include "cc/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "cc/append_quads_data.h" | 8 #include "cc/append_quads_data.h" |
| 9 #include "cc/checkerboard_draw_quad.h" | 9 #include "cc/checkerboard_draw_quad.h" |
| 10 #include "cc/debug_border_draw_quad.h" | 10 #include "cc/debug_border_draw_quad.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // better scheme would be to maintain a tighter visibleContentRect for the | 209 // better scheme would be to maintain a tighter visibleContentRect for the |
| 210 // finer tilings. | 210 // finer tilings. |
| 211 CleanUpTilingsOnActiveLayer(seen_tilings); | 211 CleanUpTilingsOnActiveLayer(seen_tilings); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void PictureLayerImpl::dumpLayerProperties(std::string*, int indent) const { | 214 void PictureLayerImpl::dumpLayerProperties(std::string*, int indent) const { |
| 215 // TODO(enne): implement me | 215 // TODO(enne): implement me |
| 216 } | 216 } |
| 217 | 217 |
| 218 void PictureLayerImpl::updateTilePriorities() { | 218 void PictureLayerImpl::updateTilePriorities() { |
| 219 if (!tilings_->num_tilings()) |
| 220 return; |
| 221 |
| 219 int current_source_frame_number = layerTreeImpl()->source_frame_number(); | 222 int current_source_frame_number = layerTreeImpl()->source_frame_number(); |
| 220 double current_frame_time = | 223 double current_frame_time = |
| 221 (layerTreeImpl()->CurrentFrameTime() - base::TimeTicks()).InSecondsF(); | 224 (layerTreeImpl()->CurrentFrameTime() - base::TimeTicks()).InSecondsF(); |
| 222 | 225 |
| 226 bool has_tiling_that_needs_update = false; |
| 227 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 228 if (tilings_->tiling_at(i)->needs_update_tile_priorities( |
| 229 current_source_frame_number, current_frame_time)) |
| 230 has_tiling_that_needs_update = true; |
| 231 } |
| 232 if (!has_tiling_that_needs_update) |
| 233 return; |
| 234 |
| 223 gfx::Transform current_screen_space_transform = | 235 gfx::Transform current_screen_space_transform = |
| 224 screenSpaceTransform(); | 236 screenSpaceTransform(); |
| 225 | 237 |
| 226 gfx::Rect viewport_in_content_space; | 238 gfx::Rect viewport_in_content_space; |
| 227 gfx::Transform screenToLayer(gfx::Transform::kSkipInitialization); | 239 gfx::Transform screenToLayer(gfx::Transform::kSkipInitialization); |
| 228 if (screenSpaceTransform().GetInverse(&screenToLayer)) { | 240 if (screenSpaceTransform().GetInverse(&screenToLayer)) { |
| 229 gfx::Rect device_viewport(layerTreeImpl()->device_viewport_size()); | 241 gfx::Rect device_viewport(layerTreeImpl()->device_viewport_size()); |
| 230 viewport_in_content_space = gfx::ToEnclosingRect( | 242 viewport_in_content_space = gfx::ToEnclosingRect( |
| 231 MathUtil::projectClippedRect(screenToLayer, device_viewport)); | 243 MathUtil::projectClippedRect(screenToLayer, device_viewport)); |
| 232 } | 244 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 509 } |
| 498 } | 510 } |
| 499 | 511 |
| 500 return missing_region.IsEmpty(); | 512 return missing_region.IsEmpty(); |
| 501 } | 513 } |
| 502 | 514 |
| 503 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { | 515 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { |
| 504 DCHECK(contents_scale >= layerTreeImpl()->settings().minimumContentsScale); | 516 DCHECK(contents_scale >= layerTreeImpl()->settings().minimumContentsScale); |
| 505 | 517 |
| 506 PictureLayerTiling* tiling = tilings_->AddTiling(contents_scale); | 518 PictureLayerTiling* tiling = tilings_->AddTiling(contents_scale); |
| 519 layerTreeImpl()->set_needs_update_tile_priorities(); |
| 507 | 520 |
| 508 const Region& recorded = pile_->recorded_region(); | 521 const Region& recorded = pile_->recorded_region(); |
| 509 DCHECK(!recorded.IsEmpty()); | 522 DCHECK(!recorded.IsEmpty()); |
| 510 | 523 |
| 511 for (Region::Iterator iter(recorded); iter.has_rect(); iter.next()) | 524 for (Region::Iterator iter(recorded); iter.has_rect(); iter.next()) |
| 512 tiling->CreateTilesFromLayerRect(iter.rect()); | 525 tiling->CreateTilesFromLayerRect(iter.rect()); |
| 513 | 526 |
| 514 PictureLayerImpl* twin = | 527 PictureLayerImpl* twin = |
| 515 layerTreeImpl()->IsPendingTree() ? ActiveTwin() : PendingTwin(); | 528 layerTreeImpl()->IsPendingTree() ? ActiveTwin() : PendingTwin(); |
| 516 if (!twin) | 529 if (!twin) |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 return twin; | 740 return twin; |
| 728 } | 741 } |
| 729 | 742 |
| 730 void PictureLayerImpl::getDebugBorderProperties( | 743 void PictureLayerImpl::getDebugBorderProperties( |
| 731 SkColor* color, float* width) const { | 744 SkColor* color, float* width) const { |
| 732 *color = DebugColors::TiledContentLayerBorderColor(); | 745 *color = DebugColors::TiledContentLayerBorderColor(); |
| 733 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); | 746 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); |
| 734 } | 747 } |
| 735 | 748 |
| 736 } // namespace cc | 749 } // namespace cc |
| OLD | NEW |