@@ -665,13 +665,7 @@ class OutputScale {
665665 maxWidthScale = Infinity ,
666666 maxHeightScale = Infinity ;
667667
668- if ( capAreaFactor >= 0 ) {
669- const cappedWindowArea = OutputScale . getCappedWindowArea ( capAreaFactor ) ;
670- maxPixels =
671- maxPixels > 0
672- ? Math . min ( maxPixels , cappedWindowArea )
673- : cappedWindowArea ;
674- }
668+ maxPixels = OutputScale . capPixels ( maxPixels , capAreaFactor ) ;
675669 if ( maxPixels > 0 ) {
676670 maxAreaScale = Math . sqrt ( maxPixels / ( width * height ) ) ;
677671 }
@@ -693,21 +687,18 @@ class OutputScale {
693687 return globalThis . devicePixelRatio || 1 ;
694688 }
695689
696- static getCappedWindowArea ( capAreaFactor ) {
697- if ( typeof PDFJSDev !== "undefined" && PDFJSDev . test ( "TESTING" ) ) {
698- return Math . ceil (
699- window . innerWidth *
700- window . innerHeight *
690+ static capPixels ( maxPixels , capAreaFactor ) {
691+ if ( capAreaFactor >= 0 ) {
692+ const winPixels = Math . ceil (
693+ ( typeof PDFJSDev !== "undefined" && PDFJSDev . test ( "TESTING" )
694+ ? window . innerWidth * window . innerHeight
695+ : window . screen . availWidth * window . screen . availHeight ) *
701696 this . pixelRatio ** 2 *
702697 ( 1 + capAreaFactor / 100 )
703698 ) ;
699+ return maxPixels > 0 ? Math . min ( maxPixels , winPixels ) : winPixels ;
704700 }
705- return Math . ceil (
706- window . screen . availWidth *
707- window . screen . availHeight *
708- this . pixelRatio ** 2 *
709- ( 1 + capAreaFactor / 100 )
710- ) ;
701+ return maxPixels ;
711702 }
712703}
713704
0 commit comments