Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1850,17 +1850,13 @@ class CanvasGraphics {
return;
}

// Whatever was drawn has been moved to the suspended canvas, now clear it
// out of the current canvas. Only the dirty box region needs clearing;
// everything outside it is already transparent.
// Clear the full scratch canvas, not just the dirty box. Pixels left
// outside dirtyBox can leak into a later compose() whose destination-in
// pass doesn't overwrite them, producing stale output -- this is what
// breaks `firefox-issue17779-partial` (issue #21276).
this.ctx.save();
this.ctx.setTransform(1, 0, 0, 1, 0, 0);
this.ctx.clearRect(
dirtyBox[0],
dirtyBox[1],
dirtyBox[2] - dirtyBox[0],
dirtyBox[3] - dirtyBox[1]
);
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
this.ctx.restore();
}

Expand Down
3 changes: 2 additions & 1 deletion src/display/canvas_dependency_tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

import { BBOX_INIT, FeatureTest, Util } from "../shared/util.js";
import { getCurrentTransform } from "./display_utils.js";
import { MathClamp } from "../shared/math_clamp.js";

const FORCED_DEPENDENCY_LABEL = "__forcedDependency";
Expand Down Expand Up @@ -1121,7 +1122,7 @@ class CanvasImagesTracker {
this.#coords = newCoords;
}

const transform = Util.domMatrixToTransform(ctx.getTransform());
const transform = getCurrentTransform(ctx);

// We want top left, bottom left, top right.
// (0, 0) is the bottom left corner.
Expand Down
4 changes: 0 additions & 4 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,6 @@ class Util {
return `#${this.hexNums[r]}${this.hexNums[g]}${this.hexNums[b]}`;
}

static domMatrixToTransform(dm) {
return [dm.a, dm.b, dm.c, dm.d, dm.e, dm.f];
}

// Apply a scaling matrix to some min/max values.
// If a scaling factor is negative then min and max must be
// swapped.
Expand Down
Loading