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

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: perftest fix Created 7 years, 1 month 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 width,
enne (OOO) 2013/11/25 22:17:11 Are all these parameters just a gfx::Rect (in...co
vmpstr 2013/11/27 00:03:15 Yup, changed.
483 int height,
484 int offset_x,
485 int offset_y) {
486 return layer_tree_impl()->tile_manager()->CreateTileBundle(
487 width, height, offset_x, offset_y);
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) {
492 500
493 if (!twin_layer_) 501 if (!twin_layer_)
494 return NULL; 502 return NULL;
495 for (size_t i = 0; i < twin_layer_->tilings_->num_tilings(); ++i) 503 for (size_t i = 0; i < twin_layer_->tilings_->num_tilings(); ++i)
496 if (twin_layer_->tilings_->tiling_at(i)->contents_scale() == 504 if (twin_layer_->tilings_->tiling_at(i)->contents_scale() ==
497 tiling->contents_scale()) 505 tiling->contents_scale())
498 return twin_layer_->tilings_->tiling_at(i); 506 return twin_layer_->tilings_->tiling_at(i);
499 return NULL; 507 return NULL;
500 } 508 }
501 509
510 bool PictureLayerImpl::IsActive() const {
enne (OOO) 2013/11/25 22:17:11 I think PictureLayerTiling is guaranteed to be cre
vmpstr 2013/11/27 00:03:15 The one state change that's missing is going from
511 return layer_tree_impl()->IsActiveTree();
512 }
513
514 bool PictureLayerImpl::IsPending() const {
515 return layer_tree_impl()->IsPendingTree();
516 }
517
502 gfx::Size PictureLayerImpl::CalculateTileSize( 518 gfx::Size PictureLayerImpl::CalculateTileSize(
503 gfx::Size content_bounds) const { 519 gfx::Size content_bounds) const {
504 if (is_mask_) { 520 if (is_mask_) {
505 int max_size = layer_tree_impl()->MaxTextureSize(); 521 int max_size = layer_tree_impl()->MaxTextureSize();
506 return gfx::Size( 522 return gfx::Size(
507 std::min(max_size, content_bounds.width()), 523 std::min(max_size, content_bounds.width()),
508 std::min(max_size, content_bounds.height())); 524 std::min(max_size, content_bounds.height()));
509 } 525 }
510 526
511 int max_texture_size = 527 int max_texture_size =
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 contents_scale_x(), 714 contents_scale_x(),
699 rect); 715 rect);
700 iter; 716 iter;
701 ++iter) { 717 ++iter) {
702 if (!*iter || !iter->IsReadyToDraw()) 718 if (!*iter || !iter->IsReadyToDraw())
703 continue; 719 continue;
704 720
705 // This iteration is over the visible content rect which is potentially 721 // This iteration is over the visible content rect which is potentially
706 // less conservative than projecting the viewport into the layer. 722 // less conservative than projecting the viewport into the layer.
707 // Ignore tiles that are know to be outside the viewport. 723 // Ignore tiles that are know to be outside the viewport.
708 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 724 if (iter.priority().distance_to_visible_in_pixels != 0)
709 continue; 725 continue;
710 726
711 missing_region.Subtract(iter.geometry_rect()); 727 missing_region.Subtract(iter.geometry_rect());
712 iter->MarkRequiredForActivation(); 728 iter->MarkRequiredForActivation();
713 } 729 }
714 } 730 }
715 731
716 DCHECK(high_res) << "There must be one high res tiling"; 732 DCHECK(high_res) << "There must be one high res tiling";
717 for (PictureLayerTiling::CoverageIterator iter(high_res, 733 for (PictureLayerTiling::CoverageIterator iter(high_res,
718 contents_scale_x(), 734 contents_scale_x(),
719 rect); 735 rect);
720 iter; 736 iter;
721 ++iter) { 737 ++iter) {
722 // A null tile (i.e. missing recording) can just be skipped. 738 // A null tile (i.e. missing recording) can just be skipped.
723 if (!*iter) 739 if (!*iter)
724 continue; 740 continue;
725 741
726 // This iteration is over the visible content rect which is potentially 742 // This iteration is over the visible content rect which is potentially
727 // less conservative than projecting the viewport into the layer. 743 // less conservative than projecting the viewport into the layer.
728 // Ignore tiles that are know to be outside the viewport. 744 // Ignore tiles that are know to be outside the viewport.
729 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 745 if (iter.priority().distance_to_visible_in_pixels != 0)
730 continue; 746 continue;
731 747
732 // If the missing region doesn't cover it, this tile is fully 748 // If the missing region doesn't cover it, this tile is fully
733 // covered by acceptable tiles at other scales. 749 // covered by acceptable tiles at other scales.
734 if (!missing_region.Intersects(iter.geometry_rect())) 750 if (!missing_region.Intersects(iter.geometry_rect()))
735 continue; 751 continue;
736 752
737 iter->MarkRequiredForActivation(); 753 iter->MarkRequiredForActivation();
738 } 754 }
739 } 755 }
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { 1142 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const {
1127 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); 1143 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded();
1128 return tilings_->GPUMemoryUsageInBytes(); 1144 return tilings_->GPUMemoryUsageInBytes();
1129 } 1145 }
1130 1146
1131 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1147 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
1132 benchmark->RunOnLayer(this); 1148 benchmark->RunOnLayer(this);
1133 } 1149 }
1134 1150
1135 } // namespace cc 1151 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698