fn put_rect(&mut self, pixel: PixelType, data: &[u8], gpu: &TextureGlyph) {
        self.buffer.clear();
        match pixel {
            PixelType::Alpha => {
                self.buffer.extend(iter::repeat(255).take(data.len() * 4));
                for (i, alpha) in data.iter().copied().enumerate() {
                    self.buffer[i * 4 + 3] = alpha;
                }
            }
            PixelType::RGBA => {
                self.buffer.extend_from_slice(data);
            }
        }
        let bounds = gpu.bounds;
        self.image.set_sub_data(
            &self.buffer[..],
            bounds.x as u32,
            bounds.y as u32,
            bounds.width,
            bounds.height,
            ColorFormat::RGBA,
        );
    }
/// Write the data from a font into a texture
Write the data from a font into a texture
Write the data from a font into a texture
fn put_rect(&mut self, pixel: PixelType, data: &[u8], gpu: &TextureGlyph) {
        self.buffer.clear();
        match pixel {
            PixelType::Alpha => {
                self.buffer.extend(iter::repeat(255).take(data.len() * 4));
                for (i, alpha) in data.iter().copied().enumerate() {
                    self.buffer[i * 4 + 3] = alpha;
                }
            }
            PixelType::RGBA => {
                self.buffer.extend_from_slice(data);
            }
        }
        let bounds = gpu.bounds;
        self.image.set_sub_data(
            &self.buffer[..],
            bounds.x as u32,
            bounds.y as u32,
            bounds.width,
            bounds.height,
            ColorFormat::RGBA,
        );
    }
fn put_rect ( & mut self , pixel : PixelType , data : & [ u8 ] , gpu : & TextureGlyph ) { self . buffer . clear ( ) ; match pixel { PixelType :: Alpha => { self . buffer . extend ( iter :: repeat ( 255 ) . take ( data . len ( ) * 4 ) ) ; for ( i , alpha ) in data . iter ( ) . copied ( ) . enumerate ( ) { self . buffer [ i * 4 + 3 ] = alpha ; } } PixelType :: RGBA => { self . buffer . extend_from_slice ( data ) ; } } let bounds = gpu . bounds ; self . image . set_sub_data ( & self . buffer [ .. ] , bounds . x as u32 , bounds . y as u32 , bounds . width , bounds . height , ColorFormat :: RGBA , ) ; }
Write the data from a font into a texture
Write the data from a font into a texture
&mut self
pixel
PixelType
data
&[u8]
gpu
&TextureGlyph
&mut self
pixel
PixelType
data
&[u8]
gpu
&TextureGlyph