| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 float width; | 167 float width; |
| 168 if (*iter && iter->IsReadyToDraw()) { | 168 if (*iter && iter->IsReadyToDraw()) { |
| 169 ManagedTileState::TileVersion::Mode mode = | 169 ManagedTileState::TileVersion::Mode mode = |
| 170 iter->GetTileVersionForDrawing().mode(); | 170 iter->GetTileVersionForDrawing().mode(); |
| 171 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { | 171 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { |
| 172 color = DebugColors::SolidColorTileBorderColor(); | 172 color = DebugColors::SolidColorTileBorderColor(); |
| 173 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 173 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
| 174 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { | 174 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { |
| 175 color = DebugColors::PictureTileBorderColor(); | 175 color = DebugColors::PictureTileBorderColor(); |
| 176 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); | 176 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
| 177 } else if (iter.priority().resolution == HIGH_RESOLUTION) { | 177 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { |
| 178 color = DebugColors::HighResTileBorderColor(); | 178 color = DebugColors::HighResTileBorderColor(); |
| 179 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 179 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
| 180 } else if (iter.priority().resolution == LOW_RESOLUTION) { | 180 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { |
| 181 color = DebugColors::LowResTileBorderColor(); | 181 color = DebugColors::LowResTileBorderColor(); |
| 182 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 182 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); |
| 183 } else if (iter->contents_scale() > contents_scale_x()) { | 183 } else if (iter->contents_scale() > contents_scale_x()) { |
| 184 color = DebugColors::ExtraHighResTileBorderColor(); | 184 color = DebugColors::ExtraHighResTileBorderColor(); |
| 185 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 185 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); |
| 186 } else { | 186 } else { |
| 187 color = DebugColors::ExtraLowResTileBorderColor(); | 187 color = DebugColors::ExtraLowResTileBorderColor(); |
| 188 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); | 188 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); |
| 189 } | 189 } |
| 190 } else { | 190 } else { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 pile_.get(), | 481 pile_.get(), |
| 482 content_rect.size(), | 482 content_rect.size(), |
| 483 content_rect, | 483 content_rect, |
| 484 contents_opaque() ? content_rect : gfx::Rect(), | 484 contents_opaque() ? content_rect : gfx::Rect(), |
| 485 tiling->contents_scale(), | 485 tiling->contents_scale(), |
| 486 id(), | 486 id(), |
| 487 layer_tree_impl()->source_frame_number(), | 487 layer_tree_impl()->source_frame_number(), |
| 488 flags); | 488 flags); |
| 489 } | 489 } |
| 490 | 490 |
| 491 scoped_refptr<TileBundle> PictureLayerImpl::CreateTileBundle(int offset_x, | |
| 492 int offset_y, | |
| 493 int width, | |
| 494 int height) { | |
| 495 return layer_tree_impl()->tile_manager()->CreateTileBundle( | |
| 496 offset_x, offset_y, width, height); | |
| 497 } | |
| 498 | |
| 499 void PictureLayerImpl::UpdatePile(Tile* tile) { | 491 void PictureLayerImpl::UpdatePile(Tile* tile) { |
| 500 tile->set_picture_pile(pile_); | 492 tile->set_picture_pile(pile_); |
| 501 } | 493 } |
| 502 | 494 |
| 503 const Region* PictureLayerImpl::GetInvalidation() { | 495 const Region* PictureLayerImpl::GetInvalidation() { |
| 504 return &invalidation_; | 496 return &invalidation_; |
| 505 } | 497 } |
| 506 | 498 |
| 507 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( | 499 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( |
| 508 const PictureLayerTiling* tiling) const { | 500 const PictureLayerTiling* tiling) const { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 contents_scale_x(), | 719 contents_scale_x(), |
| 728 rect); | 720 rect); |
| 729 iter; | 721 iter; |
| 730 ++iter) { | 722 ++iter) { |
| 731 if (!*iter || !iter->IsReadyToDraw()) | 723 if (!*iter || !iter->IsReadyToDraw()) |
| 732 continue; | 724 continue; |
| 733 | 725 |
| 734 // This iteration is over the visible content rect which is potentially | 726 // This iteration is over the visible content rect which is potentially |
| 735 // less conservative than projecting the viewport into the layer. | 727 // less conservative than projecting the viewport into the layer. |
| 736 // Ignore tiles that are know to be outside the viewport. | 728 // Ignore tiles that are know to be outside the viewport. |
| 737 if (iter.priority().distance_to_visible_in_pixels != 0) | 729 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) |
| 738 continue; | 730 continue; |
| 739 | 731 |
| 740 missing_region.Subtract(iter.geometry_rect()); | 732 missing_region.Subtract(iter.geometry_rect()); |
| 741 iter->MarkRequiredForActivation(); | 733 iter->MarkRequiredForActivation(); |
| 742 } | 734 } |
| 743 } | 735 } |
| 744 DCHECK(high_res) << "There must be one high res tiling"; | 736 DCHECK(high_res) << "There must be one high res tiling"; |
| 745 | 737 |
| 746 // If these pointers are null (because no twin, no matching tiling, or the | 738 // If these pointers are null (because no twin, no matching tiling, or the |
| 747 // simpification just below), then high res tiles will be required to fill any | 739 // simpification just below), then high res tiles will be required to fill any |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 iter; | 788 iter; |
| 797 ++iter) { | 789 ++iter) { |
| 798 Tile* tile = *iter; | 790 Tile* tile = *iter; |
| 799 // A null tile (i.e. missing recording) can just be skipped. | 791 // A null tile (i.e. missing recording) can just be skipped. |
| 800 if (!tile) | 792 if (!tile) |
| 801 continue; | 793 continue; |
| 802 | 794 |
| 803 // This iteration is over the visible content rect which is potentially | 795 // This iteration is over the visible content rect which is potentially |
| 804 // less conservative than projecting the viewport into the layer. | 796 // less conservative than projecting the viewport into the layer. |
| 805 // Ignore tiles that are know to be outside the viewport. | 797 // Ignore tiles that are know to be outside the viewport. |
| 806 if (iter.priority().distance_to_visible_in_pixels != 0) | 798 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) |
| 807 continue; | 799 continue; |
| 808 | 800 |
| 809 // If the missing region doesn't cover it, this tile is fully | 801 // If the missing region doesn't cover it, this tile is fully |
| 810 // covered by acceptable tiles at other scales. | 802 // covered by acceptable tiles at other scales. |
| 811 if (!missing_region.Intersects(iter.geometry_rect())) | 803 if (!missing_region.Intersects(iter.geometry_rect())) |
| 812 continue; | 804 continue; |
| 813 | 805 |
| 814 // If the twin tile doesn't exist (i.e. missing recording or so far away | 806 // If the twin tile doesn't exist (i.e. missing recording or so far away |
| 815 // that it is outside the visible tile rect) or this tile is shared between | 807 // that it is outside the visible tile rect) or this tile is shared between |
| 816 // with the twin, then this tile isn't required to prevent flashing. | 808 // with the twin, then this tile isn't required to prevent flashing. |
| 817 if (optional_twin_tiling) { | 809 if (optional_twin_tiling) { |
| 818 Tile* twin_tile = | 810 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); |
| 819 optional_twin_tiling->TileAt(ACTIVE_TREE, iter.i(), iter.j()); | |
| 820 if (!twin_tile || twin_tile == tile) { | 811 if (!twin_tile || twin_tile == tile) { |
| 821 twin_had_missing_tile = true; | 812 twin_had_missing_tile = true; |
| 822 continue; | 813 continue; |
| 823 } | 814 } |
| 824 } | 815 } |
| 825 | 816 |
| 826 tile->MarkRequiredForActivation(); | 817 tile->MarkRequiredForActivation(); |
| 827 } | 818 } |
| 828 return twin_had_missing_tile; | 819 return twin_had_missing_tile; |
| 829 } | 820 } |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1230 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
| 1240 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1231 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
| 1241 return tilings_->GPUMemoryUsageInBytes(); | 1232 return tilings_->GPUMemoryUsageInBytes(); |
| 1242 } | 1233 } |
| 1243 | 1234 |
| 1244 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1235 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1245 benchmark->RunOnLayer(this); | 1236 benchmark->RunOnLayer(this); |
| 1246 } | 1237 } |
| 1247 | 1238 |
| 1248 } // namespace cc | 1239 } // namespace cc |
| OLD | NEW |