| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 float width; | 166 float width; |
| 167 if (*iter && iter->IsReadyToDraw()) { | 167 if (*iter && iter->IsReadyToDraw()) { |
| 168 ManagedTileState::TileVersion::Mode mode = | 168 ManagedTileState::TileVersion::Mode mode = |
| 169 iter->GetTileVersionForDrawing().mode(); | 169 iter->GetTileVersionForDrawing().mode(); |
| 170 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { | 170 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { |
| 171 color = DebugColors::SolidColorTileBorderColor(); | 171 color = DebugColors::SolidColorTileBorderColor(); |
| 172 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 172 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
| 173 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { | 173 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { |
| 174 color = DebugColors::PictureTileBorderColor(); | 174 color = DebugColors::PictureTileBorderColor(); |
| 175 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); | 175 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
| 176 } else if (iter.priority().resolution == HIGH_RESOLUTION) { | 176 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { |
| 177 color = DebugColors::HighResTileBorderColor(); | 177 color = DebugColors::HighResTileBorderColor(); |
| 178 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 178 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
| 179 } else if (iter.priority().resolution == LOW_RESOLUTION) { | 179 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { |
| 180 color = DebugColors::LowResTileBorderColor(); | 180 color = DebugColors::LowResTileBorderColor(); |
| 181 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 181 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); |
| 182 } else if (iter->contents_scale() > contents_scale_x()) { | 182 } else if (iter->contents_scale() > contents_scale_x()) { |
| 183 color = DebugColors::ExtraHighResTileBorderColor(); | 183 color = DebugColors::ExtraHighResTileBorderColor(); |
| 184 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 184 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); |
| 185 } else { | 185 } else { |
| 186 color = DebugColors::ExtraLowResTileBorderColor(); | 186 color = DebugColors::ExtraLowResTileBorderColor(); |
| 187 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); | 187 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); |
| 188 } | 188 } |
| 189 } else { | 189 } else { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 pile_.get(), | 477 pile_.get(), |
| 478 content_rect.size(), | 478 content_rect.size(), |
| 479 content_rect, | 479 content_rect, |
| 480 contents_opaque() ? content_rect : gfx::Rect(), | 480 contents_opaque() ? content_rect : gfx::Rect(), |
| 481 tiling->contents_scale(), | 481 tiling->contents_scale(), |
| 482 id(), | 482 id(), |
| 483 layer_tree_impl()->source_frame_number(), | 483 layer_tree_impl()->source_frame_number(), |
| 484 flags); | 484 flags); |
| 485 } | 485 } |
| 486 | 486 |
| 487 scoped_refptr<TileBundle> PictureLayerImpl::CreateTileBundle(int offset_x, | |
| 488 int offset_y, | |
| 489 int width, | |
| 490 int height) { | |
| 491 return layer_tree_impl()->tile_manager()->CreateTileBundle( | |
| 492 offset_x, offset_y, width, height); | |
| 493 } | |
| 494 | |
| 495 void PictureLayerImpl::UpdatePile(Tile* tile) { | 487 void PictureLayerImpl::UpdatePile(Tile* tile) { |
| 496 tile->set_picture_pile(pile_); | 488 tile->set_picture_pile(pile_); |
| 497 } | 489 } |
| 498 | 490 |
| 499 const Region* PictureLayerImpl::GetInvalidation() { | 491 const Region* PictureLayerImpl::GetInvalidation() { |
| 500 return &invalidation_; | 492 return &invalidation_; |
| 501 } | 493 } |
| 502 | 494 |
| 503 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( | 495 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( |
| 504 const PictureLayerTiling* tiling) const { | 496 const PictureLayerTiling* tiling) const { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 contents_scale_x(), | 710 contents_scale_x(), |
| 719 rect); | 711 rect); |
| 720 iter; | 712 iter; |
| 721 ++iter) { | 713 ++iter) { |
| 722 if (!*iter || !iter->IsReadyToDraw()) | 714 if (!*iter || !iter->IsReadyToDraw()) |
| 723 continue; | 715 continue; |
| 724 | 716 |
| 725 // This iteration is over the visible content rect which is potentially | 717 // This iteration is over the visible content rect which is potentially |
| 726 // less conservative than projecting the viewport into the layer. | 718 // less conservative than projecting the viewport into the layer. |
| 727 // Ignore tiles that are know to be outside the viewport. | 719 // Ignore tiles that are know to be outside the viewport. |
| 728 if (iter.priority().distance_to_visible_in_pixels != 0) | 720 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) |
| 729 continue; | 721 continue; |
| 730 | 722 |
| 731 missing_region.Subtract(iter.geometry_rect()); | 723 missing_region.Subtract(iter.geometry_rect()); |
| 732 iter->MarkRequiredForActivation(); | 724 iter->MarkRequiredForActivation(); |
| 733 } | 725 } |
| 734 } | 726 } |
| 735 DCHECK(high_res) << "There must be one high res tiling"; | 727 DCHECK(high_res) << "There must be one high res tiling"; |
| 736 | 728 |
| 737 // If these pointers are null (because no twin, no matching tiling, or the | 729 // If these pointers are null (because no twin, no matching tiling, or the |
| 738 // simpification just below), then high res tiles will be required to fill any | 730 // 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... |
| 787 iter; | 779 iter; |
| 788 ++iter) { | 780 ++iter) { |
| 789 Tile* tile = *iter; | 781 Tile* tile = *iter; |
| 790 // A null tile (i.e. missing recording) can just be skipped. | 782 // A null tile (i.e. missing recording) can just be skipped. |
| 791 if (!tile) | 783 if (!tile) |
| 792 continue; | 784 continue; |
| 793 | 785 |
| 794 // This iteration is over the visible content rect which is potentially | 786 // This iteration is over the visible content rect which is potentially |
| 795 // less conservative than projecting the viewport into the layer. | 787 // less conservative than projecting the viewport into the layer. |
| 796 // Ignore tiles that are know to be outside the viewport. | 788 // Ignore tiles that are know to be outside the viewport. |
| 797 if (iter.priority().distance_to_visible_in_pixels != 0) | 789 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) |
| 798 continue; | 790 continue; |
| 799 | 791 |
| 800 // If the missing region doesn't cover it, this tile is fully | 792 // If the missing region doesn't cover it, this tile is fully |
| 801 // covered by acceptable tiles at other scales. | 793 // covered by acceptable tiles at other scales. |
| 802 if (!missing_region.Intersects(iter.geometry_rect())) | 794 if (!missing_region.Intersects(iter.geometry_rect())) |
| 803 continue; | 795 continue; |
| 804 | 796 |
| 805 // If the twin tile doesn't exist (i.e. missing recording or so far away | 797 // If the twin tile doesn't exist (i.e. missing recording or so far away |
| 806 // that it is outside the visible tile rect) or this tile is shared between | 798 // that it is outside the visible tile rect) or this tile is shared between |
| 807 // with the twin, then this tile isn't required to prevent flashing. | 799 // with the twin, then this tile isn't required to prevent flashing. |
| 808 if (optional_twin_tiling) { | 800 if (optional_twin_tiling) { |
| 809 Tile* twin_tile = | 801 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); |
| 810 optional_twin_tiling->TileAt(ACTIVE_TREE, iter.i(), iter.j()); | |
| 811 if (!twin_tile || twin_tile == tile) { | 802 if (!twin_tile || twin_tile == tile) { |
| 812 twin_had_missing_tile = true; | 803 twin_had_missing_tile = true; |
| 813 continue; | 804 continue; |
| 814 } | 805 } |
| 815 } | 806 } |
| 816 | 807 |
| 817 tile->MarkRequiredForActivation(); | 808 tile->MarkRequiredForActivation(); |
| 818 } | 809 } |
| 819 return twin_had_missing_tile; | 810 return twin_had_missing_tile; |
| 820 } | 811 } |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1217 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
| 1227 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1218 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
| 1228 return tilings_->GPUMemoryUsageInBytes(); | 1219 return tilings_->GPUMemoryUsageInBytes(); |
| 1229 } | 1220 } |
| 1230 | 1221 |
| 1231 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1222 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1232 benchmark->RunOnLayer(this); | 1223 benchmark->RunOnLayer(this); |
| 1233 } | 1224 } |
| 1234 | 1225 |
| 1235 } // namespace cc | 1226 } // namespace cc |
| OLD | NEW |