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

Unified Diff: cc/picture_layer_impl.cc

Issue 12326022: Efficiently handle image layer scaling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win warnings Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/picture_layer_impl.h ('k') | cc/test/geometry_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_impl.cc
diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
index d950bec4a599da09c5e0abbba6dc197d9fbb7933..f528d2cfe5699cc8508dc0362f16afa37666b611 100644
--- a/cc/picture_layer_impl.cc
+++ b/cc/picture_layer_impl.cc
@@ -579,8 +579,6 @@ void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
if (pile_->recorded_region().IsEmpty())
return;
- float low_res_factor = layerTreeImpl()->settings().lowResContentsScaleFactor;
-
bool is_active_layer = layerTreeImpl()->IsActiveTree();
bool is_pinching = layerTreeImpl()->PinchGestureActive();
@@ -625,17 +623,11 @@ void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
raster_device_scale_ = ideal_device_scale_;
raster_source_scale_ = ideal_source_scale_;
- float raster_contents_scale = ideal_contents_scale_;
-
- // Don't allow animating CSS scales to drop below 1.
- if (animating_transform_to_screen) {
- raster_contents_scale = std::max(
- raster_contents_scale, 1.f * ideal_page_scale_ * ideal_device_scale_);
- }
-
- float low_res_raster_contents_scale = std::max(
- raster_contents_scale * low_res_factor,
- layerTreeImpl()->settings().minimumContentsScale);
+ float raster_contents_scale;
+ float low_res_raster_contents_scale;
+ CalculateRasterContentsScale(animating_transform_to_screen,
+ &raster_contents_scale,
+ &low_res_raster_contents_scale);
PictureLayerTiling* high_res = NULL;
PictureLayerTiling* low_res = NULL;
@@ -651,8 +643,11 @@ void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
tiling->set_resolution(NON_IDEAL_RESOLUTION);
}
- if (!high_res)
+ if (!high_res) {
high_res = AddTiling(raster_contents_scale);
+ if (raster_contents_scale == low_res_raster_contents_scale)
+ low_res = high_res;
+ }
if (!low_res && low_res != high_res)
low_res = AddTiling(low_res_raster_contents_scale);
@@ -662,6 +657,24 @@ void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
low_res->set_resolution(LOW_RESOLUTION);
}
+void PictureLayerImpl::CalculateRasterContentsScale(
+ bool animating_transform_to_screen,
+ float* raster_contents_scale,
+ float* low_res_raster_contents_scale) {
+ *raster_contents_scale = ideal_contents_scale_;
+
+ // Don't allow animating CSS scales to drop below 1.
+ if (animating_transform_to_screen) {
+ *raster_contents_scale = std::max(
+ *raster_contents_scale, 1.f * ideal_page_scale_ * ideal_device_scale_);
+ }
+
+ float low_res_factor = layerTreeImpl()->settings().lowResContentsScaleFactor;
+ *low_res_raster_contents_scale = std::max(
+ *raster_contents_scale * low_res_factor,
+ layerTreeImpl()->settings().minimumContentsScale);
+}
+
void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
std::vector<PictureLayerTiling*> used_tilings) {
DCHECK(layerTreeImpl()->IsActiveTree());
« no previous file with comments | « cc/picture_layer_impl.h ('k') | cc/test/geometry_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698