File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -968,20 +968,13 @@ class MeshShading extends BaseShading {
968968 }
969969
970970 getIR ( ) {
971- const { bounds } = this ;
972- // Ensure that the shading has non-zero width and height, to prevent errors
973- // in `pattern_helper.js` (fixes issue17848.pdf).
974- if ( bounds [ 2 ] - bounds [ 0 ] === 0 || bounds [ 3 ] - bounds [ 1 ] === 0 ) {
975- throw new FormatError ( `Invalid MeshShading bounds: [${ bounds } ].` ) ;
976- }
977-
978971 return [
979972 "Mesh" ,
980973 this . shadingType ,
981974 this . coords ,
982975 this . colors ,
983976 this . figures ,
984- bounds ,
977+ this . bounds ,
985978 this . bbox ,
986979 this . background ,
987980 ] ;
Original file line number Diff line number Diff line change @@ -462,16 +462,20 @@ class MeshShadingPattern extends BaseShadingPattern {
462462 const boundsWidth = Math . ceil ( this . _bounds [ 2 ] ) - offsetX ;
463463 const boundsHeight = Math . ceil ( this . _bounds [ 3 ] ) - offsetY ;
464464
465- const width = Math . min (
466- Math . ceil ( Math . abs ( boundsWidth * combinedScale [ 0 ] * EXPECTED_SCALE ) ) ,
467- MAX_PATTERN_SIZE
468- ) ;
469- const height = Math . min (
470- Math . ceil ( Math . abs ( boundsHeight * combinedScale [ 1 ] * EXPECTED_SCALE ) ) ,
471- MAX_PATTERN_SIZE
472- ) ;
473- const scaleX = boundsWidth / width ;
474- const scaleY = boundsHeight / height ;
465+ // Ensure that the shading has non-zero width and height, to prevent errors
466+ // in `pattern_helper.js` (fixes issue17848.pdf).
467+ const width =
468+ Math . min (
469+ Math . ceil ( Math . abs ( boundsWidth * combinedScale [ 0 ] * EXPECTED_SCALE ) ) ,
470+ MAX_PATTERN_SIZE
471+ ) || 1 ;
472+ const height =
473+ Math . min (
474+ Math . ceil ( Math . abs ( boundsHeight * combinedScale [ 1 ] * EXPECTED_SCALE ) ) ,
475+ MAX_PATTERN_SIZE
476+ ) || 1 ;
477+ const scaleX = boundsWidth ? boundsWidth / width : 1 ;
478+ const scaleY = boundsHeight ? boundsHeight / height : 1 ;
475479
476480 const context = {
477481 coords : this . _coords ,
Original file line number Diff line number Diff line change 884884! form_two_pages.pdf
885885! outlines_se.pdf
886886! radial_gradients.pdf
887+ ! mesh_shading_empty.pdf
Original file line number Diff line number Diff line change 1399813998 "md5" : " 80e8bed66b83928698f008c33de47edd" ,
1399913999 "rounds" : 1 ,
1400014000 "type" : " eq"
14001+ },
14002+ {
14003+ "id" : " mesh_shading_empty" ,
14004+ "file" : " pdfs/mesh_shading_empty.pdf" ,
14005+ "md5" : " 5a1bf9cb73010d84b47d91bb66bae27d" ,
14006+ "rounds" : 1 ,
14007+ "type" : " eq"
1400114008 }
1400214009]
You can’t perform that action at this time.
0 commit comments