Fix white border when decode bgi cbg v2 image

This commit is contained in:
2025-09-13 19:42:19 +08:00
parent 01477b31a0
commit 4391ad6de5

View File

@@ -409,13 +409,25 @@ impl<'a> CbgDecoder<'a> {
ImageColorType::Bgr
};
Ok(ImageData {
let img = ImageData {
width: decoder.width as u32,
height: decoder.height as u32,
color_type,
depth: 8,
data: output,
})
};
if decoder.width != self.info.width as i32 || decoder.height != self.info.height as i32 {
return Ok(draw_on_canvas(
img,
self.info.width as u32,
self.info.height as u32,
0,
0,
)?);
}
Ok(img)
}
fn read_encoded(&mut self) -> Result<Vec<u8>> {