@@ -1421,30 +1421,21 @@ class PartialEvaluator {
14211421 DrawOPS . closePath
14221422 ) ;
14231423 }
1424- minMax [ 0 ] = Math . min ( minMax [ 0 ] , x , xw ) ;
1425- minMax [ 1 ] = Math . min ( minMax [ 1 ] , y , yh ) ;
1426- minMax [ 2 ] = Math . max ( minMax [ 2 ] , x , xw ) ;
1427- minMax [ 3 ] = Math . max ( minMax [ 3 ] , y , yh ) ;
1424+ Util . rectBoundingBox ( x , y , xw , yh , minMax ) ;
14281425 break ;
14291426 }
14301427 case OPS . moveTo : {
14311428 const x = ( state . currentPointX = args [ 0 ] ) ;
14321429 const y = ( state . currentPointY = args [ 1 ] ) ;
14331430 pathBuffer . push ( DrawOPS . moveTo , x , y ) ;
1434- minMax [ 0 ] = Math . min ( minMax [ 0 ] , x ) ;
1435- minMax [ 1 ] = Math . min ( minMax [ 1 ] , y ) ;
1436- minMax [ 2 ] = Math . max ( minMax [ 2 ] , x ) ;
1437- minMax [ 3 ] = Math . max ( minMax [ 3 ] , y ) ;
1431+ Util . pointBoundingBox ( x , y , minMax ) ;
14381432 break ;
14391433 }
14401434 case OPS . lineTo : {
14411435 const x = ( state . currentPointX = args [ 0 ] ) ;
14421436 const y = ( state . currentPointY = args [ 1 ] ) ;
14431437 pathBuffer . push ( DrawOPS . lineTo , x , y ) ;
1444- minMax [ 0 ] = Math . min ( minMax [ 0 ] , x ) ;
1445- minMax [ 1 ] = Math . min ( minMax [ 1 ] , y ) ;
1446- minMax [ 2 ] = Math . max ( minMax [ 2 ] , x ) ;
1447- minMax [ 3 ] = Math . max ( minMax [ 3 ] , y ) ;
1438+ Util . pointBoundingBox ( x , y , minMax ) ;
14481439 break ;
14491440 }
14501441 case OPS . curveTo : {
@@ -4812,7 +4803,8 @@ class TranslatedFont {
48124803 // Override the fontBBox when it's undefined/empty, or when it's at least
48134804 // (approximately) one order of magnitude smaller than the charBBox
48144805 // (fixes issue14999_reduced.pdf).
4815- this . #computeCharBBox( charBBox ) ;
4806+ this . _bbox ??= [ Infinity , Infinity , - Infinity , - Infinity ] ;
4807+ Util . rectBoundingBox ( ...charBBox , this . _bbox ) ;
48164808 }
48174809
48184810 let i = 0 ,
@@ -4881,21 +4873,13 @@ class TranslatedFont {
48814873 case OPS . constructPath :
48824874 const minMax = operatorList . argsArray [ i ] [ 2 ] ;
48834875 // Override the fontBBox when it's undefined/empty (fixes 19624.pdf).
4884- this . #computeCharBBox( minMax ) ;
4876+ this . _bbox ??= [ Infinity , Infinity , - Infinity , - Infinity ] ;
4877+ Util . rectBoundingBox ( ...minMax , this . _bbox ) ;
48854878 break ;
48864879 }
48874880 i ++ ;
48884881 }
48894882 }
4890-
4891- #computeCharBBox( bbox ) {
4892- this . _bbox ||= [ Infinity , Infinity , - Infinity , - Infinity ] ;
4893-
4894- this . _bbox [ 0 ] = Math . min ( this . _bbox [ 0 ] , bbox [ 0 ] ) ;
4895- this . _bbox [ 1 ] = Math . min ( this . _bbox [ 1 ] , bbox [ 1 ] ) ;
4896- this . _bbox [ 2 ] = Math . max ( this . _bbox [ 2 ] , bbox [ 2 ] ) ;
4897- this . _bbox [ 3 ] = Math . max ( this . _bbox [ 3 ] , bbox [ 3 ] ) ;
4898- }
48994883}
49004884
49014885class StateManager {
0 commit comments