Bitmap smoothing is only an option in SWFv8+

This commit is contained in:
Mike Welsh 2019-08-29 14:01:33 -07:00
parent 89fee4c580
commit 1f85a779ac
2 changed files with 8 additions and 3 deletions

View File

@ -1728,7 +1728,8 @@ impl<R: Read> Reader<R> {
0x40..=0x43 => FillStyle::Bitmap {
id: self.read_u16()?,
matrix: self.read_matrix()?,
is_smoothed: (fill_style_type & 0b10) == 0,
// Bitmap smoothing only occurs in SWF version 8+.
is_smoothed: self.version >= 8 && (fill_style_type & 0b10) == 0,
is_repeating: (fill_style_type & 0b01) == 0,
},

View File

@ -1048,7 +1048,9 @@ impl<W: Write> Writer<W> {
}
}
Tag::DefineSceneAndFrameLabelData(ref data) => self.write_define_scene_and_frame_label_data(data)?,
Tag::DefineSceneAndFrameLabelData(ref data) => {
self.write_define_scene_and_frame_label_data(data)?
}
Tag::ProductInfo(ref product_info) => self.write_product_info(product_info)?,
Tag::DebugId(ref debug_id) => self.write_debug_id(debug_id)?,
@ -1806,7 +1808,9 @@ impl<W: Write> Writer<W> {
is_smoothed,
is_repeating,
} => {
let fill_style_type = match (is_smoothed, is_repeating) {
// Bitmap smoothing only an option in SWF version 8+.
// Lower versions use 0x40 and 0x41 type even when unsmoothed.
let fill_style_type = match (is_smoothed || self.version < 8, is_repeating) {
(true, true) => 0x40,
(true, false) => 0x41,
(false, true) => 0x42,