@@ -395,10 +395,9 @@ class MeshStreamReader {
395395 }
396396
397397 readCoordinate ( ) {
398- const bitsPerCoordinate = this . context . bitsPerCoordinate ;
398+ const { bitsPerCoordinate, decode } = this . context ;
399399 const xi = this . readBits ( bitsPerCoordinate ) ;
400400 const yi = this . readBits ( bitsPerCoordinate ) ;
401- const decode = this . context . decode ;
402401 const scale =
403402 bitsPerCoordinate < 32
404403 ? 1 / ( ( 1 << bitsPerCoordinate ) - 1 )
@@ -410,23 +409,20 @@ class MeshStreamReader {
410409 }
411410
412411 readComponents ( ) {
413- const numComps = this . context . numComps ;
414- const bitsPerComponent = this . context . bitsPerComponent ;
412+ const { bitsPerComponent , colorFn , colorSpace , decode , numComps } =
413+ this . context ;
415414 const scale =
416415 bitsPerComponent < 32
417416 ? 1 / ( ( 1 << bitsPerComponent ) - 1 )
418417 : 2.3283064365386963e-10 ; // 2 ^ -32
419- const decode = this . context . decode ;
420418 const components = this . tmpCompsBuf ;
421419 for ( let i = 0 , j = 4 ; i < numComps ; i ++ , j += 2 ) {
422420 const ci = this . readBits ( bitsPerComponent ) ;
423421 components [ i ] = ci * scale * ( decode [ j + 1 ] - decode [ j ] ) + decode [ j ] ;
424422 }
425423 const color = this . tmpCsCompsBuf ;
426- if ( this . context . colorFn ) {
427- this . context . colorFn ( components , 0 , color , 0 ) ;
428- }
429- return this . context . colorSpace . getRgb ( color , 0 ) ;
424+ colorFn ?. ( components , 0 , color , 0 ) ;
425+ return colorSpace . getRgb ( color , 0 ) ;
430426 }
431427}
432428
0 commit comments