Commit de4794c3 authored by Khushal's avatar Khushal Committed by Commit Bot

cc: Cap raster scale ratio between horizontal and vertical scaling.

Since we do uniform scaling horizontally and vertically when rastering
content and choose the higher scale between the 2, this can lead to
excessive memory use if the ratio between the 2 scales and layer bounds
is extremely high. Cap this ratio to some limit (arbitrarily chosen).

Change-Id: If90b101d5a096c03dfb22fb633f3b33e2600eb74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1790958Reviewed-by: default avatarenne <enne@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Commit-Queue: Khushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694889}
parent 999a3129
......@@ -1001,7 +1001,11 @@ float LayerImpl::GetIdealContentsScale() const {
gfx::Vector2dF transform_scales =
MathUtil::ComputeTransform2dScaleComponents(transform, default_scale);
return std::max(transform_scales.x(), transform_scales.y());
constexpr float kMaxScaleRatio = 5.f;
float lower_scale = std::min(transform_scales.x(), transform_scales.y());
float higher_scale = std::max(transform_scales.x(), transform_scales.y());
return std::min(kMaxScaleRatio * lower_scale, higher_scale);
}
PropertyTrees* LayerImpl::GetPropertyTrees() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment