| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 float width; | 172 float width; |
| 173 if (*iter && iter->IsReadyToDraw()) { | 173 if (*iter && iter->IsReadyToDraw()) { |
| 174 ManagedTileState::TileVersion::Mode mode = | 174 ManagedTileState::TileVersion::Mode mode = |
| 175 iter->GetTileVersionForDrawing().mode(); | 175 iter->GetTileVersionForDrawing().mode(); |
| 176 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { | 176 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { |
| 177 color = DebugColors::SolidColorTileBorderColor(); | 177 color = DebugColors::SolidColorTileBorderColor(); |
| 178 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 178 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
| 179 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { | 179 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { |
| 180 color = DebugColors::PictureTileBorderColor(); | 180 color = DebugColors::PictureTileBorderColor(); |
| 181 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); | 181 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
| 182 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { | 182 } else if (iter.priority().resolution == HIGH_RESOLUTION) { |
| 183 color = DebugColors::HighResTileBorderColor(); | 183 color = DebugColors::HighResTileBorderColor(); |
| 184 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 184 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
| 185 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { | 185 } else if (iter.priority().resolution == LOW_RESOLUTION) { |
| 186 color = DebugColors::LowResTileBorderColor(); | 186 color = DebugColors::LowResTileBorderColor(); |
| 187 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 187 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); |
| 188 } else if (iter->contents_scale() > contents_scale_x()) { | 188 } else if (iter->contents_scale() > contents_scale_x()) { |
| 189 color = DebugColors::ExtraHighResTileBorderColor(); | 189 color = DebugColors::ExtraHighResTileBorderColor(); |
| 190 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 190 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); |
| 191 } else { | 191 } else { |
| 192 color = DebugColors::ExtraLowResTileBorderColor(); | 192 color = DebugColors::ExtraLowResTileBorderColor(); |
| 193 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); | 193 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); |
| 194 } | 194 } |
| 195 } else { | 195 } else { |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 pile_.get(), | 472 pile_.get(), |
| 473 content_rect.size(), | 473 content_rect.size(), |
| 474 content_rect, | 474 content_rect, |
| 475 contents_opaque() ? content_rect : gfx::Rect(), | 475 contents_opaque() ? content_rect : gfx::Rect(), |
| 476 tiling->contents_scale(), | 476 tiling->contents_scale(), |
| 477 id(), | 477 id(), |
| 478 layer_tree_impl()->source_frame_number(), | 478 layer_tree_impl()->source_frame_number(), |
| 479 is_using_lcd_text_); | 479 is_using_lcd_text_); |
| 480 } | 480 } |
| 481 | 481 |
| 482 scoped_refptr<TileBundle> PictureLayerImpl::CreateTileBundle(int offset_x, |
| 483 int offset_y, |
| 484 int width, |
| 485 int height) { |
| 486 return layer_tree_impl()->tile_manager()->CreateTileBundle( |
| 487 offset_x, offset_y, width, height); |
| 488 } |
| 489 |
| 482 void PictureLayerImpl::UpdatePile(Tile* tile) { | 490 void PictureLayerImpl::UpdatePile(Tile* tile) { |
| 483 tile->set_picture_pile(pile_); | 491 tile->set_picture_pile(pile_); |
| 484 } | 492 } |
| 485 | 493 |
| 486 const Region* PictureLayerImpl::GetInvalidation() { | 494 const Region* PictureLayerImpl::GetInvalidation() { |
| 487 return &invalidation_; | 495 return &invalidation_; |
| 488 } | 496 } |
| 489 | 497 |
| 490 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( | 498 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( |
| 491 const PictureLayerTiling* tiling) { | 499 const PictureLayerTiling* tiling) { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 contents_scale_x(), | 705 contents_scale_x(), |
| 698 rect); | 706 rect); |
| 699 iter; | 707 iter; |
| 700 ++iter) { | 708 ++iter) { |
| 701 if (!*iter || !iter->IsReadyToDraw()) | 709 if (!*iter || !iter->IsReadyToDraw()) |
| 702 continue; | 710 continue; |
| 703 | 711 |
| 704 // This iteration is over the visible content rect which is potentially | 712 // This iteration is over the visible content rect which is potentially |
| 705 // less conservative than projecting the viewport into the layer. | 713 // less conservative than projecting the viewport into the layer. |
| 706 // Ignore tiles that are know to be outside the viewport. | 714 // Ignore tiles that are know to be outside the viewport. |
| 707 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) | 715 if (iter.priority().distance_to_visible_in_pixels != 0) |
| 708 continue; | 716 continue; |
| 709 | 717 |
| 710 missing_region.Subtract(iter.geometry_rect()); | 718 missing_region.Subtract(iter.geometry_rect()); |
| 711 iter->MarkRequiredForActivation(); | 719 iter->MarkRequiredForActivation(); |
| 712 } | 720 } |
| 713 } | 721 } |
| 714 | 722 |
| 715 DCHECK(high_res) << "There must be one high res tiling"; | 723 DCHECK(high_res) << "There must be one high res tiling"; |
| 716 for (PictureLayerTiling::CoverageIterator iter(high_res, | 724 for (PictureLayerTiling::CoverageIterator iter(high_res, |
| 717 contents_scale_x(), | 725 contents_scale_x(), |
| 718 rect); | 726 rect); |
| 719 iter; | 727 iter; |
| 720 ++iter) { | 728 ++iter) { |
| 721 // A null tile (i.e. missing recording) can just be skipped. | 729 // A null tile (i.e. missing recording) can just be skipped. |
| 722 if (!*iter) | 730 if (!*iter) |
| 723 continue; | 731 continue; |
| 724 | 732 |
| 725 // This iteration is over the visible content rect which is potentially | 733 // This iteration is over the visible content rect which is potentially |
| 726 // less conservative than projecting the viewport into the layer. | 734 // less conservative than projecting the viewport into the layer. |
| 727 // Ignore tiles that are know to be outside the viewport. | 735 // Ignore tiles that are know to be outside the viewport. |
| 728 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) | 736 if (iter.priority().distance_to_visible_in_pixels != 0) |
| 729 continue; | 737 continue; |
| 730 | 738 |
| 731 // If the missing region doesn't cover it, this tile is fully | 739 // If the missing region doesn't cover it, this tile is fully |
| 732 // covered by acceptable tiles at other scales. | 740 // covered by acceptable tiles at other scales. |
| 733 if (!missing_region.Intersects(iter.geometry_rect())) | 741 if (!missing_region.Intersects(iter.geometry_rect())) |
| 734 continue; | 742 continue; |
| 735 | 743 |
| 736 iter->MarkRequiredForActivation(); | 744 iter->MarkRequiredForActivation(); |
| 737 } | 745 } |
| 738 } | 746 } |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1152 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
| 1145 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1153 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
| 1146 return tilings_->GPUMemoryUsageInBytes(); | 1154 return tilings_->GPUMemoryUsageInBytes(); |
| 1147 } | 1155 } |
| 1148 | 1156 |
| 1149 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1157 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1150 benchmark->RunOnLayer(this); | 1158 benchmark->RunOnLayer(this); |
| 1151 } | 1159 } |
| 1152 | 1160 |
| 1153 } // namespace cc | 1161 } // namespace cc |
| OLD | NEW |