Remove the workaround for bug 1820511

This commit is contained in:
Calixte Denizet 2026-04-13 16:49:07 +02:00
parent 96debf0c81
commit ec35057b46
No known key found for this signature in database
GPG Key ID: 0C5442631EE0691F
3 changed files with 6 additions and 22 deletions

View File

@ -271,11 +271,8 @@ class ImageResizer {
const prevWidth = newWidth; const prevWidth = newWidth;
const prevHeight = newHeight; const prevHeight = newHeight;
// See bug 1820511 (Windows specific bug). newWidth = Math.floor(newWidth / step);
// TODO: once the above bug is fixed we could revert to: newHeight = Math.floor(newHeight / step);
// newWidth = Math.floor(newWidth / 2);
newWidth = Math.floor(newWidth / step) - 1;
newHeight = Math.floor(newHeight / step) - 1;
const canvas = new OffscreenCanvas(newWidth, newHeight); const canvas = new OffscreenCanvas(newWidth, newHeight);
const ctx = canvas.getContext("2d"); const ctx = canvas.getContext("2d");

View File

@ -903,15 +903,11 @@ class CanvasGraphics {
let nw = pw, let nw = pw,
nh = ph; nh = ph;
if (ws > 2 && pw > 1) { if (ws > 2 && pw > 1) {
// See bug 1820511 (Windows specific bug). nw = Math.ceil(pw / 2);
// TODO: once the above bug is fixed we could revert to:
// nw = Math.ceil(pw / 2);
nw = pw >= 16384 ? Math.floor(pw / 2) - 1 || 1 : Math.ceil(pw / 2);
ws /= pw / nw; ws /= pw / nw;
} }
if (hs > 2 && ph > 1) { if (hs > 2 && ph > 1) {
// TODO: see the comment above. nh = Math.ceil(ph / 2);
nh = ph >= 16384 ? Math.floor(ph / 2) - 1 || 1 : Math.ceil(ph) / 2;
hs /= ph / nh; hs /= ph / nh;
} }
scaleSteps.push({ newWidth: nw, newHeight: nh }); scaleSteps.push({ newWidth: nw, newHeight: nh });

View File

@ -624,19 +624,10 @@ class StampEditor extends AnnotationEditor {
const prevHeight = newHeight; const prevHeight = newHeight;
if (newWidth > 2 * width) { if (newWidth > 2 * width) {
// See bug 1820511 (Windows specific bug). newWidth = Math.ceil(newWidth / 2);
// TODO: once the above bug is fixed we could revert to:
// newWidth = Math.ceil(newWidth / 2);
newWidth =
newWidth >= 16384
? Math.floor(newWidth / 2) - 1
: Math.ceil(newWidth / 2);
} }
if (newHeight > 2 * height) { if (newHeight > 2 * height) {
newHeight = newHeight = Math.ceil(newHeight / 2);
newHeight >= 16384
? Math.floor(newHeight / 2) - 1
: Math.ceil(newHeight / 2);
} }
const offscreen = new OffscreenCanvas(newWidth, newHeight); const offscreen = new OffscreenCanvas(newWidth, newHeight);