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

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

Issue 2555363004: [6/6] git cl format (Closed)
Patch Set: Created 4 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.cc ('k') | cc/playback/raster_source.cc » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer()) 721 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer())
722 return &twin_layer->invalidation_; 722 return &twin_layer->invalidation_;
723 return nullptr; 723 return nullptr;
724 } 724 }
725 725
726 const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling( 726 const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling(
727 const PictureLayerTiling* tiling) const { 727 const PictureLayerTiling* tiling) const {
728 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); 728 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer();
729 if (!twin_layer) 729 if (!twin_layer)
730 return nullptr; 730 return nullptr;
731 const PictureLayerTiling* twin_tiling = twin_layer->tilings_->FindTilingWithSc aleKey(tiling->contents_scale_key()); 731 const PictureLayerTiling* twin_tiling =
732 twin_layer->tilings_->FindTilingWithScaleKey(
733 tiling->contents_scale_key());
732 DCHECK(tiling->raster_transform().translation() == gfx::Vector2dF()); 734 DCHECK(tiling->raster_transform().translation() == gfx::Vector2dF());
733 DCHECK(!twin_tiling || twin_tiling->raster_transform().translation() == gfx::V ector2dF()); 735 DCHECK(!twin_tiling ||
736 twin_tiling->raster_transform().translation() == gfx::Vector2dF());
734 return twin_tiling; 737 return twin_tiling;
735 } 738 }
736 739
737 bool PictureLayerImpl::RequiresHighResToDraw() const { 740 bool PictureLayerImpl::RequiresHighResToDraw() const {
738 return layer_tree_impl()->RequiresHighResToDraw(); 741 return layer_tree_impl()->RequiresHighResToDraw();
739 } 742 }
740 743
741 gfx::Rect PictureLayerImpl::GetEnclosingRectInTargetSpace() const { 744 gfx::Rect PictureLayerImpl::GetEnclosingRectInTargetSpace() const {
742 return GetScaledEnclosingRectInTargetSpace(MaximumTilingContentsScale()); 745 return GetScaledEnclosingRectInTargetSpace(MaximumTilingContentsScale());
743 } 746 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 } 883 }
881 884
882 void PictureLayerImpl::SetUseTransformedRasterization(bool use) { 885 void PictureLayerImpl::SetUseTransformedRasterization(bool use) {
883 if (use_transformed_rasterization_ == use) 886 if (use_transformed_rasterization_ == use)
884 return; 887 return;
885 888
886 use_transformed_rasterization_ = use; 889 use_transformed_rasterization_ = use;
887 NoteLayerPropertyChanged(); 890 NoteLayerPropertyChanged();
888 } 891 }
889 892
890 PictureLayerTiling* PictureLayerImpl::AddTiling(const ScaleTranslate2d& contents _transform) { 893 PictureLayerTiling* PictureLayerImpl::AddTiling(
894 const ScaleTranslate2d& contents_transform) {
891 DCHECK(CanHaveTilings()); 895 DCHECK(CanHaveTilings());
892 DCHECK_GE(contents_transform.scale(), MinimumContentsScale()); 896 DCHECK_GE(contents_transform.scale(), MinimumContentsScale());
893 DCHECK_LE(contents_transform.scale(), MaximumContentsScale()); 897 DCHECK_LE(contents_transform.scale(), MaximumContentsScale());
894 DCHECK(raster_source_->HasRecordings()); 898 DCHECK(raster_source_->HasRecordings());
895 return tilings_->AddTiling(contents_transform, raster_source_); 899 return tilings_->AddTiling(contents_transform, raster_source_);
896 } 900 }
897 901
898 void PictureLayerImpl::RemoveAllTilings() { 902 void PictureLayerImpl::RemoveAllTilings() {
899 tilings_->RemoveAllTilings(); 903 tilings_->RemoveAllTilings();
900 // If there are no tilings, then raster scales are no longer meaningful. 904 // If there are no tilings, then raster scales are no longer meaningful.
901 ResetRasterScale(); 905 ResetRasterScale();
902 } 906 }
903 907
904 void PictureLayerImpl::AddTilingsForRasterScale() { 908 void PictureLayerImpl::AddTilingsForRasterScale() {
905 // Reset all resolution enums on tilings, we'll be setting new values in this 909 // Reset all resolution enums on tilings, we'll be setting new values in this
906 // function. 910 // function.
907 tilings_->MarkAllTilingsNonIdeal(); 911 tilings_->MarkAllTilingsNonIdeal();
908 912
909 PictureLayerTiling* high_res = 913 PictureLayerTiling* high_res =
910 tilings_->FindTilingWithScaleKey(raster_contents_scale_); 914 tilings_->FindTilingWithScaleKey(raster_contents_scale_);
911 gfx::Vector2dF raster_translation = CalculateRasterTranslation(raster_contents _scale_); 915 gfx::Vector2dF raster_translation =
912 if (high_res && high_res->raster_transform().translation() != raster_translati on) { 916 CalculateRasterTranslation(raster_contents_scale_);
917 if (high_res &&
918 high_res->raster_transform().translation() != raster_translation) {
913 tilings_->Remove(high_res); 919 tilings_->Remove(high_res);
914 high_res = nullptr; 920 high_res = nullptr;
915 } 921 }
916 if (!high_res) { 922 if (!high_res) {
917 // We always need a high res tiling, so create one if it doesn't exist. 923 // We always need a high res tiling, so create one if it doesn't exist.
918 high_res = AddTiling(ScaleTranslate2d(raster_contents_scale_, raster_transla tion)); 924 high_res =
925 AddTiling(ScaleTranslate2d(raster_contents_scale_, raster_translation));
919 } else if (high_res->may_contain_low_resolution_tiles()) { 926 } else if (high_res->may_contain_low_resolution_tiles()) {
920 // If the tiling we find here was LOW_RESOLUTION previously, it may not be 927 // If the tiling we find here was LOW_RESOLUTION previously, it may not be
921 // fully rastered, so destroy the old tiles. 928 // fully rastered, so destroy the old tiles.
922 high_res->Reset(); 929 high_res->Reset();
923 // Reset the flag now that we'll make it high res, it will have fully 930 // Reset the flag now that we'll make it high res, it will have fully
924 // rastered content. 931 // rastered content.
925 high_res->reset_may_contain_low_resolution_tiles(); 932 high_res->reset_may_contain_low_resolution_tiles();
926 } 933 }
927 high_res->set_resolution(HIGH_RESOLUTION); 934 high_res->set_resolution(HIGH_RESOLUTION);
928 935
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 tilings_->FindTilingWithScaleKey(low_res_raster_contents_scale_); 1012 tilings_->FindTilingWithScaleKey(low_res_raster_contents_scale_);
1006 DCHECK(!low_res || low_res->resolution() != HIGH_RESOLUTION); 1013 DCHECK(!low_res || low_res->resolution() != HIGH_RESOLUTION);
1007 1014
1008 // Only create new low res tilings when the transform is static. This 1015 // Only create new low res tilings when the transform is static. This
1009 // prevents wastefully creating a paired low res tiling for every new high 1016 // prevents wastefully creating a paired low res tiling for every new high
1010 // res tiling during a pinch or a CSS animation. 1017 // res tiling during a pinch or a CSS animation.
1011 bool is_pinching = layer_tree_impl()->PinchGestureActive(); 1018 bool is_pinching = layer_tree_impl()->PinchGestureActive();
1012 bool is_animating = draw_properties().screen_space_transform_is_animating; 1019 bool is_animating = draw_properties().screen_space_transform_is_animating;
1013 if (!is_pinching && !is_animating) { 1020 if (!is_pinching && !is_animating) {
1014 if (!low_res) 1021 if (!low_res)
1015 low_res = AddTiling(ScaleTranslate2d(low_res_raster_contents_scale_, gfx:: Vector2dF())); 1022 low_res = AddTiling(
1023 ScaleTranslate2d(low_res_raster_contents_scale_, gfx::Vector2dF()));
1016 low_res->set_resolution(LOW_RESOLUTION); 1024 low_res->set_resolution(LOW_RESOLUTION);
1017 } 1025 }
1018 } 1026 }
1019 1027
1020 void PictureLayerImpl::RecalculateRasterScales() { 1028 void PictureLayerImpl::RecalculateRasterScales() {
1021 if (is_directly_composited_image_) { 1029 if (is_directly_composited_image_) {
1022 if (!raster_source_scale_) 1030 if (!raster_source_scale_)
1023 raster_source_scale_ = 1.f; 1031 raster_source_scale_ = 1.f;
1024 1032
1025 float min_scale = MinimumContentsScale(); 1033 float min_scale = MinimumContentsScale();
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1397 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1390 return !layer_tree_impl()->IsRecycleTree(); 1398 return !layer_tree_impl()->IsRecycleTree();
1391 } 1399 }
1392 1400
1393 bool PictureLayerImpl::HasValidTilePriorities() const { 1401 bool PictureLayerImpl::HasValidTilePriorities() const {
1394 return IsOnActiveOrPendingTree() && 1402 return IsOnActiveOrPendingTree() &&
1395 is_drawn_render_surface_layer_list_member(); 1403 is_drawn_render_surface_layer_list_member();
1396 } 1404 }
1397 1405
1398 } // namespace cc 1406 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.cc ('k') | cc/playback/raster_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698