Chromium Code Reviews| 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/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 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 quad_content_rect, | 191 quad_content_rect, |
| 192 max_contents_scale, | 192 max_contents_scale, |
| 193 pile_); | 193 pile_); |
| 194 return; | 194 return; |
| 195 } | 195 } |
| 196 | 196 |
| 197 AppendDebugBorderQuad( | 197 AppendDebugBorderQuad( |
| 198 render_pass, scaled_content_bounds, shared_quad_state, append_quads_data); | 198 render_pass, scaled_content_bounds, shared_quad_state, append_quads_data); |
| 199 | 199 |
| 200 if (ShowDebugBorders()) { | 200 if (ShowDebugBorders()) { |
| 201 SkColor color; | |
|
enne (OOO)
2014/07/24 19:25:19
?
hush (inactive)
2014/07/24 23:29:37
This is just a minor performance improvement. Don'
enne (OOO)
2014/07/24 23:34:29
There's not performance improvement here. Neither
hush (inactive)
2014/07/24 23:48:07
Okay. I will just revert this part.
On 2014/07/24
| |
| 202 float width; | |
| 201 for (PictureLayerTilingSet::CoverageIterator iter( | 203 for (PictureLayerTilingSet::CoverageIterator iter( |
| 202 tilings_.get(), | 204 tilings_.get(), |
| 203 max_contents_scale, | 205 max_contents_scale, |
| 204 scaled_visible_content_rect, | 206 scaled_visible_content_rect, |
| 205 ideal_contents_scale_); | 207 ideal_contents_scale_); |
| 206 iter; | 208 iter; |
| 207 ++iter) { | 209 ++iter) { |
| 208 SkColor color; | |
| 209 float width; | |
| 210 if (*iter && iter->IsReadyToDraw()) { | 210 if (*iter && iter->IsReadyToDraw()) { |
| 211 ManagedTileState::TileVersion::Mode mode = | 211 ManagedTileState::TileVersion::Mode mode = |
| 212 iter->GetTileVersionForDrawing().mode(); | 212 iter->GetTileVersionForDrawing().mode(); |
| 213 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { | 213 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { |
| 214 color = DebugColors::SolidColorTileBorderColor(); | 214 color = DebugColors::SolidColorTileBorderColor(); |
| 215 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 215 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
| 216 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { | 216 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { |
| 217 color = DebugColors::PictureTileBorderColor(); | 217 color = DebugColors::PictureTileBorderColor(); |
| 218 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); | 218 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
| 219 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { | 219 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 // TODO(danakj): We should always get an occlusion tracker when we are using | 392 // TODO(danakj): We should always get an occlusion tracker when we are using |
| 393 // occlusion, so update this check when we don't use a pending tree in the | 393 // occlusion, so update this check when we don't use a pending tree in the |
| 394 // browser compositor. | 394 // browser compositor. |
| 395 DCHECK(!occlusion_tracker || | 395 DCHECK(!occlusion_tracker || |
| 396 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization); | 396 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization); |
| 397 | 397 |
| 398 // Transforms and viewport are invalid for tile management inside a | 398 // Transforms and viewport are invalid for tile management inside a |
| 399 // resourceless software draw, so don't update them. | 399 // resourceless software draw, so don't update them. |
| 400 if (!layer_tree_impl()->resourceless_software_draw()) { | 400 if (!layer_tree_impl()->resourceless_software_draw()) { |
| 401 visible_rect_for_tile_priority_ = visible_content_rect(); | 401 visible_rect_for_tile_priority_ = visible_content_rect(); |
| 402 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); | 402 viewport_rect_for_tile_priority_ = layer_tree_impl()->ExternalTilingRect(); |
| 403 screen_space_transform_for_tile_priority_ = screen_space_transform(); | 403 screen_space_transform_for_tile_priority_ = screen_space_transform(); |
| 404 screen_space_transform_for_tile_priority_.ConcatTransform( | |
|
enne (OOO)
2014/07/24 19:25:19
It seems a little bit like this viewport_rect_for_
hush (inactive)
2014/07/24 23:29:37
Yeah right. I will do this based on your other com
| |
| 405 layer_tree_impl()->ExternalTilingTransform()); | |
| 404 } | 406 } |
| 405 | 407 |
| 406 if (!CanHaveTilings()) { | 408 if (!CanHaveTilings()) { |
| 407 ideal_page_scale_ = 0.f; | 409 ideal_page_scale_ = 0.f; |
| 408 ideal_device_scale_ = 0.f; | 410 ideal_device_scale_ = 0.f; |
| 409 ideal_contents_scale_ = 0.f; | 411 ideal_contents_scale_ = 0.f; |
| 410 ideal_source_scale_ = 0.f; | 412 ideal_source_scale_ = 0.f; |
| 411 SanityCheckTilingState(); | 413 SanityCheckTilingState(); |
| 412 return; | 414 return; |
| 413 } | 415 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 452 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 451 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( | 453 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( |
| 452 current_frame_time_in_seconds)) { | 454 current_frame_time_in_seconds)) { |
| 453 tiling_needs_update = true; | 455 tiling_needs_update = true; |
| 454 break; | 456 break; |
| 455 } | 457 } |
| 456 } | 458 } |
| 457 if (!tiling_needs_update) | 459 if (!tiling_needs_update) |
| 458 return; | 460 return; |
| 459 | 461 |
| 460 // Use visible_content_rect, unless it's empty. If it's empty, then | 462 // If visible_rect_for_tile_priority_ is empty or |
| 461 // try to inverse project the viewport into layer space and use that. | 463 // LayerTreeImpl::ExternalTilingRect is set to be different from the device |
| 464 // viewport, try to inverse project the viewport into layer space and use | |
| 465 // that. Otherwise just use visible_rect_for_tile_priority_ | |
| 462 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; | 466 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; |
| 463 if (visible_rect_in_content_space.IsEmpty()) { | 467 if (visible_rect_in_content_space.IsEmpty() || |
| 468 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority_ || | |
| 469 !layer_tree_impl()->ExternalTilingTransform().IsIdentity()) { | |
| 464 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); | 470 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); |
| 471 | |
| 465 if (screen_space_transform_for_tile_priority_.GetInverse( | 472 if (screen_space_transform_for_tile_priority_.GetInverse( |
| 466 &screen_to_layer)) { | 473 &screen_to_layer)) { |
| 474 // Transform from screen space to content space. | |
| 467 visible_rect_in_content_space = | 475 visible_rect_in_content_space = |
| 468 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 476 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
| 469 screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); | 477 screen_to_layer, viewport_rect_for_tile_priority_)); |
| 478 | |
| 470 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); | 479 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); |
| 471 } | 480 } |
| 472 } | 481 } |
| 473 | 482 |
| 474 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( | 483 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
| 475 visible_rect_in_content_space, 1.f / contents_scale_x()); | 484 visible_rect_in_content_space, 1.f / contents_scale_x()); |
| 476 WhichTree tree = | 485 WhichTree tree = |
| 477 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 486 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 478 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 487 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 479 tilings_->tiling_at(i)->UpdateTilePriorities(tree, | 488 tilings_->tiling_at(i)->UpdateTilePriorities(tree, |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1635 return iterator_index_ < iterators_.size(); | 1644 return iterator_index_ < iterators_.size(); |
| 1636 } | 1645 } |
| 1637 | 1646 |
| 1638 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1647 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1639 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1648 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1640 return it->get_type() == iteration_stage_ && | 1649 return it->get_type() == iteration_stage_ && |
| 1641 (**it)->required_for_activation() == required_for_activation_; | 1650 (**it)->required_for_activation() == required_for_activation_; |
| 1642 } | 1651 } |
| 1643 | 1652 |
| 1644 } // namespace cc | 1653 } // namespace cc |
| OLD | NEW |