mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-07-08 01:31:53 +08:00
Fix white border when decode bgi cbg v2 image
This commit is contained in:
@@ -409,13 +409,25 @@ impl<'a> CbgDecoder<'a> {
|
|||||||
ImageColorType::Bgr
|
ImageColorType::Bgr
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(ImageData {
|
let img = ImageData {
|
||||||
width: decoder.width as u32,
|
width: decoder.width as u32,
|
||||||
height: decoder.height as u32,
|
height: decoder.height as u32,
|
||||||
color_type,
|
color_type,
|
||||||
depth: 8,
|
depth: 8,
|
||||||
data: output,
|
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>> {
|
fn read_encoded(&mut self) -> Result<Vec<u8>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user