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

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

Issue 820703002: c:: Give the raster source to the PictureLayerTilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rastersource: . Created 6 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
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 592
593 if (!can_have_tilings) { 593 if (!can_have_tilings) {
594 RemoveAllTilings(); 594 RemoveAllTilings();
595 return; 595 return;
596 } 596 }
597 597
598 // We could do this after doing UpdateTiles, which would avoid doing this for 598 // We could do this after doing UpdateTiles, which would avoid doing this for
599 // tilings that are going to disappear on the pending tree (if scale changed). 599 // tilings that are going to disappear on the pending tree (if scale changed).
600 // But that would also be more complicated, so we just do it here for now. 600 // But that would also be more complicated, so we just do it here for now.
601 tilings_->UpdateTilingsToCurrentRasterSource( 601 tilings_->UpdateTilingsToCurrentRasterSource(
602 raster_source_.get(), pending_set, invalidation_, MinimumContentsScale(), 602 raster_source_, pending_set, invalidation_, MinimumContentsScale(),
603 MaximumContentsScale()); 603 MaximumContentsScale());
604 } 604 }
605 605
606 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { 606 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) {
607 if (layer_tree_impl()->IsActiveTree()) { 607 if (layer_tree_impl()->IsActiveTree()) {
608 gfx::RectF layer_damage_rect = 608 gfx::RectF layer_damage_rect =
609 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); 609 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale());
610 AddDamageRect(layer_damage_rect); 610 AddDamageRect(layer_damage_rect);
611 } 611 }
612 } 612 }
(...skipping 18 matching lines...) Expand all
631 // To avoid an edge case after lost context where the tree is up to date but 631 // To avoid an edge case after lost context where the tree is up to date but
632 // the tilings have not been managed, request an update draw properties 632 // the tilings have not been managed, request an update draw properties
633 // to force tilings to get managed. 633 // to force tilings to get managed.
634 layer_tree_impl()->set_needs_update_draw_properties(); 634 layer_tree_impl()->set_needs_update_draw_properties();
635 } 635 }
636 636
637 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { 637 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() {
638 return raster_source_->GetFlattenedPicture(); 638 return raster_source_->GetFlattenedPicture();
639 } 639 }
640 640
641 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, 641 scoped_refptr<Tile> PictureLayerImpl::CreateTile(
642 const gfx::Rect& content_rect) { 642 float contents_scale,
643 DCHECK(!raster_source_->IsSolidColor()); 643 const gfx::Rect& content_rect) {
644 if (!raster_source_->CoversRect(content_rect, tiling->contents_scale()))
645 return scoped_refptr<Tile>();
646
647 int flags = 0; 644 int flags = 0;
648 645
649 // We don't handle solid color masks, so we shouldn't bother analyzing those. 646 // We don't handle solid color masks, so we shouldn't bother analyzing those.
650 // Otherwise, always analyze to maximize memory savings. 647 // Otherwise, always analyze to maximize memory savings.
651 if (!is_mask_) 648 if (!is_mask_)
652 flags = Tile::USE_PICTURE_ANALYSIS; 649 flags = Tile::USE_PICTURE_ANALYSIS;
653 650
654 return layer_tree_impl()->tile_manager()->CreateTile( 651 return layer_tree_impl()->tile_manager()->CreateTile(
655 raster_source_.get(), content_rect.size(), content_rect, 652 raster_source_.get(), content_rect.size(), content_rect, contents_scale,
656 tiling->contents_scale(), id(), layer_tree_impl()->source_frame_number(), 653 id(), layer_tree_impl()->source_frame_number(), flags);
657 flags);
658 } 654 }
659 655
660 const Region* PictureLayerImpl::GetPendingInvalidation() { 656 const Region* PictureLayerImpl::GetPendingInvalidation() {
661 if (layer_tree_impl()->IsPendingTree()) 657 if (layer_tree_impl()->IsPendingTree())
662 return &invalidation_; 658 return &invalidation_;
663 if (layer_tree_impl()->IsRecycleTree()) 659 if (layer_tree_impl()->IsRecycleTree())
664 return nullptr; 660 return nullptr;
665 DCHECK(layer_tree_impl()->IsActiveTree()); 661 DCHECK(layer_tree_impl()->IsActiveTree());
666 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer()) 662 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer())
667 return &twin_layer->invalidation_; 663 return &twin_layer->invalidation_;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 807
812 nearest_neighbor_ = nearest_neighbor; 808 nearest_neighbor_ = nearest_neighbor;
813 NoteLayerPropertyChanged(); 809 NoteLayerPropertyChanged();
814 } 810 }
815 811
816 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { 812 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
817 DCHECK(CanHaveTilings()); 813 DCHECK(CanHaveTilings());
818 DCHECK_GE(contents_scale, MinimumContentsScale()); 814 DCHECK_GE(contents_scale, MinimumContentsScale());
819 DCHECK_LE(contents_scale, MaximumContentsScale()); 815 DCHECK_LE(contents_scale, MaximumContentsScale());
820 DCHECK(raster_source_->HasRecordings()); 816 DCHECK(raster_source_->HasRecordings());
821 return tilings_->AddTiling(contents_scale, raster_source_->GetSize()); 817 return tilings_->AddTiling(contents_scale, raster_source_);
822 } 818 }
823 819
824 void PictureLayerImpl::RemoveAllTilings() { 820 void PictureLayerImpl::RemoveAllTilings() {
825 if (tilings_) 821 if (tilings_)
826 tilings_->RemoveAllTilings(); 822 tilings_->RemoveAllTilings();
827 // If there are no tilings, then raster scales are no longer meaningful. 823 // If there are no tilings, then raster scales are no longer meaningful.
828 ResetRasterScale(); 824 ResetRasterScale();
829 } 825 }
830 826
831 void PictureLayerImpl::AddTilingsForRasterScale() { 827 void PictureLayerImpl::AddTilingsForRasterScale() {
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 1325
1330 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { 1326 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const {
1331 if (!layer_tree_impl()->IsActiveTree()) 1327 if (!layer_tree_impl()->IsActiveTree())
1332 return true; 1328 return true;
1333 1329
1334 return AllTilesRequiredAreReadyToDraw( 1330 return AllTilesRequiredAreReadyToDraw(
1335 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); 1331 &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
1336 } 1332 }
1337 1333
1338 } // namespace cc 1334 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698