mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
Optimise memory allocation in set_webrender_image_key
This commit is contained in:
parent
a5779ad372
commit
da43e35ab2
1 changed files with 1 additions and 0 deletions
|
@ -59,6 +59,7 @@ fn set_webrender_image_key(webrender_api: &webrender_api::RenderApi, image: &mut
|
|||
pixels::rgba8_premultiply_inplace(bytes.as_mut_slice())
|
||||
},
|
||||
PixelFormat::RGB8 => {
|
||||
bytes.reserve(image.bytes.len() / 3 * 4);
|
||||
for bgr in image.bytes.chunks(3) {
|
||||
bytes.extend_from_slice(&[bgr[2], bgr[1], bgr[0], 0xff]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue