@@ -61,7 +61,7 @@ import {
61
61
NodeWasmFactory ,
62
62
} from "display-node_utils" ;
63
63
import { CanvasGraphics } from "./canvas.js" ;
64
- import { CanvasRecorder } from "./canvas_recorder .js" ;
64
+ import { CanvasDependencyTracker } from "./canvas_dependency_tracker .js" ;
65
65
import { DOMCanvasFactory } from "./canvas_factory.js" ;
66
66
import { DOMCMapReaderFactory } from "display-cmap_reader_factory" ;
67
67
import { DOMFilterFactory } from "./filter_factory.js" ;
@@ -1462,19 +1462,16 @@ class PDFPageProxy {
1462
1462
this . _pumpOperatorList ( intentArgs ) ;
1463
1463
}
1464
1464
1465
- const recordingContext =
1465
+ const shouldRecordOperations =
1466
1466
this . _pdfBug &&
1467
1467
globalThis . StepperManager ?. enabled &&
1468
- ! this . _recordedGroups
1469
- ? new CanvasRecorder ( canvasContext )
1470
- : null ;
1468
+ ! this . _recordedGroups ;
1471
1469
1472
1470
const complete = error => {
1473
1471
intentState . renderTasks . delete ( internalRenderTask ) ;
1474
1472
1475
- if ( recordingContext ) {
1476
- this . _recordedGroups =
1477
- CanvasRecorder . getFinishedGroups ( recordingContext ) ;
1473
+ if ( shouldRecordOperations ) {
1474
+ this . _recordedGroups = internalRenderTask . gfx . dependencyTracker . take ( ) ;
1478
1475
internalRenderTask . stepper . setOperatorGroups ( this . _recordedGroups ) ;
1479
1476
}
1480
1477
@@ -1510,7 +1507,10 @@ class PDFPageProxy {
1510
1507
callback : complete ,
1511
1508
// Only include the required properties, and *not* the entire object.
1512
1509
params : {
1513
- canvasContext : recordingContext ?? canvasContext ,
1510
+ canvasContext : canvasContext ,
1511
+ dependencyTracker : shouldRecordOperations
1512
+ ? new CanvasDependencyTracker ( canvasContext )
1513
+ : null ,
1514
1514
viewport,
1515
1515
transform,
1516
1516
background,
@@ -3146,6 +3146,7 @@ class InternalRenderTask {
3146
3146
this . _scheduleNextBound = this . _scheduleNext . bind ( this ) ;
3147
3147
this . _nextBound = this . _next . bind ( this ) ;
3148
3148
this . _canvas = params . canvasContext . canvas ;
3149
+ this . _dependencyTracker = params . dependencyTracker ;
3149
3150
}
3150
3151
3151
3152
get completed ( ) {
@@ -3175,7 +3176,13 @@ class InternalRenderTask {
3175
3176
this . stepper . init ( this . operatorList ) ;
3176
3177
this . stepper . nextBreakPoint = this . stepper . getNextBreakPoint ( ) ;
3177
3178
}
3178
- const { canvasContext, viewport, transform, background } = this . params ;
3179
+ const {
3180
+ canvasContext,
3181
+ viewport,
3182
+ transform,
3183
+ background,
3184
+ dependencyTracker,
3185
+ } = this . params ;
3179
3186
3180
3187
this . gfx = new CanvasGraphics (
3181
3188
canvasContext ,
@@ -3185,7 +3192,8 @@ class InternalRenderTask {
3185
3192
this . filterFactory ,
3186
3193
{ optionalContentConfig } ,
3187
3194
this . annotationCanvasMap ,
3188
- this . pageColors
3195
+ this . pageColors ,
3196
+ dependencyTracker
3189
3197
) ;
3190
3198
this . gfx . beginDrawing ( {
3191
3199
transform,
0 commit comments