Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 62283012: cc: Added tile bundles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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) const { 499 const PictureLayerTiling* tiling) const {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 contents_scale_x(), 713 contents_scale_x(),
706 rect); 714 rect);
707 iter; 715 iter;
708 ++iter) { 716 ++iter) {
709 if (!*iter || !iter->IsReadyToDraw()) 717 if (!*iter || !iter->IsReadyToDraw())
710 continue; 718 continue;
711 719
712 // This iteration is over the visible content rect which is potentially 720 // This iteration is over the visible content rect which is potentially
713 // less conservative than projecting the viewport into the layer. 721 // less conservative than projecting the viewport into the layer.
714 // Ignore tiles that are know to be outside the viewport. 722 // Ignore tiles that are know to be outside the viewport.
715 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 723 if (iter.priority().distance_to_visible_in_pixels != 0)
716 continue; 724 continue;
717 725
718 missing_region.Subtract(iter.geometry_rect()); 726 missing_region.Subtract(iter.geometry_rect());
719 iter->MarkRequiredForActivation(); 727 iter->MarkRequiredForActivation();
720 } 728 }
721 } 729 }
722 DCHECK(high_res) << "There must be one high res tiling"; 730 DCHECK(high_res) << "There must be one high res tiling";
723 731
724 // If these pointers are null (because no twin, no matching tiling, or the 732 // If these pointers are null (because no twin, no matching tiling, or the
725 // simpification just below), then high res tiles will be required to fill any 733 // simpification just below), then high res tiles will be required to fill any
(...skipping 29 matching lines...) Expand all
755 low_res, twin_low_res, contents_scale_x(), rect, &missing_region); 763 low_res, twin_low_res, contents_scale_x(), rect, &missing_region);
756 } 764 }
757 } 765 }
758 766
759 bool PictureLayerImpl::MarkVisibleTilesAsRequired( 767 bool PictureLayerImpl::MarkVisibleTilesAsRequired(
760 PictureLayerTiling* tiling, 768 PictureLayerTiling* tiling,
761 const PictureLayerTiling* optional_twin_tiling, 769 const PictureLayerTiling* optional_twin_tiling,
762 float contents_scale, 770 float contents_scale,
763 gfx::Rect rect, 771 gfx::Rect rect,
764 Region* missing_region) const { 772 Region* missing_region) const {
773 DCHECK(layer_tree_impl()->IsPendingTree());
774
765 bool twin_had_missing_tile = false; 775 bool twin_had_missing_tile = false;
766 for (PictureLayerTiling::CoverageIterator iter(tiling, 776 for (PictureLayerTiling::CoverageIterator iter(tiling,
767 contents_scale, 777 contents_scale,
768 rect); 778 rect);
769 iter; 779 iter;
770 ++iter) { 780 ++iter) {
771 Tile* tile = *iter; 781 Tile* tile = *iter;
772 // A null tile (i.e. missing recording) can just be skipped. 782 // A null tile (i.e. missing recording) can just be skipped.
773 if (!tile) 783 if (!tile)
774 continue; 784 continue;
775 785
776 // This iteration is over the visible content rect which is potentially 786 // This iteration is over the visible content rect which is potentially
777 // less conservative than projecting the viewport into the layer. 787 // less conservative than projecting the viewport into the layer.
778 // Ignore tiles that are know to be outside the viewport. 788 // Ignore tiles that are know to be outside the viewport.
779 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 789 if (iter.priority().distance_to_visible_in_pixels != 0)
780 continue; 790 continue;
781 791
782 // 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
783 // covered by acceptable tiles at other scales. 793 // covered by acceptable tiles at other scales.
784 if (!missing_region->Intersects(iter.geometry_rect())) 794 if (!missing_region->Intersects(iter.geometry_rect()))
785 continue; 795 continue;
786 796
787 // If the twin tile isn't ready to draw, then this tile isn't 797 // If the twin tile isn't ready to draw, then this tile isn't
788 // required to prevent flashing. 798 // required to prevent flashing.
789 if (optional_twin_tiling) { 799 if (optional_twin_tiling) {
790 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); 800 Tile* twin_tile =
801 optional_twin_tiling->TileAt(ACTIVE_TREE, iter.i(), iter.j());
791 if (!twin_tile || !twin_tile->IsReadyToDraw()) { 802 if (!twin_tile || !twin_tile->IsReadyToDraw()) {
792 twin_had_missing_tile = true; 803 twin_had_missing_tile = true;
793 continue; 804 continue;
794 } 805 }
795 } 806 }
796 807
797 missing_region->Subtract(iter.geometry_rect()); 808 missing_region->Subtract(iter.geometry_rect());
798 tile->MarkRequiredForActivation(); 809 tile->MarkRequiredForActivation();
799 } 810 }
800 return twin_had_missing_tile; 811 return twin_had_missing_tile;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { 1218 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const {
1208 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); 1219 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded();
1209 return tilings_->GPUMemoryUsageInBytes(); 1220 return tilings_->GPUMemoryUsageInBytes();
1210 } 1221 }
1211 1222
1212 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1223 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
1213 benchmark->RunOnLayer(this); 1224 benchmark->RunOnLayer(this);
1214 } 1225 }
1215 1226
1216 } // namespace cc 1227 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698