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

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

Issue 2105673003: cc: Compute animation scale on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit changes Created 4 years, 5 months 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/layer_impl.cc ('k') | cc/layers/picture_layer_impl_unittest.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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 // If we're not re-rasterizing during animation, rasterize at the maximum 1018 // If we're not re-rasterizing during animation, rasterize at the maximum
1019 // scale that will occur during the animation, if the maximum scale is 1019 // scale that will occur during the animation, if the maximum scale is
1020 // known. However we want to avoid excessive memory use. If the scale is 1020 // known. However we want to avoid excessive memory use. If the scale is
1021 // smaller than what we would choose otherwise, then it's always better off 1021 // smaller than what we would choose otherwise, then it's always better off
1022 // for us memory-wise. But otherwise, we don't choose a scale at which this 1022 // for us memory-wise. But otherwise, we don't choose a scale at which this
1023 // layer's rastered content would become larger than the viewport. 1023 // layer's rastered content would become larger than the viewport.
1024 if (draw_properties().screen_space_transform_is_animating && 1024 if (draw_properties().screen_space_transform_is_animating &&
1025 !ShouldAdjustRasterScaleDuringScaleAnimations()) { 1025 !ShouldAdjustRasterScaleDuringScaleAnimations()) {
1026 bool can_raster_at_maximum_scale = false; 1026 bool can_raster_at_maximum_scale = false;
1027 bool should_raster_at_starting_scale = false; 1027 bool should_raster_at_starting_scale = false;
1028 float maximum_scale = draw_properties().maximum_animation_contents_scale; 1028 CombinedAnimationScale animation_scales =
1029 float starting_scale = draw_properties().starting_animation_contents_scale; 1029 layer_tree_impl()->property_trees()->GetAnimationScales(
1030 transform_tree_index(), layer_tree_impl());
1031 float maximum_scale = animation_scales.maximum_animation_scale;
1032 float starting_scale = animation_scales.starting_animation_scale;
1030 if (maximum_scale) { 1033 if (maximum_scale) {
1031 gfx::Size bounds_at_maximum_scale = 1034 gfx::Size bounds_at_maximum_scale =
1032 gfx::ScaleToCeiledSize(raster_source_->GetSize(), maximum_scale); 1035 gfx::ScaleToCeiledSize(raster_source_->GetSize(), maximum_scale);
1033 int64_t maximum_area = 1036 int64_t maximum_area =
1034 static_cast<int64_t>(bounds_at_maximum_scale.width()) * 1037 static_cast<int64_t>(bounds_at_maximum_scale.width()) *
1035 static_cast<int64_t>(bounds_at_maximum_scale.height()); 1038 static_cast<int64_t>(bounds_at_maximum_scale.height());
1036 gfx::Size viewport = layer_tree_impl()->device_viewport_size(); 1039 gfx::Size viewport = layer_tree_impl()->device_viewport_size();
1037 int64_t viewport_area = static_cast<int64_t>(viewport.width()) * 1040 int64_t viewport_area = static_cast<int64_t>(viewport.width()) *
1038 static_cast<int64_t>(viewport.height()); 1041 static_cast<int64_t>(viewport.height());
1039 if (maximum_area <= viewport_area) 1042 if (maximum_area <= viewport_area)
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1304 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1302 return !layer_tree_impl()->IsRecycleTree(); 1305 return !layer_tree_impl()->IsRecycleTree();
1303 } 1306 }
1304 1307
1305 bool PictureLayerImpl::HasValidTilePriorities() const { 1308 bool PictureLayerImpl::HasValidTilePriorities() const {
1306 return IsOnActiveOrPendingTree() && 1309 return IsOnActiveOrPendingTree() &&
1307 is_drawn_render_surface_layer_list_member(); 1310 is_drawn_render_surface_layer_list_member();
1308 } 1311 }
1309 1312
1310 } // namespace cc 1313 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698