@@ -1013,12 +1013,14 @@ struct Chunky4ColourLookup {
10131013}
10141014
10151015impl Chunky4ColourLookup {
1016+ /// Create a blank look-up table.
10161017 const fn blank ( ) -> Chunky4ColourLookup {
10171018 Chunky4ColourLookup {
10181019 entries : [ const { AtomicU32 :: new ( 0 ) } ; 256 ] ,
10191020 }
10201021 }
10211022
1023+ /// Initialise this look-up table from the palette.
10221024 fn init ( & self , palette : & [ AtomicU16 ] ) {
10231025 let palette = & palette[ 0 ..16 ] ;
10241026 for ( left_idx, left_colour) in palette. iter ( ) . enumerate ( ) {
@@ -1032,6 +1034,10 @@ impl Chunky4ColourLookup {
10321034 }
10331035 }
10341036
1037+ /// Update a look-up table entry.
1038+ ///
1039+ /// The `updated_palette_entry` is an index from 0..16 into the main palette
1040+ /// (given as `palette`).
10351041 fn update_index ( & self , updated_palette_entry : u8 , palette : & [ AtomicU16 ] ) {
10361042 let palette = & palette[ 0 ..16 ] ;
10371043 let updated_palette_entry = usize:: from ( updated_palette_entry) ;
@@ -1049,6 +1055,7 @@ impl Chunky4ColourLookup {
10491055 }
10501056 }
10511057
1058+ /// Turn a pair of chunky4 pixels (in a `u8`), into a pair of RGB pixels.
10521059 #[ inline]
10531060 fn lookup ( & self , pixel_pair : u8 ) -> RGBPair {
10541061 let index = usize:: from ( pixel_pair) ;
@@ -1091,7 +1098,7 @@ pub static GLYPH_ATTR_ARRAY: TextBuffer = TextBuffer::new();
10911098/// Copied at the start of every frame by the code on Core 1.
10921099pub static VIDEO_MODE : VideoMode = VideoMode :: new ( ) ;
10931100
1094- /// Holds 16 palette entries, paired with every other one of 16 palette entries.
1101+ /// Holds 16 palette entries, paired with every other of 16 palette entries.
10951102///
10961103/// Allows a fast lookup of an RGB pixel pair given two 4-bpp pixels packed into a byte.
10971104static CHUNKY4_COLOUR_LOOKUP : Chunky4ColourLookup = Chunky4ColourLookup :: blank ( ) ;
0 commit comments