Moulins
2fa3d31732
Appease Clippy on nightly
2022-11-23 22:39:45 +01:00
dependabot[bot]
25664778f3
build(deps): bump bitstream-io from 1.5.0 to 1.6.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.5.0...v1.6.0 )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 17:16:38 -07:00
relrelb
c516fef65d
swf: Simplify read of `PlaceObject` tags
...
`tag_length` isn't really necessary since each tag is read using
a dedicated `swf::Reader`, which keeps track of the tag boundary
internally.
As a result, `tag_len` can be avoided passed around many times in
`movie_clip.rs`.
2022-11-08 00:05:41 +02:00
relrelb
89f3445d62
swf: Introduce and use `Rectangle::width()` and `Rectangle::height()`
2022-11-01 09:49:04 +02:00
relrelb
ee52ce3290
tests: Expand `read_push`
...
Test that invalid value types are ignored.
2022-10-29 22:26:34 +03:00
relrelb
c5f4f555bb
avm1: Ignore unknown value type in `ActionPush`
...
Newest Flash Player exits on unknown value types. However, older versions
(at least FP9) just ignore them and continue to the next value.
Follow the lenient behavior in order to support more content (e.g. #8389
doesn't work on newest Flash Player).
Fixes #8389 .
2022-10-29 22:26:34 +03:00
Aaron Hill
68471723b3
core: Fix clippy format string lint
2022-10-27 08:49:39 +03:00
relrelb
178bf4fe24
chore: Extract Cargo `edition` to `[workspace.package]`
...
This is possible since Rust 1.64.0: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
2022-10-14 22:13:29 +03:00
relrelb
b0b0e55c24
swf: Extract read/write of filters to separate functions
...
Also unify the identical `GradientGlowFilter` and `GradientBevelFilter`
structs into `GradientFilter`.
2022-10-14 02:27:49 +03:00
relrelb
f5dcbb883e
swf: Extract filters to separate files
...
For better code organization.
2022-10-12 21:20:07 +03:00
dependabot[bot]
ce3a8440e6
build(deps): bump simple_asn1 from 0.4.1 to 0.6.2
...
Bumps [simple_asn1](https://github.com/acw/simple_asn1 ) from 0.4.1 to 0.6.2.
- [Release notes](https://github.com/acw/simple_asn1/releases )
- [Commits](https://github.com/acw/simple_asn1/commits )
---
updated-dependencies:
- dependency-name: simple_asn1
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 01:05:10 +03:00
EmperorBale
35c9597032
chore: Appease clippy
2022-10-10 12:48:35 -07:00
EmperorBale
5c9bf3ffc0
swf: Support SWZ files
2022-10-10 12:48:35 -07:00
relrelb
84533e278d
swf: De-duplicate code in `count_sbits_twips()`
...
Re-use `count_sbits()`, as already done in `count_fbits()`.
2022-10-09 14:18:50 +05:45
relrelb
2b9f0a6280
swf: Optimize `count_ubits()`
...
Use `u32::leading_zeros()` instead of manually counting bits.
2022-10-09 14:18:50 +05:45
relrelb
bf0ace0b88
chore: Appease clippy
2022-10-09 13:46:28 +05:45
Adrian Wielgosik
0f30278e48
Add missing comment
2022-10-04 20:02:14 +03:00
Adrian Wielgosik
52f7736436
swf: treat empty gradients as solid black color
2022-10-03 20:18:30 +02:00
relrelb
e1d01b0a5e
swf: Extract `Rectangle` to a separate file
...
And make it generic, as a first step towards making it a general-purpose
data structure for the whole codebase. Some potential replacements are:
* `BoundingBox` in `render/src/bounding_box.rs`.
* `BoxBounds` in `core/src/html/dimensions.rs`.
* Parameters to a bunch of `BitmapData` methods in
`core/src/bitmap/bitmap_data.rs`.
2022-09-25 10:37:56 +03:00
relrelb
b2dc72a923
swf: Remove `impl Default for FunctionFlags`
...
Simply use `FunctionFlags::empty()` directly.
2022-09-22 23:29:34 +03:00
Aaron Hill
1d6b3b6f57
chore: Fix Clippy lints and allow `clippy::bool_to_int_with_if`
...
In several cases, the current code seems preferable to the
code required by `clippy::bool_to_int_with_if`. Let's suppress
this for now to get the build passing, and decide later if this
is something that we want to enable.
2022-09-11 13:31:46 +02:00
Mike Welsh
de114f0a3d
swf: Read font height in DefineEditText when HasFontClass is set
...
The SWF19 specs incorrectly state DefineEditText tag only contains
font height if the HasFont flag is set. The tag also contains
the height if the HasFontClass flag is set. This indicates that a
font is used via runtime sharing.
2022-09-06 20:02:23 -07:00
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
relrelb
5c29da6707
avm1: Implement `MovieClip.scrollRect`
...
The core functionality and AVM2 bindings were implemented in #7739 .
2022-08-28 22:18:33 -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
bca9b596b9
swf: Implement Display and FromStr for BlendMode
2022-08-18 16:38:17 -07:00
Aaron Hill
f7205a02a9
render: Add BlendMode infrastructure and implement BlendMode.ADD
...
Each render backend keeps track of a stack of BlenModes,
which are pushed and popped by 'core' as we render objects
in the displaay tree. For now, I've just implemented BlendMode.ADD,
which maps directly onto blend mode supported by each backend.
All other blend modes (besides 'NORMAL') will produce a warning
when we try to render using them. This may produce a very large amount
of log output, but it's simpler than emitting each warning only once,
and will help to point developers in the right direction when they
get otherwise inexplicable rendering issues (due to a blend mode
not being implemented).
The wgpu implementation is by far the most complicated, as we need
to construct a `RenderPipeline` for each possible
`(BlendMode, MaskState)`. I haven't been able to find any documentation
about the maximum supported number of (simultaneous) WebGPU render
pipelines - if this becomes an issue, we may need to register them
on-demand when a particular blend mode is requested.
2022-08-18 16:38:17 -07:00
relrelb
a3476e7400
swf: Remove `#[allow(clippy::derive_partial_eq_without_eq)`
...
https://github.com/rust-lang/rust-clippy/issues/8867 is fixed, and
a false positive is no longer reported.
2022-08-16 16:24:21 -07:00
Mike Welsh
e0c72f4c9a
swf: Bump version to 0.2
2022-08-16 12:59:20 -07:00
Aaron Hill
adf6653807
swf: Write a non-zero 'index' value for true/false/undefined/null default values
...
A zero 'index' does not have a subsequent 'kind' field in the
written SWF. The 'index' field is not actually used for
true/false/undefined/null, so it can be anything as long
as it's non-zero.
2022-08-15 12:30:10 -07:00
dowgird
31ed697acd
Fixes from review
2022-08-10 01:34:08 +02:00
dowgird
26b41199fb
avm2: Implemented newcatch and basic exception handling
2022-08-10 01:34:08 +02:00
CUB3D
05bfa3770e
chore: Fix warnings with cargo doc
2022-08-08 20:20:18 +03:00
Calvin304
01a0d702af
avm2: Fix parsing of methods with more than 127 arguments
...
this change follows section 4.5 of https://www.adobe.com/content/dam/acom/en/devnet/pdf/avm2overview.pdf (dead link, use an archive)
2022-07-30 16:52:56 -07:00
Mike Welsh
d092861c15
chore: Appease clippy
...
Fix `assertions_on_result_states` lints.
2022-07-29 19:32:41 -07:00
relrelb
8d30833d02
core: Don't use `saturating_sub` for `width` / `height`
...
Use regular subtraction, since it should never overflow.
Also remove `swf::Twips::saturating_sub`, which is now unused.
2022-07-23 10:33:12 -07:00
relrelb
e78bf30d58
swf: Extract `Color` to a separate file
2022-07-23 08:43:02 +03:00
relrelb
78ebf06f55
avm2: Extract `MethodFlags` enum
2022-07-09 20:34:53 +03:00
relrelb
981fa0568c
chore: `derive(Default)` for enums
...
It's available since stable Rust 1.62.0.
2022-07-02 09:23:04 -07:00
relrelb
9b9301fbaf
chore: Appease clippy
2022-07-02 09:22:18 -07:00
relrelb
06752646b8
swf: Extract `Twips` to a separate file
2022-06-22 09:49:32 +03:00
dependabot[bot]
b8cdd59877
build(deps): bump bitstream-io from 1.3.0 to 1.5.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.3.0 to 1.5.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.3.0...v1.5.0 )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-13 23:54:10 +03: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
ec23a64a13
swf: Mark some `Fixed` functions as `const`
2022-05-29 23:35:03 +03:00
relrelb
60a1dbfb07
swf: Mark some `Matrix` functions as `const`
2022-05-29 21:33:53 +03:00
Aaron Hill
2104216415
swf: Write out tag header for `DebugId` tag
...
The implementation of `write_debug_id` was previously
not writing the header, causing a malformed SWF to be produced
whenever a `DebugId` tag was included.
2022-05-23 19:16:26 -07:00
Mike Welsh
32bf7e1412
chore: Appease clippy
2022-05-22 02:34:18 -07:00
relrelb
cab49ae6e1
swf: Introduce `Color::WHITE`
...
And use it where possible, to improve code readablity.
2022-05-12 12:12:06 -07:00
relrelb
0b0f8a1a7a
swf: Introduce `Color::BLACK`
...
And use it where possible, to improve code readablity.
2022-05-12 12:12:06 -07:00
relrelb
84b865018d
swf: Mark some `SwfStr` functions as const
2022-05-10 09:34:57 +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
402e072707
swf: Implement Default for BlendMode
2022-05-06 11:33:52 -07:00
relrelb
f6153ff7c1
chore: Appease clippy
2022-05-06 10:36: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
dependabot[bot]
860c2e313f
build(deps): bump encoding_rs from 0.8.30 to 0.8.31
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.30 to 0.8.31.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.30...v0.8.31 )
---
updated-dependencies:
- dependency-name: encoding_rs
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 10:40:26 -07:00
Mike Welsh
ac765bd187
chore: Update copyright
...
I (Michael R. Welsh) assign to Ruffle LLC all rights, title, and
interest to copyrights of my personal contributions to Ruffle,
effective March 26, 2022.
2022-03-26 18:13:14 -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
dependabot[bot]
da613a6fc5
build(deps): bump libflate from 1.1.2 to 1.2.0
...
Bumps [libflate](https://github.com/sile/libflate ) from 1.1.2 to 1.2.0.
- [Release notes](https://github.com/sile/libflate/releases )
- [Commits](https://github.com/sile/libflate/compare/1.1.2...1.2.0 )
---
updated-dependencies:
- dependency-name: libflate
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 11:20:34 -07:00
dependabot[bot]
f9e361ddae
build(deps): bump bitstream-io from 1.2.0 to 1.3.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/commits )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 10:52: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
Jean Marchand
9969e0ce5a
avm2: Fix invalid option
2022-02-12 23:35:32 +02:00
Mike Welsh
55da3cd7d0
chore: Add .cargo/config.toml for workspace-level lint config
...
Currently it is not directly possible to configure lints for the
entire workspace via TOML, which forced us to repeat `#![allow]`
blocks in each crate.
embark pointed out this workaround to configure lints at the
workspace level via RUSTFLAGS:
https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395
Remove the common `#![allow]` blocks and switch to this method for
global lint config.
Temporarily allow `needless_borrow` lint, buggy pending this fix:
https://github.com/rust-lang/rust-clippy/pull/8355
2022-01-29 14:22:44 -08:00
Mike Welsh
b181debff6
swf: Use bitflags for `avm1::GetUrl2`
2022-01-17 21:35:57 -08:00
Mike Welsh
4c3e14eae5
core: Clean up `DefineFunction` action
...
* Have `DefineFunction` and `DefineFunction2` go through the same
code path by implementing `From<DefineFunction>` for
`DefineFunction2`.
* Change `register` to a `Option<NonZeroU8>` for size optimization.
* Add `function::Param` to store param info instead of a tuple.
2022-01-17 21:35:57 -08:00
Mike Welsh
2b2346b65e
swf: Add `avm1::Action::End`
...
Returning an `Action::End` instead of `None` when reading the end
of an action.
2022-01-17 21:35:57 -08:00
Mike Welsh
d5862809c7
swf: Remove extraneous ? in avm1::Writer
2022-01-17 21:35:57 -08:00
Mike Welsh
265bcc278a
swf: Add avm1::Writer::write_small_action
...
Convenience method for writing zero-length actions.
2022-01-17 21:35:57 -08:00
Mike Welsh
9141451ca1
swf: Use structs for avm1 `Action` variants
...
Use a struct for all variants of `avm1::Action`.
This makes the style more consistent instead of using a mix of
struct and tuple variants, and allows the data to be easily passed
around.
2022-01-17 21:35:57 -08:00
Adrian Wielgosik
22a0711d85
avm2: Use TU's method cache for callstatic, newfunction opcodes
2021-12-17 21:09:40 -07:00
David Wendt
2aee3555ab
chore: Fix all new clippy lints added in latest Rust nightly
2021-12-17 20:53:26 -07:00
dependabot[bot]
ef679d25c7
build(deps): bump encoding_rs from 0.8.29 to 0.8.30
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.29 to 0.8.30.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.29...v0.8.30 )
---
updated-dependencies:
- dependency-name: encoding_rs
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 23:22:28 +02:00
Adrian Wielgosik
685911a77c
swf: Box ShapeRecord::StyleChange variant
2021-12-08 22:14:17 +01:00
relrelb
da4b5986b1
chore: Appease clippy
2021-12-08 22:36:55 +02:00
relrelb
0b6cd45415
swf: Fix reserved gradient values handling
...
* Map 3 to `GradientSpread::Pad`
* Map 2 and 3 to `GradientInterpolation::Rgb`
Fix #1505 .
2021-12-04 21:32:47 +02:00
Adrian Wielgosik
a305b80789
swf: Support font layout without swf-v7 fields
2021-11-20 22:48:36 +01:00
relrelb
34d1fa5226
avm1: Introduce `TextFormatObject`
...
`TextFormat` objects differ from regular objects in that
`TextField.setTextFormat` and `TextField.setNewTextFormat` accept
only the former, and ignore the latter.
Also, `TextFormat.prototype` has native accessors that coerce the
values on get/set.
2021-10-30 10:03:36 -07:00
Adrian Wielgosik
8cc00f32bb
chore: Stop using traits available in prelude
2021-10-21 10:24:05 -07:00
Adrian Wielgosik
bc82a4f705
build: Bump Rust edition to 2021
2021-10-21 10:24:05 -07:00
dependabot[bot]
5cab790bd7
build(deps): bump encoding_rs from 0.8.28 to 0.8.29
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.28 to 0.8.29.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.28...v0.8.29 )
---
updated-dependencies:
- dependency-name: encoding_rs
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 14:01:23 -07: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
relrelb
281455be6d
swf: Improve `ActionTry` read/write
...
* Use `TryFlags` instead of hard-coded binary literals.
* Rename `try_length`, `catch_length`, `finally_length` to `try_size`,
`catch_size`, `finally_size` to match SWF19 namings.
* Refactor write and fix a few bugs there:
* The actions length should not include the try, catch, finally
bodies, only the metadata of `flags`, `try_size`, `catch_size`,
`finally_size` and catch variable (either as `u8` or `SwfStr`).
* A placeholder byte should be written in place of the catch variable
when there is no catch clause.
2021-10-02 23:01:32 +03:00
relrelb
d49ea10267
swf: Rename `TryBlock` fields
...
* `try_actions` -> `try_body`
* `catch` -> `catch_body`
* `finally` -> `finally_body`
This aligns with the names used in SWF19, and is more consistent.
2021-10-02 23:01:32 +03:00
relrelb
d2908d8fcd
swf: Fix write of With opcode
...
The actions length should be written as an additional u16.
2021-10-02 23:01:32 +03: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
Giles Cope
42c2b40052
unused deps
2021-09-18 15:28:24 +02:00
Chris Midgley
2dd83c23e8
avm2: add more opcodes
...
Taken from https://jindrapetrik.github.io/as3_pcode_instructions.en.html
2021-09-16 02:51:04 -07:00
Chris Midgley
d52a350b9b
avm2: reorder opcodes to be alphabetical
2021-09-16 02:51:04 -07:00
David Wendt
535f4fba58
swf: Pre-allocate the parameters when parsing a `TypeName`
2021-09-02 17:57:58 -06:00
David Wendt
62be772649
chore: Compliance with current clippy beta/nightly
2021-09-02 17:57:58 -06:00
David Wendt
9dafddc1ae
swf: Decode and encode the `applytype` op.
2021-09-02 17:57:58 -06:00
David Wendt
47e3b2229a
swf: Add support for the `TypeName` multiname type.
2021-09-02 17:57:58 -06: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
dependabot[bot]
b8a9e28acb
chore: Bump bitstream-io from 1.1.0 to 1.2.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.1.0...v1.2.0 )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-17 08:24:29 +03:00
dependabot[bot]
a317a09d17
chore: Bump bitflags from 1.2.1 to 1.3.2
...
Bumps [bitflags](https://github.com/bitflags/bitflags ) from 1.2.1 to 1.3.2.
- [Release notes](https://github.com/bitflags/bitflags/releases )
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md )
- [Commits](https://github.com/bitflags/bitflags/compare/1.2.1...1.3.2 )
---
updated-dependencies:
- dependency-name: bitflags
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-16 23:41:06 +03:00
relrelb
3d8779b377
swf: Ignore length mismatch in `read_action`
...
Flash continues in such case, so just warn instead of failing.
2021-08-03 14:40:59 -07:00
relrelb
04af276ecb
swf: Extract `Opcode::format` and `TagCode::format`
2021-08-03 14:40:59 -07:00
Chris Midgley
0c6f7101b8
docs: update swf README to have working examples
2021-08-03 12:04:58 -07:00
David Wendt
7dc86fdeb0
swf: Throw an error if an ABC bitstream calls for a parameter with more optional parameters than actual ones.
2021-07-20 22:10:30 -04:00
David Wendt
4122c1b96e
swf: Default method parameters are indexed starting from the first optional parameter, not from zero.
2021-07-20 22:05:29 -04: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
5dde3ecabf
swf: Optimize `read_f64_me` and `write_f64_me`
...
Each function is reduced to just 3 opcodes on x86:
https://godbolt.org/z/n6q6zxnh6
WebAssembly benefits as well: https://godbolt.org/z/fcETE9GYn
This should improve load-time performance because read_f64_me is
used frequently (for each AVM1 double constant).
2021-07-16 01:29:49 +03: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
99deb90a1f
swf: Avoid using `Reader::input` directly
...
Change two cases to use `Reader::read_slice` instead of `self.input`.
Not only this avoids relying on an implementation detail, this also
raises an `UnexpectedEof` error if the read is beyond the SWF.
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
9e18e32b40
swf: Fix read_i24
...
Only the third byte should be cast to i8 in order to sign extend correctly.
avmplus reference: https://github.com/adobe/avmplus/blob/master/core/AvmCore-inlines.h#L387-L395
2021-07-09 19:56:52 +03:00
relrelb
32c6d8dba0
swf: Fix write_i24
...
It was writing in the wrong endian.
2021-07-09 19:56:52 +03:00
relrelb
1cbbdecccf
swf: Introduce and use `Color::to_rgba`
2021-07-09 19:56:52 +03:00
relrelb
580d8c3562
chore: Use to_le_bytes in more places
2021-07-09 19:56:52 +03:00
relrelb
87e9dda250
chore: Use from_le_bytes in more places
2021-07-09 19:56:52 +03:00
relrelb
169c79fa3a
chore: Minor cleanups
2021-06-26 23:05:11 +03:00
relrelb
9c1ebc7f20
swf: Cleanup Error
2021-06-26 23:05:11 +03:00
relrelb
7b37bf6809
chore: Avoid spelling "movieclip"
...
* Prefer "MovieClip" in comments.
* Prefer "mc" for variable names.
2021-06-24 14:36:45 +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
dependabot[bot]
c22c18b809
chore: Bump bitstream-io from 1.0.0 to 1.1.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/commits )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-20 03:10:31 -07:00
Mike Welsh
21c351fe5b
swf: Change Twips::zero fn to Twips::ZERO const
2021-06-08 14:57:15 -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
dependabot[bot]
2f1dc0cbb1
chore: Bump approx from 0.4.0 to 0.5.0
...
Bumps [approx](https://github.com/brendanzab/approx ) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/brendanzab/approx/releases )
- [Commits](https://github.com/brendanzab/approx/compare/v0.4.0...v0.5.0 )
---
updated-dependencies:
- dependency-name: approx
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-07 11:30:59 -07:00
relrelb
b8eae51888
swf: Move num_colors into BitmapFormat::ColorMap8
2021-06-07 11:29:28 -07:00
relrelb
53cc9f38fc
swf: Use casting instead of ToPrimitive
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
Mike Welsh
f173b81e38
swf: Use bitflags for Function flags
2021-05-30 22:14:32 -07:00
Mike Welsh
2b98c878f0
swf: Use Fixed in more places
2021-05-30 21:24:03 -07:00
Mike Welsh
e1439f4105
swf: Add HeaderExt struct providing additional info
...
When reading an SWF, search for FileAttributes and
SetBackgroundColor and return this along with the header data
because it's useful (in particular, the AS3 flag).
2021-05-23 23:02:38 -07:00
Mike Welsh
8960414436
swf: Use bitflags for FileAttributes
2021-05-22 15:53:02 -07:00
Eduardo Sánchez Muñoz
e3dc8ff28e
swf: SwfStr: reimplement `Debug` with `std::ascii::escape_default`
...
The string will now be surrounded with quotes (`"`), non-ASCII characters (UTF-8 or not) will be escaped in hexadecimal form (`\xNN`) and ASCII control characters will be escaped (`\x01`, `\n`, `\t`).
2021-05-12 10:53:26 -07:00
Mike Welsh
9538647422
tests: Fix swf::Fixed tests in --release ( fix #4313 )
...
Use `#[cfg_attr(debug_assertions, should_panic)]` to ensure that
the tests only expect to panic in debug builds.
Fixes #4313 .
2021-05-11 20:53:23 -07:00
dependabot[bot]
185a4f5b8f
chore: Bump lzma-rs from 0.1.3 to 0.2.0
...
Bumps [lzma-rs](https://github.com/gendx/lzma-rs ) from 0.1.3 to 0.2.0.
- [Release notes](https://github.com/gendx/lzma-rs/releases )
- [Changelog](https://github.com/gendx/lzma-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/gendx/lzma-rs/compare/v0.1.3...v0.2.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-03 15:37:29 -07:00
CUB3D
12a198f671
avm2: Implement Op::Coerce and add tests
2021-04-21 00:33:11 -07:00
CUB3D
89c01dca18
swf: Add support for AVM2 domain memory opcodes
2021-04-21 00:33:11 -07:00
Mike Welsh
0552d26551
core: Use Fixed8 and i16 for ColorTransform
...
Use the proper types for ColorTransform:
* Fixed8 (8.8) format for multiplicative component
* i16 format for additive component
This matches the behavior of Flash (for example, alpha only changes
in units of 1/256).
2021-04-19 15:47:52 -07:00
Mike Welsh
50f2ecb1b5
swf: Add Fixed8 and Fixed16 types
2021-04-19 15:47:52 -07:00
Mike Welsh
db6000f071
avm2: Fix parsing of variable-length s32 values
...
The values are not sign-extended as the spec suggests; a negative
value must use all 5 bytes.
2021-04-18 17:32:01 -07:00
dependabot-preview[bot]
9832a7385e
build(deps): bump libflate from 1.0.4 to 1.1.0
...
Bumps [libflate](https://github.com/sile/libflate ) from 1.0.4 to 1.1.0.
- [Release notes](https://github.com/sile/libflate/releases )
- [Commits](https://github.com/sile/libflate/compare/1.0.4...1.1.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-17 10:25:29 -07:00
Mike Welsh
b9d84c0a82
chore: Appease clippy
...
Honor the branches-sharing-code lint.
2021-04-15 00:02:27 -07:00
EmperorBale
a39a1dd64f
swf: Add missing opcodes
2021-04-14 21:41:31 -07:00
relrelb
20d6fcc128
chore: Remove unnecessary type annotations
2021-04-10 18:39:16 -07:00
CUB3D
d5c2e5559b
avm2: Don't mutably borrow for pos()
2021-04-03 16:37:47 -06:00
relrelb
15c1cf5bf6
chore: Appease clippy
2021-03-23 16:16:35 -07:00
relrelb
e840dce803
common_tess: Make Vertex layout-agnostic
...
And define a specific layout in webgl instead.
This brings common_tess closer to serve wgpu (which has a different
Vertex layout).
2021-03-23 16:16:35 -07:00
relrelb
e594f602b6
chore: Twips::new(0) -> Twips::zero()
2021-03-13 00:56:04 -08:00
Adrian Wielgosik
1c2492005c
avm2: Fix AVM2 reader not reading variable-length numbers correctly
2021-03-11 19:55:08 -08:00
Mads Marquart
121ae43d25
swf: Remove unused encoding from avm1::read::Reader
2021-02-27 17:04:42 -08:00
Mads Marquart
66f5c856d7
swf: Make a few functions const
2021-02-27 17:04:42 -08:00
Mads Marquart
1455671cd7
swf: Change read_tag_with_code to take an already parsed tag
2021-02-27 17:04:42 -08:00
Mads Marquart
9243010cc0
swf: Clean up a few imports
2021-02-27 17:04:42 -08:00
Mads Marquart
24780003e7
swf: Deduplicate different read methods
2021-02-27 17:04:42 -08:00
Mads Marquart
dad21d4398
swf: Make avm2 Reader operate directly with byte slices
2021-02-27 17:04:42 -08:00
Mike Welsh
3099914374
chore: Appease clippy
2021-02-27 16:10:46 -08:00
David Wendt
92bfc18e1d
swf: Make video-related tags publicly parsable
2021-02-16 19:03:48 -08:00
relrelb
bb89391f3a
chore: Avoid deprecated constants
...
The Rust documentation considers numeric constants prefixed with std::
as deprecated.
For example: https://doc.rust-lang.org/std/u16/constant.MAX.html .
2021-02-12 06:36:17 -08:00
Mike Welsh
e5fb1f09e7
chore: Appease clippy
...
* #[derive(Collect)] should be before #[collect]
* Replace redunant `&buf[..]` with `buf`
* Changes most cases of UPPERCase to UpperCase
* Allow upper_case_acronym on most SWF types, as they are from
SWF spec/more annoying to change.
2021-02-12 06:32:42 -08:00
TÖRÖK Attila
80b0bd3b33
swf: Add VideoCodec::ScreenVideoV2 variant
2021-02-12 03:37:14 -08:00
Napen123
a132f68688
docs: Update the documentation of SwfStr
2021-02-07 23:44:19 -08:00
Napen123
1ef3de8556
docs: Document the Rectangle type in the swf crate
2021-02-07 23:44:19 -08:00
Napen123
404fc72cb5
docs: Document the Color type in the swf crate
2021-02-07 23:44:19 -08:00
Napen123
52ebc48b2c
docs: Update the documentation of Twips
...
Add code examples to all Twips methods and convert method references to actual links.
2021-02-07 23:44:19 -08:00
dependabot-preview[bot]
dd4860c469
build(deps): bump encoding_rs from 0.8.26 to 0.8.28
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.26 to 0.8.28.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.26...v0.8.28 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-04 11:22:31 -08:00
Mike Welsh
47f0f980b8
core: Handle PlaceObject tags with malformed clip actions
...
Some SWFs in the wild have PlaceObject tags with ending ClipActions
that are 2 bytes instead of the required 4 bytes (see #2899 ).
Swallow the error in this case so that the tag can run.
2021-02-02 23:56:48 -08:00
Mike Welsh
02d99c3686
core: CSMTextSettings tag alters text hit testing
...
Normally, a hit test on static text will consider the text glyphs.
However, a CSMTextSettings tag can change the text to use the
"advanced rendering engine", which causes hit tests to only consider
the bounds. This is toggled by the "Anti-alias for readibility"
setting in the Flash IDE.
Wire up the CSMTextSettings tag and adjust hit test behavior based
on this flag.
Fixes #2987 .
2021-02-01 17:17:41 -08:00
relrelb
a2dcad683d
swf: Refactor read_tag_list
2021-01-29 13:05:37 -08:00
Mads Marquart
bb4240ad1f
chore: Add a few comments about unsafe usage
2021-01-28 14:39:35 -08:00
Mads Marquart
8eddde76a2
swf: Add safe and simpler string parsing
2021-01-28 14:39:35 -08:00
relrelb
19662503ca
swf: Convert ButtonActionCondition to bitflags
2021-01-23 11:59:24 -08:00
relrelb
7f4845d777
swf: Convert ButtonState to bitflags
2021-01-23 11:59:24 -08:00
relrelb
b05c6540e1
chore: Migrate from enumset to bitflags
2021-01-21 16:35:46 -08:00
Mike Welsh
2254589e71
swf: Don't error on focal gradients in DefineShape tags ( fix #2730 )
2021-01-21 15:47:04 -08:00
Mike Welsh
66256dd3be
swf: SwfStr no longer contains encoding
...
SwfStr is now an unsized slice analogous to `str` or `bstr`.
The desired encoding must be supplied when converting to String.
2021-01-20 15:02:31 -08:00
Mike Welsh
700c3c1767
chore: Appease clippy
2021-01-20 15:02:31 -08:00
Mike Welsh
303a2620a7
swf: Fix uncompressed length check
2021-01-20 15:02:31 -08:00
Mike Welsh
c063264d1c
swf: Use bitstream_io
2021-01-20 15:02:31 -08:00