File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -363,12 +363,16 @@ describe("PDF viewer", () => {
363363 . toBeLessThan ( originalCanvasSize * factor ** 2 ) ;
364364
365365 expect ( canvasSize )
366- . withContext ( `In ${ browserName } , <= MAX_CANVAS_PIXELS` )
367- . toBeLessThanOrEqual ( MAX_CANVAS_PIXELS . get ( browserName ) ) ;
366+ . withContext ( `In ${ browserName } , <= MAX_CANVAS_PIXELS / 100 ` )
367+ . toBeLessThanOrEqual ( MAX_CANVAS_PIXELS . get ( browserName ) / 100 ) ;
368368
369369 expect ( canvasSize )
370- . withContext ( `In ${ browserName } , > MAX_CANVAS_PIXELS * 0.99` )
371- . toBeGreaterThan ( MAX_CANVAS_PIXELS . get ( browserName ) * 0.99 ) ;
370+ . withContext (
371+ `In ${ browserName } , > MAX_CANVAS_PIXELS / 100 * 0.95`
372+ )
373+ . toBeGreaterThan (
374+ ( MAX_CANVAS_PIXELS . get ( browserName ) / 100 ) * 0.95
375+ ) ;
372376 } )
373377 ) ;
374378 } ) ;
@@ -565,10 +569,10 @@ describe("PDF viewer", () => {
565569 . toBe ( 2 ) ;
566570 expect ( after [ 0 ] . width )
567571 . withContext ( `In ${ browserName } ` )
568- . toBe ( 582 * pixelRatio ) ;
572+ . toBe ( Math . floor ( 58.2 * pixelRatio ) ) ;
569573 expect ( after [ 0 ] . height )
570574 . withContext ( `In ${ browserName } ` )
571- . toBe ( 823 * pixelRatio ) ;
575+ . toBe ( Math . floor ( 82.3 * pixelRatio ) ) ;
572576
573577 // The dimensions of the detail canvas are capped to 800x600 but
574578 // it depends on the visible area which depends itself of the
Original file line number Diff line number Diff line change @@ -798,6 +798,12 @@ class PDFPageView extends BasePDFPageView {
798798 this . maxCanvasDim ,
799799 this . capCanvasAreaFactor
800800 ) ;
801+ if ( this . #needsRestrictedScaling && this . enableDetailCanvas ) {
802+ // If we are going to have a high-res detail view, further reduce
803+ // the canvas resolution to improve rendering performance.
804+ outputScale . sx /= 10 ;
805+ outputScale . sy /= 10 ;
806+ }
801807 }
802808 }
803809
You can’t perform that action at this time.
0 commit comments