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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 2252543002: cc: Introduce a max ideal contents scale constant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | 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 c8b45b730238455f8749fd0d844a377b592d4356..43ea41176a73e8becafcb1d0d8c86c9180db9800 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -56,6 +56,13 @@ const int kTileRoundUp = 64;
// width and height should be an even multiple of 4 in size.
const int kTileMinimalAlignment = 4;
+// Large contents scale can cause overflow issues. Cap the ideal contents scale
+// by this constant, since scales larger than this are usually not correct or
+// their scale doesn't matter as long as it's large. See
+// Renderer4.IdealContentsScale UMA for distribution of existing contents
+// scales.
+const float kMaxIdealContentsScale = 10000.f;
+
// Intersect rects which may have right() and bottom() that overflow integer
// boundaries. This code is similar to gfx::Rect::Intersect with the exception
// that the types are promoted to int64_t when there is a chance of overflow.
@@ -1247,7 +1254,9 @@ void PictureLayerImpl::UpdateIdealScales() {
? layer_tree_impl()->current_page_scale_factor()
: 1.f;
ideal_device_scale_ = layer_tree_impl()->device_scale_factor();
- ideal_contents_scale_ = std::max(GetIdealContentsScale(), min_contents_scale);
+ ideal_contents_scale_ =
+ std::min(kMaxIdealContentsScale,
+ std::max(GetIdealContentsScale(), min_contents_scale));
ideal_source_scale_ =
ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_;
UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.IdealContentsScale",
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698