From 81678f20cab04e65c4a2f4a85d0a17a1397258ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 27 Apr 2026 15:45:57 +0200 Subject: [PATCH] Fix array type in CanvasBBoxTracker comment Remove the "Float32Array" mention in the comment, given that the implementation usesa Float64Array. Actually using a Float32Array passes all the tests we currently have and reduces memory usage (by 16 bytes per op), however to be sure that it does not introduce rounding bugs we'd need to `Math.fround` all operations we do on the clipBox and pendingBBox. It reduces the readibilty of the code, but we can revisit if this memory usage becomes a problem. --- src/display/canvas_dependency_tracker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/display/canvas_dependency_tracker.js b/src/display/canvas_dependency_tracker.js index 55ac72d38..ad26428b1 100644 --- a/src/display/canvas_dependency_tracker.js +++ b/src/display/canvas_dependency_tracker.js @@ -78,9 +78,10 @@ const ensureDebugMetadata = (map, key) => class CanvasBBoxTracker { #baseTransformStack = [[1, 0, 0, 1, 0, 0]]; + // minX, minY, maxX, maxY #clipBox = [-Infinity, -Infinity, Infinity, Infinity]; - // Float32Array + // minX, minY, maxX, maxY #pendingBBox = new Float64Array(BBOX_INIT); _pendingBBoxIdx = -1;