Bug 1546126 - Fix the max blob tile limit logic. r=kats

Differential Revision: https://phabricator.services.mozilla.com/D28991

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2019-04-26 15:38:54 +00:00
Родитель dfa7158ec5
Коммит 8471eabd7f
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -1216,14 +1216,16 @@ impl ResourceCache {
&& (tiles.size.width > MAX_TILES_PER_REQUEST
|| tiles.size.height > MAX_TILES_PER_REQUEST
|| tiles.size.width * tiles.size.height > MAX_TILES_PER_REQUEST) {
let diff = tiles.size.width * tiles.size.height - MAX_TILES_PER_REQUEST;
let w = tiles.size.width;
let h = tiles.size.height;
let diff = w * h - MAX_TILES_PER_REQUEST;
// Remove tiles in the largest dimension.
if tiles.size.width > tiles.size.height {
tiles.size.width -= diff / tiles.size.height + 1;
tiles.origin.x += diff / (2 * tiles.size.height);
tiles.size.width -= diff / h + 1;
tiles.origin.x += diff / (2 * h);
} else {
tiles.size.height -= diff / tiles.size.width + 1;
tiles.origin.y += diff / (2 * tiles.size.height);
tiles.size.height -= diff / w + 1;
tiles.origin.y += diff / (2 * w);
}
}