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

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: 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 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 float width; 167 float width;
168 if (*iter && iter->IsReadyToDraw()) { 168 if (*iter && iter->IsReadyToDraw()) {
169 ManagedTileState::TileVersion::Mode mode = 169 ManagedTileState::TileVersion::Mode mode =
170 iter->GetTileVersionForDrawing().mode(); 170 iter->GetTileVersionForDrawing().mode();
171 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { 171 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) {
172 color = DebugColors::SolidColorTileBorderColor(); 172 color = DebugColors::SolidColorTileBorderColor();
173 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); 173 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl());
174 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { 174 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) {
175 color = DebugColors::PictureTileBorderColor(); 175 color = DebugColors::PictureTileBorderColor();
176 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); 176 width = DebugColors::PictureTileBorderWidth(layer_tree_impl());
177 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { 177 } else if (iter.priority().resolution == HIGH_RESOLUTION) {
178 color = DebugColors::HighResTileBorderColor(); 178 color = DebugColors::HighResTileBorderColor();
179 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); 179 width = DebugColors::HighResTileBorderWidth(layer_tree_impl());
180 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { 180 } else if (iter.priority().resolution == LOW_RESOLUTION) {
181 color = DebugColors::LowResTileBorderColor(); 181 color = DebugColors::LowResTileBorderColor();
182 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); 182 width = DebugColors::LowResTileBorderWidth(layer_tree_impl());
183 } else if (iter->contents_scale() > contents_scale_x()) { 183 } else if (iter->contents_scale() > contents_scale_x()) {
184 color = DebugColors::ExtraHighResTileBorderColor(); 184 color = DebugColors::ExtraHighResTileBorderColor();
185 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); 185 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl());
186 } else { 186 } else {
187 color = DebugColors::ExtraLowResTileBorderColor(); 187 color = DebugColors::ExtraLowResTileBorderColor();
188 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); 188 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl());
189 } 189 }
190 } else { 190 } else {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 pile_.get(), 467 pile_.get(),
468 content_rect.size(), 468 content_rect.size(),
469 content_rect, 469 content_rect,
470 contents_opaque() ? content_rect : gfx::Rect(), 470 contents_opaque() ? content_rect : gfx::Rect(),
471 tiling->contents_scale(), 471 tiling->contents_scale(),
472 id(), 472 id(),
473 layer_tree_impl()->source_frame_number(), 473 layer_tree_impl()->source_frame_number(),
474 is_using_lcd_text_); 474 is_using_lcd_text_);
475 } 475 }
476 476
477 scoped_refptr<TileBundle> PictureLayerImpl::CreateTileBundle(int width,
478 int height,
479 int offset_x,
480 int offset_y) {
481 scoped_refptr<TileBundle> bundle =
482 layer_tree_impl()->tile_manager()->CreateTileBundle(
483 width, height, offset_x, offset_y);
484 bundle->SetClient(this);
485 return bundle;
486 }
487
477 void PictureLayerImpl::UpdatePile(Tile* tile) { 488 void PictureLayerImpl::UpdatePile(Tile* tile) {
478 tile->set_picture_pile(pile_); 489 tile->set_picture_pile(pile_);
479 } 490 }
480 491
481 const Region* PictureLayerImpl::GetInvalidation() { 492 const Region* PictureLayerImpl::GetInvalidation() {
482 return &invalidation_; 493 return &invalidation_;
483 } 494 }
484 495
485 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( 496 const PictureLayerTiling* PictureLayerImpl::GetTwinTiling(
486 const PictureLayerTiling* tiling) { 497 const PictureLayerTiling* tiling) {
487 498
488 if (!twin_layer_) 499 if (!twin_layer_)
489 return NULL; 500 return NULL;
490 for (size_t i = 0; i < twin_layer_->tilings_->num_tilings(); ++i) 501 for (size_t i = 0; i < twin_layer_->tilings_->num_tilings(); ++i)
491 if (twin_layer_->tilings_->tiling_at(i)->contents_scale() == 502 if (twin_layer_->tilings_->tiling_at(i)->contents_scale() ==
492 tiling->contents_scale()) 503 tiling->contents_scale())
493 return twin_layer_->tilings_->tiling_at(i); 504 return twin_layer_->tilings_->tiling_at(i);
494 return NULL; 505 return NULL;
495 } 506 }
496 507
508 bool PictureLayerImpl::IsRecycled() const {
509 return layer_tree_impl()->IsRecycleTree();
510 }
511
512 bool PictureLayerImpl::IsActive() const {
513 return layer_tree_impl()->IsActiveTree();
514 }
515
516 bool PictureLayerImpl::IsPending() const {
517 return layer_tree_impl()->IsPendingTree();
518 }
519
497 gfx::Size PictureLayerImpl::CalculateTileSize( 520 gfx::Size PictureLayerImpl::CalculateTileSize(
498 gfx::Size content_bounds) const { 521 gfx::Size content_bounds) const {
499 if (is_mask_) { 522 if (is_mask_) {
500 int max_size = layer_tree_impl()->MaxTextureSize(); 523 int max_size = layer_tree_impl()->MaxTextureSize();
501 return gfx::Size( 524 return gfx::Size(
502 std::min(max_size, content_bounds.width()), 525 std::min(max_size, content_bounds.width()),
503 std::min(max_size, content_bounds.height())); 526 std::min(max_size, content_bounds.height()));
504 } 527 }
505 528
506 int max_texture_size = 529 int max_texture_size =
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 contents_scale_x(), 716 contents_scale_x(),
694 rect); 717 rect);
695 iter; 718 iter;
696 ++iter) { 719 ++iter) {
697 if (!*iter || !iter->IsReadyToDraw()) 720 if (!*iter || !iter->IsReadyToDraw())
698 continue; 721 continue;
699 722
700 // This iteration is over the visible content rect which is potentially 723 // This iteration is over the visible content rect which is potentially
701 // less conservative than projecting the viewport into the layer. 724 // less conservative than projecting the viewport into the layer.
702 // Ignore tiles that are know to be outside the viewport. 725 // Ignore tiles that are know to be outside the viewport.
703 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 726 if (iter.priority().distance_to_visible_in_pixels != 0)
704 continue; 727 continue;
705 728
706 missing_region.Subtract(iter.geometry_rect()); 729 missing_region.Subtract(iter.geometry_rect());
707 iter->MarkRequiredForActivation(); 730 iter->MarkRequiredForActivation();
708 } 731 }
709 } 732 }
710 733
711 DCHECK(high_res) << "There must be one high res tiling"; 734 DCHECK(high_res) << "There must be one high res tiling";
712 for (PictureLayerTiling::CoverageIterator iter(high_res, 735 for (PictureLayerTiling::CoverageIterator iter(high_res,
713 contents_scale_x(), 736 contents_scale_x(),
714 rect); 737 rect);
715 iter; 738 iter;
716 ++iter) { 739 ++iter) {
717 // A null tile (i.e. missing recording) can just be skipped. 740 // A null tile (i.e. missing recording) can just be skipped.
718 if (!*iter) 741 if (!*iter)
719 continue; 742 continue;
720 743
721 // This iteration is over the visible content rect which is potentially 744 // This iteration is over the visible content rect which is potentially
722 // less conservative than projecting the viewport into the layer. 745 // less conservative than projecting the viewport into the layer.
723 // Ignore tiles that are know to be outside the viewport. 746 // Ignore tiles that are know to be outside the viewport.
724 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 747 if (iter.priority().distance_to_visible_in_pixels != 0)
725 continue; 748 continue;
726 749
727 // If the missing region doesn't cover it, this tile is fully 750 // If the missing region doesn't cover it, this tile is fully
728 // covered by acceptable tiles at other scales. 751 // covered by acceptable tiles at other scales.
729 if (!missing_region.Intersects(iter.geometry_rect())) 752 if (!missing_region.Intersects(iter.geometry_rect()))
730 continue; 753 continue;
731 754
732 iter->MarkRequiredForActivation(); 755 iter->MarkRequiredForActivation();
733 } 756 }
734 } 757 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { 1117 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const {
1095 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); 1118 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded();
1096 return tilings_->GPUMemoryUsageInBytes(); 1119 return tilings_->GPUMemoryUsageInBytes();
1097 } 1120 }
1098 1121
1099 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1122 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
1100 benchmark->RunOnLayer(this); 1123 benchmark->RunOnLayer(this);
1101 } 1124 }
1102 1125
1103 } // namespace cc 1126 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698