mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
craft-metafile: keep the outer file's decode budget for a nested PICT
A PICT inside another metafile now draws on that file's decode budget instead of resetting it. The public PICT entry point still starts a fresh budget.
This commit is contained in:
@@ -265,7 +265,7 @@ pub(crate) fn parse_nested(bytes: &[u8]) -> Result<Picture, Error> {
|
||||
// the WMF's own records (its dx rounding shows), so the copy is not used.
|
||||
wmf::parse(b)?
|
||||
} else if pict::is_pict(bytes) {
|
||||
return pict::parse(bytes);
|
||||
return pict::parse_nested(bytes);
|
||||
} else {
|
||||
return Err(Error::NotMetafile);
|
||||
};
|
||||
|
||||
@@ -1440,6 +1440,11 @@ fn qt_image(d: &[u8]) -> Option<([u8; 4], Affine, Rect, &[u8])> {
|
||||
/// Read a QuickDraw picture.
|
||||
pub fn parse(bytes: &[u8]) -> Result<Picture, Error> {
|
||||
crate::dib::set_decode_budget(crate::dib::MAX_DECODE_PIXELS);
|
||||
parse_nested(bytes)
|
||||
}
|
||||
|
||||
/// [`parse`] for a picture inside the metafile being parsed: it draws on the outer file's decode budget.
|
||||
pub(crate) fn parse_nested(bytes: &[u8]) -> Result<Picture, Error> {
|
||||
let h = find(bytes).ok_or(Error::NotPict)?;
|
||||
let mut q = Pict::new(h.frame);
|
||||
let mut r = Be::new(bytes, h.ops);
|
||||
|
||||
Reference in New Issue
Block a user