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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 1894173004: Revert of cc: Stop locking the raster scale factor at 1 after any change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 0849c516bab58e63b183c957eb877e748f85187a..732b822aa8b78486622b95429e3d29e35c7b14cd 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -69,6 +69,7 @@
raster_source_scale_(0.f),
raster_contents_scale_(0.f),
low_res_raster_contents_scale_(0.f),
+ raster_source_scale_is_fixed_(false),
was_screen_space_transform_animating_(false),
only_used_low_res_last_append_quads_(false),
is_mask_(is_mask),
@@ -889,8 +890,10 @@
if (raster_device_scale_ != ideal_device_scale_)
return true;
- // When the source scale changes we want to match it, but not when animating.
+ // When the source scale changes we want to match it, but not when animating
+ // or when we've fixed the scale in place.
if (!draw_properties().screen_space_transform_is_animating &&
+ !raster_source_scale_is_fixed_ &&
raster_source_scale_ != ideal_source_scale_)
return true;
@@ -931,13 +934,32 @@
}
void PictureLayerImpl::RecalculateRasterScales() {
- const float old_raster_contents_scale = raster_contents_scale_;
- const float old_raster_page_scale = raster_page_scale_;
+ float old_raster_contents_scale = raster_contents_scale_;
+ float old_raster_page_scale = raster_page_scale_;
+ float old_raster_source_scale = raster_source_scale_;
raster_device_scale_ = ideal_device_scale_;
raster_page_scale_ = ideal_page_scale_;
raster_source_scale_ = ideal_source_scale_;
raster_contents_scale_ = ideal_contents_scale_;
+
+ // If we're not animating, or leaving an animation, and the
+ // ideal_source_scale_ changes, then things are unpredictable, and we fix
+ // the raster_source_scale_ in place.
+ if (old_raster_source_scale &&
+ !draw_properties().screen_space_transform_is_animating &&
+ !was_screen_space_transform_animating_ &&
+ old_raster_source_scale != ideal_source_scale_)
+ raster_source_scale_is_fixed_ = true;
+
+ // TODO(danakj): Adjust raster source scale closer to ideal source scale at
+ // a throttled rate. Possibly make use of invalidation_.IsEmpty() on pending
+ // tree. This will allow CSS scale changes to get re-rastered at an
+ // appropriate rate. (crbug.com/413636)
+ if (raster_source_scale_is_fixed_) {
+ raster_contents_scale_ /= raster_source_scale_;
+ raster_source_scale_ = 1.f;
+ }
// During pinch we completely ignore the current ideal scale, and just use
// a multiple of the previous scale.
@@ -1107,6 +1129,7 @@
raster_source_scale_ = 0.f;
raster_contents_scale_ = 0.f;
low_res_raster_contents_scale_ = 0.f;
+ raster_source_scale_is_fixed_ = false;
}
bool PictureLayerImpl::CanHaveTilings() const {
@@ -1190,7 +1213,6 @@
base::trace_event::TracedValue* state) const {
LayerImpl::AsValueInto(state);
state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
- state->SetDouble("raster_contents_scale", raster_contents_scale_);
state->SetDouble("geometry_contents_scale", MaximumTilingContentsScale());
state->BeginArray("tilings");
tilings_->AsValueInto(state);
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698