mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Make rgba8_image_to_tex_image_data not overallocate in some case
This commit is contained in:
parent
145086e150
commit
27951bb7c8
1 changed files with 1 additions and 1 deletions
|
@ -4162,7 +4162,7 @@ fn rgba8_image_to_tex_image_data(
|
|||
},
|
||||
|
||||
(TexFormat::Luminance, TexDataType::HalfFloat) => {
|
||||
let mut lum = Vec::<u8>::with_capacity(pixel_count * 4);
|
||||
let mut lum = Vec::<u8>::with_capacity(pixel_count * 2);
|
||||
for rgba8 in pixels.chunks(4) {
|
||||
let p = luminance(rgba8[0], rgba8[1], rgba8[2]);
|
||||
lum.write_u16::<NativeEndian>(f16::from_f32(p as f32).as_bits()).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue