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

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(
483 gfx::Rect bundle_rect) {
484 return layer_tree_impl()->tile_manager()->CreateTileBundle(bundle_rect);
485 }
486
482 void PictureLayerImpl::UpdatePile(Tile* tile) { 487 void PictureLayerImpl::UpdatePile(Tile* tile) {
483 tile->set_picture_pile(pile_); 488 tile->set_picture_pile(pile_);
484 } 489 }
485 490
486 const Region* PictureLayerImpl::GetInvalidation() { 491 const Region* PictureLayerImpl::GetInvalidation() {
487 return &invalidation_; 492 return &invalidation_;
488 } 493 }
489 494
490 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( 495 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling(
491 const PictureLayerTiling* tiling) const { 496 const PictureLayerTiling* tiling) const {
492 497
493 if (!twin_layer_) 498 if (!twin_layer_)
494 return NULL; 499 return NULL;
495 for (size_t i = 0; i < twin_layer_->tilings_->num_tilings(); ++i) 500 for (size_t i = 0; i < twin_layer_->tilings_->num_tilings(); ++i)
496 if (twin_layer_->tilings_->tiling_at(i)->contents_scale() == 501 if (twin_layer_->tilings_->tiling_at(i)->contents_scale() ==
497 tiling->contents_scale()) 502 tiling->contents_scale())
498 return twin_layer_->tilings_->tiling_at(i); 503 return twin_layer_->tilings_->tiling_at(i);
499 return NULL; 504 return NULL;
500 } 505 }
501 506
507 bool PictureLayerImpl::IsActive() const {
enne (OOO) 2013/11/27 01:38:05 What did you think about my suggestion to remove t
vmpstr 2013/11/27 21:09:36 Sorry, I thought I replied to this one. I don't mi
enne (OOO) 2013/11/27 22:21:15 You could set the tiling to be pending when it bec
508 return layer_tree_impl()->IsActiveTree();
509 }
510
511 bool PictureLayerImpl::IsPending() const {
512 return layer_tree_impl()->IsPendingTree();
513 }
514
502 gfx::Size PictureLayerImpl::CalculateTileSize( 515 gfx::Size PictureLayerImpl::CalculateTileSize(
503 gfx::Size content_bounds) const { 516 gfx::Size content_bounds) const {
504 if (is_mask_) { 517 if (is_mask_) {
505 int max_size = layer_tree_impl()->MaxTextureSize(); 518 int max_size = layer_tree_impl()->MaxTextureSize();
506 return gfx::Size( 519 return gfx::Size(
507 std::min(max_size, content_bounds.width()), 520 std::min(max_size, content_bounds.width()),
508 std::min(max_size, content_bounds.height())); 521 std::min(max_size, content_bounds.height()));
509 } 522 }
510 523
511 int max_texture_size = 524 int max_texture_size =
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 contents_scale_x(), 718 contents_scale_x(),
706 rect); 719 rect);
707 iter; 720 iter;
708 ++iter) { 721 ++iter) {
709 if (!*iter || !iter->IsReadyToDraw()) 722 if (!*iter || !iter->IsReadyToDraw())
710 continue; 723 continue;
711 724
712 // This iteration is over the visible content rect which is potentially 725 // This iteration is over the visible content rect which is potentially
713 // less conservative than projecting the viewport into the layer. 726 // less conservative than projecting the viewport into the layer.
714 // Ignore tiles that are know to be outside the viewport. 727 // Ignore tiles that are know to be outside the viewport.
715 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 728 if (iter.priority().distance_to_visible_in_pixels != 0)
716 continue; 729 continue;
717 730
718 missing_region.Subtract(iter.geometry_rect()); 731 missing_region.Subtract(iter.geometry_rect());
719 iter->MarkRequiredForActivation(); 732 iter->MarkRequiredForActivation();
720 } 733 }
721 } 734 }
722 DCHECK(high_res) << "There must be one high res tiling"; 735 DCHECK(high_res) << "There must be one high res tiling";
723 736
724 // If these pointers are null (because no twin, no matching tiling, or the 737 // 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 738 // 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); 768 low_res, twin_low_res, contents_scale_x(), rect, &missing_region);
756 } 769 }
757 } 770 }
758 771
759 bool PictureLayerImpl::MarkVisibleTilesAsRequired( 772 bool PictureLayerImpl::MarkVisibleTilesAsRequired(
760 PictureLayerTiling* tiling, 773 PictureLayerTiling* tiling,
761 const PictureLayerTiling* optional_twin_tiling, 774 const PictureLayerTiling* optional_twin_tiling,
762 float contents_scale, 775 float contents_scale,
763 gfx::Rect rect, 776 gfx::Rect rect,
764 Region* missing_region) const { 777 Region* missing_region) const {
778 DCHECK(layer_tree_impl()->IsPendingTree());
779
765 bool twin_had_missing_tile = false; 780 bool twin_had_missing_tile = false;
766 for (PictureLayerTiling::CoverageIterator iter(tiling, 781 for (PictureLayerTiling::CoverageIterator iter(tiling,
767 contents_scale, 782 contents_scale,
768 rect); 783 rect);
769 iter; 784 iter;
770 ++iter) { 785 ++iter) {
771 Tile* tile = *iter; 786 Tile* tile = *iter;
772 // A null tile (i.e. missing recording) can just be skipped. 787 // A null tile (i.e. missing recording) can just be skipped.
773 if (!tile) 788 if (!tile)
774 continue; 789 continue;
775 790
776 // This iteration is over the visible content rect which is potentially 791 // This iteration is over the visible content rect which is potentially
777 // less conservative than projecting the viewport into the layer. 792 // less conservative than projecting the viewport into the layer.
778 // Ignore tiles that are know to be outside the viewport. 793 // Ignore tiles that are know to be outside the viewport.
779 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 794 if (iter.priority().distance_to_visible_in_pixels != 0)
780 continue; 795 continue;
781 796
782 // If the missing region doesn't cover it, this tile is fully 797 // If the missing region doesn't cover it, this tile is fully
783 // covered by acceptable tiles at other scales. 798 // covered by acceptable tiles at other scales.
784 if (!missing_region->Intersects(iter.geometry_rect())) 799 if (!missing_region->Intersects(iter.geometry_rect()))
785 continue; 800 continue;
786 801
787 // If the twin tile isn't ready to draw, then this tile isn't 802 // If the twin tile isn't ready to draw, then this tile isn't
788 // required to prevent flashing. 803 // required to prevent flashing.
789 if (optional_twin_tiling) { 804 if (optional_twin_tiling) {
790 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); 805 Tile* twin_tile =
806 optional_twin_tiling->TileAt(ACTIVE_TREE, iter.i(), iter.j());
791 if (!twin_tile || !twin_tile->IsReadyToDraw()) { 807 if (!twin_tile || !twin_tile->IsReadyToDraw()) {
792 twin_had_missing_tile = true; 808 twin_had_missing_tile = true;
793 continue; 809 continue;
794 } 810 }
795 } 811 }
796 812
797 missing_region->Subtract(iter.geometry_rect()); 813 missing_region->Subtract(iter.geometry_rect());
798 tile->MarkRequiredForActivation(); 814 tile->MarkRequiredForActivation();
799 } 815 }
800 return twin_had_missing_tile; 816 return twin_had_missing_tile;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { 1223 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const {
1208 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); 1224 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded();
1209 return tilings_->GPUMemoryUsageInBytes(); 1225 return tilings_->GPUMemoryUsageInBytes();
1210 } 1226 }
1211 1227
1212 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1228 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
1213 benchmark->RunOnLayer(this); 1229 benchmark->RunOnLayer(this);
1214 } 1230 }
1215 1231
1216 } // namespace cc 1232 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698