Mike Welsh
b1404edfdc
swf: Use bitflags for EditText
2022-09-06 20:02:23 -07:00
relrelb
3b752cc600
swf: Merge `read_color_transform_no_alpha` into `read_color_transform`
...
Differentiate between the cases using a new `has_alpha` boolean
parameter.
2022-09-03 13:24:12 -07:00
relrelb
fb39bb2b71
swf: Remove `Copy` from `Rectangle`
...
Use `.clone()` explicitly where needed.
2022-09-02 18:21:13 -07:00
relrelb
299da43c16
swf: Extract `ShapeFlag`
2022-09-02 18:21:13 -07:00
relrelb
efd449dc0d
swf: Extract `DefineMorphShapeFlag`
2022-09-02 18:21:13 -07:00
relrelb
16a1b7b832
swf: Remove `length` parameter of `read_frame_label`
...
Use `unwrap_or_default()` to optionally read a byte.
Also remove unused `context` parameter of `MovieClip::frame_label`.
2022-09-02 10:42:09 -07:00
relrelb
9ec3137891
swf: Remove `tag_length` parameter of `read_define_button_cxform`
...
It was not needed since `Reader` accounts for it internally.
2022-09-02 10:42:09 -07:00
Aaron Hill
fa0c843a4d
avm2: Implement DisplayObject.scrollRect
...
This property causes a DisplayObject to be both translated
and cropped.
2022-08-26 13:04:01 -07:00
relrelb
ad91992cb5
swf: Simplify `DoAbc` tag handling
...
Extract `swf::Reader::read_do_abc()` which, as the name suggests,
reads a `DoAbc` tag, and use it before calling to `Avm2::load_abc`.
Finally, introduce `DoAbcFlag` using `bitflags`.
This greatly simplifies the ABC loading code.
2022-08-26 11:37:04 -07:00
Mike Welsh
d092861c15
chore: Appease clippy
...
Fix `assertions_on_result_states` lints.
2022-07-29 19:32:41 -07:00
Aaron Hill
bb5c9a1de5
swf: Handle incorrect 'PlaceObject3' tag
...
Fixes #7098
Some SWF appear to have a PlaceObject3 tag with
`HAS_CACHE_AS_BITMAP` set, but the tag ends without
including the corresponding 'is_bitmap_cached' byte.
2022-06-10 16:56:08 +03:00
relrelb
781d091d42
swf: Return concrete data types in `Reader` methods
...
Where possible, return the specific data type instead of the generic
`Tag` type. Most reader methods do this already, so this brings the
rest in-line.
2022-05-09 14:59:38 -07:00
Mike Welsh
146b8adc68
swf: Clean up LineStyle
...
* Remove LineStyle::color, instead using fill_style with
FillStyle::Color to indicate solid color.
* Store `flags` in the struct instead of separate bools/values.
* Add getters/setters for ease of use.
* Add builder-style methods for setting LineStyle properties.
* Fix misnamed ALLOW_CLOSE flag to NO_CLOSE.
2022-04-11 22:50:40 -07:00
Mike Welsh
478f970fc8
chore: Appease clippy
2022-04-09 18:23:51 -07:00
relrelb
9234336dfc
swf: Rename `PlaceFlag::IS_IMAGE` to `PlaceFlag::HAS_IMAGE`
...
To match the SWF19 spec.
2022-03-26 11:33:26 -07:00
relrelb
094da8f1a4
swf: Organize clippy attributes
...
Move them to specific places as possible.
2022-03-26 11:33:26 -07:00
relrelb
71b0a6e32e
swf: Use bitflags for `FontInfoFlag`
2022-03-26 11:33:26 -07:00
relrelb
fd06fa0537
swf: Use bitflags for `LineStyleFlag`
2022-03-26 11:33:26 -07:00
relrelb
e88c7102f5
swf: Use bitflags for `PlaceFlag`
2022-03-26 11:33:26 -07:00
relrelb
6d2005c2fe
swf: Simplify `read_str_with_len`
...
Read the length in the function itself rather than receiving it as
an argument.
2022-03-26 11:33:26 -07:00
relrelb
1230b5e713
swf: Use bitflags for `FontFlag`
2022-03-26 11:33:26 -07:00
relrelb
71a1757d29
swf: Make `Glyph::advance` non-`Option`
...
Simply use `0` instead of `None`.
2022-03-26 11:33:26 -07:00
relrelb
984342abf3
swf: Avoid some `Vec::resize` usages
...
Use the `vec![]` macro instead.
2022-03-26 11:33:26 -07:00
relrelb
e9167cf43c
swf: Add minimal offset table enforcement in `DefineFont2/3`
...
Previously, the offset table and code table offset were completely
ignored. But as it seems, Flash does look into these offsets in
order to avoid exceedingly reading glyph shapes. For now, avoid
exceedingly reading empty and 1-byte glyph shapes, and add debug
assertions that verify the correctness of the offset table and code
table offset, to help diagnosing related bugs in the future.
2022-03-14 22:50:24 +02:00
Adrian Wielgosik
685911a77c
swf: Box ShapeRecord::StyleChange variant
2021-12-08 22:14:17 +01:00
Adrian Wielgosik
a305b80789
swf: Support font layout without swf-v7 fields
2021-11-20 22:48:36 +01:00
relrelb
d069b8dcd6
swf: Avoid one usage of `Reader::pos`
2021-10-08 13:22:45 -07:00
relrelb
693f49904f
swf: Extract `BitReader::new`
2021-10-08 13:22:45 -07:00
TÖRÖK Attila
a1ee508ff8
chore: Fix nightly clippy lint: clippy::if_then_panic ( #5400 )
...
* chore: Fix nightly clippy lint: clippy::if_then_panic
* chore: Fix nightly clippy lint: clippy::if_then_panic in swf tests too
* Address review notes
2021-10-02 16:14:53 +03:00
relrelb
55ffda9c97
swf: Take advantage of `ClipEventFlag` bit pattern
...
Re-number the `ClipEventFlag` enum members to match how they
actually appear in a SWF. This allows much simpler read/write
operations.
Also, gracefully handle malformed ClipActions that are only 1 or 0
bytes, as it seems that Flash accepts those too.
2021-08-30 21:23:18 +03:00
Tal Hayon
7b9049cedf
core: Add DefineBinaryData and SymbolClass connection (Part of #1368 )
2021-08-21 12:24:46 -06:00
relrelb
d2eb46d3be
chore: Reserve capacity for vectors
...
This avoids unnecessary re-allocations and thus should improve
performance in both memory and time terms.
2021-07-20 16:25:23 -07:00
relrelb
c2378416a9
tests: Simplify `read_tag_bytes_from_file_with_index`
...
Let the `Reader` outlive outside the loop, so it tracks its own
position, instead of doing so manually.
Also move `read_from_file` outside and reuse it.
2021-07-12 23:09:29 +03:00
relrelb
ef9c073d26
swf: General cleanup
...
Just mechanical cleanups to ease future refactors.
2021-07-12 23:09:29 +03:00
relrelb
0fd1c05fd5
chore: Use into() in more places
2021-06-22 11:49:41 -07:00
Mike Welsh
56c260fa74
swf: Add NameCharacter tag
2021-06-20 14:01:07 -07:00
Mike Welsh
d23ea90459
swf: Change Matrix to use Fixed16 for a, b, c, d
...
Matrices in an SWF file store their scale/skew components in
in 16.16 format (fbits).
Split `ruffle_core::Matrix` and `swf::Matrix`. `swf::Matrix` now
stores its data as `Fixed16` instead of immediately converting to
`f32`.
2021-06-08 14:57:15 -07:00
relrelb
b8eae51888
swf: Move num_colors into BitmapFormat::ColorMap8
2021-06-07 11:29:28 -07:00
relrelb
de6e2a04a4
swf: Number enum VideoCodec
2021-06-07 11:29:28 -07:00
relrelb
50a4643253
swf: Number enum VideoDeblocking
2021-06-07 11:29:28 -07:00
relrelb
636775f1e2
swf: Number enum TextGridFit
2021-06-07 11:29:28 -07:00
relrelb
a45fdba4d1
swf: Number enum FontThickness
2021-06-07 11:29:28 -07:00
relrelb
88b6632188
swf: Number enum TextAlign
2021-06-07 11:29:28 -07:00
relrelb
781e3ff0cd
swf: Number enum AudioCompression
2021-06-07 11:29:28 -07:00
relrelb
ee14945974
swf: Number enum LineCapStyle
2021-06-07 11:29:28 -07:00
relrelb
f6d04061b0
swf: Number enum GradientSpread
2021-06-07 11:29:28 -07:00
relrelb
fed4facd8a
swf: Number enum SoundEvent
2021-06-07 11:29:28 -07:00
relrelb
0d279a05c2
swf: Number enum BlendMode
2021-06-07 11:29:28 -07:00
relrelb
72113dbcf2
swf: Number enum Language
2021-06-07 11:29:28 -07:00
relrelb
f82faf9603
chore: Appease clippy
2021-06-05 10:16:00 -07:00