@@ -763,7 +763,7 @@ class CanvasGraphics {
763763 executionStartIdx ,
764764 continueCallback ,
765765 stepper ,
766- filteredOperationIndexes
766+ operationsFilter
767767 ) {
768768 const argsArray = operatorList . argsArray ;
769769 const fnArray = operatorList . fnArray ;
@@ -791,7 +791,7 @@ class CanvasGraphics {
791791 return i ;
792792 }
793793
794- if ( ! filteredOperationIndexes || filteredOperationIndexes . has ( i ) ) {
794+ if ( ! operationsFilter || operationsFilter ( i ) ) {
795795 fnId = fnArray [ i ] ;
796796 // TODO: There is a `undefined` coming from somewhere.
797797 fnArgs = argsArray [ i ] ?? null ;
@@ -1100,7 +1100,7 @@ class CanvasGraphics {
11001100 - offsetY ,
11011101 ] ) ;
11021102 fillCtx . fillStyle = isPatternFill
1103- ? fillColor . getPattern ( ctx , this , inverse , PathType . FILL )
1103+ ? fillColor . getPattern ( ctx , this , inverse , PathType . FILL , opIdx )
11041104 : fillColor ;
11051105
11061106 fillCtx . fillRect ( 0 , 0 , width , height ) ;
@@ -1549,7 +1549,8 @@ class CanvasGraphics {
15491549 ctx ,
15501550 this ,
15511551 getCurrentTransformInverse ( ctx ) ,
1552- PathType . STROKE
1552+ PathType . STROKE ,
1553+ opIdx
15531554 ) ;
15541555 if ( baseTransform ) {
15551556 const newPath = new Path2D ( ) ;
@@ -1603,7 +1604,8 @@ class CanvasGraphics {
16031604 ctx ,
16041605 this ,
16051606 getCurrentTransformInverse ( ctx ) ,
1606- PathType . FILL
1607+ PathType . FILL ,
1608+ opIdx
16071609 ) ;
16081610 if ( baseTransform ) {
16091611 const newPath = new Path2D ( ) ;
@@ -1759,7 +1761,7 @@ class CanvasGraphics {
17591761 setFont ( opIdx , fontRefName , size ) {
17601762 this . dependencyTracker
17611763 ?. recordSimpleData ( "font" , opIdx )
1762- . recordNamedDependency ( opIdx , fontRefName ) ;
1764+ . recordSimpleDataFromNamed ( "fontObj" , fontRefName , opIdx ) ;
17631765 const fontObj = this . commonObjs . get ( fontRefName ) ;
17641766 const current = this . current ;
17651767
@@ -2034,7 +2036,6 @@ class CanvasGraphics {
20342036 if ( this . dependencyTracker ) {
20352037 this . dependencyTracker
20362038 . recordDependencies ( opIdx , Dependencies . showText )
2037- . copyDependenciesFromIncrementalOperation ( opIdx , "sameLineText" )
20382039 . resetBBox ( opIdx ) ;
20392040 if ( this . current . textRenderingMode & TextRenderingMode . ADD_TO_PATH_FLAG ) {
20402041 this . dependencyTracker
@@ -2047,9 +2048,7 @@ class CanvasGraphics {
20472048 const font = current . font ;
20482049 if ( font . isType3Font ) {
20492050 this . showType3Text ( opIdx , glyphs ) ;
2050- this . dependencyTracker
2051- ?. recordOperation ( opIdx )
2052- . recordIncrementalData ( "sameLineText" , opIdx ) ;
2051+ this . dependencyTracker ?. recordShowTextOperation ( opIdx ) ;
20532052 return undefined ;
20542053 }
20552054
@@ -2095,7 +2094,8 @@ class CanvasGraphics {
20952094 ctx ,
20962095 this ,
20972096 getCurrentTransformInverse ( ctx ) ,
2098- PathType . FILL
2097+ PathType . FILL ,
2098+ opIdx
20992099 ) ;
21002100 patternFillTransform = getCurrentTransform ( ctx ) ;
21012101 ctx . restore ( ) ;
@@ -2108,7 +2108,8 @@ class CanvasGraphics {
21082108 ctx ,
21092109 this ,
21102110 getCurrentTransformInverse ( ctx ) ,
2111- PathType . STROKE
2111+ PathType . STROKE ,
2112+ opIdx
21122113 ) ;
21132114 patternStrokeTransform = getCurrentTransform ( ctx ) ;
21142115 ctx . restore ( ) ;
@@ -2157,8 +2158,7 @@ class CanvasGraphics {
21572158 - measure . actualBoundingBoxAscent ,
21582159 measure . actualBoundingBoxDescent
21592160 )
2160- . recordOperation ( opIdx )
2161- . recordIncrementalData ( "sameLineText" , opIdx ) ;
2161+ . recordShowTextOperation ( opIdx ) ;
21622162 }
21632163 current . x += width * widthAdvanceScale * textHScale ;
21642164 ctx . restore ( ) ;
@@ -2277,9 +2277,7 @@ class CanvasGraphics {
22772277 ctx . restore ( ) ;
22782278 this . compose ( ) ;
22792279
2280- this . dependencyTracker
2281- ?. recordOperation ( opIdx )
2282- . recordIncrementalData ( "sameLineText" , opIdx ) ;
2280+ this . dependencyTracker ?. recordShowTextOperation ( opIdx ) ;
22832281 return undefined ;
22842282 }
22852283
@@ -2351,7 +2349,6 @@ class CanvasGraphics {
23512349 }
23522350 ctx . restore ( ) ;
23532351 if ( dependencyTracker ) {
2354- this . dependencyTracker . recordNestedDependencies ( ) ;
23552352 this . dependencyTracker = dependencyTracker ;
23562353 }
23572354 }
@@ -2378,7 +2375,7 @@ class CanvasGraphics {
23782375 if ( IR [ 0 ] === "TilingPattern" ) {
23792376 const baseTransform = this . baseTransform || getCurrentTransform ( this . ctx ) ;
23802377 const canvasGraphicsFactory = {
2381- createCanvasGraphics : ctx =>
2378+ createCanvasGraphics : ( ctx , renderingOpIdx ) =>
23822379 new CanvasGraphics (
23832380 ctx ,
23842381 this . commonObjs ,
@@ -2392,7 +2389,11 @@ class CanvasGraphics {
23922389 undefined ,
23932390 undefined ,
23942391 this . dependencyTracker
2395- ? new CanvasNestedDependencyTracker ( this . dependencyTracker , opIdx )
2392+ ? new CanvasNestedDependencyTracker (
2393+ this . dependencyTracker ,
2394+ renderingOpIdx ,
2395+ /* ignoreBBoxes */ true
2396+ )
23962397 : null
23972398 ) ,
23982399 } ;
@@ -2470,7 +2471,8 @@ class CanvasGraphics {
24702471 ctx ,
24712472 this ,
24722473 getCurrentTransformInverse ( ctx ) ,
2473- PathType . SHADING
2474+ PathType . SHADING ,
2475+ opIdx
24742476 ) ;
24752477
24762478 const inv = getCurrentTransformInverse ( ctx ) ;
@@ -2937,7 +2939,8 @@ class CanvasGraphics {
29372939 maskCtx ,
29382940 this ,
29392941 getCurrentTransformInverse ( ctx ) ,
2940- PathType . FILL
2942+ PathType . FILL ,
2943+ opIdx
29412944 )
29422945 : fillColor ;
29432946 maskCtx . fillRect ( 0 , 0 , width , height ) ;
0 commit comments