From 039a7a670f5e8bdfc0c8dbbb032e7a590e1bd024 Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Wed, 3 Nov 2021 11:46:52 -0700 Subject: [PATCH] Reset path bounding box tracking when starting a new path. Starting a new path will wipe out any of the current subpaths in the current graphics state, so we should reset the min/maxes. This makes a number of the bounding boxes smaller and reduces the number of composed pixels. For the smask tests in the corpus, the number of composed pixesl goes from 19,872,109 to 19,676,905. The difference is much larger on other PDFs though. --- src/display/canvas.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/display/canvas.js b/src/display/canvas.js index 205b6cfb5..c29f1cc9f 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -3071,6 +3071,7 @@ class CanvasGraphics { } this.pendingClip = null; } + this.current.startNewPathAndClipBox(this.current.clipBox); ctx.beginPath(); }