File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -579,7 +579,7 @@ impl<R: BufRead> LosslessDecoder<R> {
579
579
. color_cache
580
580
. as_mut ( )
581
581
. ok_or ( DecodingError :: BitStreamError ) ?;
582
- data[ index * 4 ..] [ ..4 ] . copy_from_slice ( & color_cache. lookup ( key. into ( ) ) ? ) ;
582
+ data[ index * 4 ..] [ ..4 ] . copy_from_slice ( & color_cache. lookup ( key. into ( ) ) ) ;
583
583
index += 1 ;
584
584
}
585
585
}
@@ -665,6 +665,7 @@ struct ColorCache {
665
665
}
666
666
667
667
impl ColorCache {
668
+ #[ inline( always) ]
668
669
fn insert ( & mut self , color : [ u8 ; 4 ] ) {
669
670
let [ r, g, b, a] = color;
670
671
let color_u32 =
@@ -673,11 +674,9 @@ impl ColorCache {
673
674
self . color_cache [ index as usize ] = color;
674
675
}
675
676
676
- fn lookup ( & self , index : usize ) -> Result < [ u8 ; 4 ] , DecodingError > {
677
- match self . color_cache . get ( index) {
678
- Some ( & value) => Ok ( value) ,
679
- None => Err ( DecodingError :: BitStreamError ) ,
680
- }
677
+ #[ inline( always) ]
678
+ fn lookup ( & self , index : usize ) -> [ u8 ; 4 ] {
679
+ self . color_cache [ index]
681
680
}
682
681
}
683
682
You can’t perform that action at this time.
0 commit comments