Commit Graph

312 Commits

Author SHA1 Message Date
dependabot[bot] 5ea1076e35 build(deps): bump enum-map from 2.4.1 to 2.4.2
Bumps [enum-map](https://github.com/xfix/enum-map) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/xfix/enum-map/releases)
- [Changelog](https://github.com/xfix/enum-map/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xfix/enum-map/compare/v2.4.1...v2.4.2)

---
updated-dependencies:
- dependency-name: enum-map
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 16:30:46 -08:00
Mike Welsh 696c9062d3 chore: Inherit cargo metadata from workspace
Use workspace inheritance added in Rust 1.64 to de-duplicate
various settings across all packages.
2022-12-16 15:53:59 -08:00
relrelb bd9078addf chore: Fix `clippy::uninlined_format_args` lints 2022-12-15 08:59:38 +02:00
Adrian Wielgosik 0861153626 swf: make Clippy happy 2022-12-03 22:18:22 +01:00
michiel2005 f4a988bdda
swf: Update link (#8650)
The original link is not working anymore so I put a link to the wayback machine in it's place that leads to the original document

Co-authored-by: Adrian Wielgosik <4729533+adrian17@users.noreply.github.com>
2022-12-01 20:29:09 +01:00
Marco Grassi ad81b3bf14 upgrade lock and toml dependencies 2022-11-26 14:04:59 -05:00
David Wendt 14f27a9e4a docs: Fix up Twips2D doctests 2022-11-23 20:45:37 -07:00
David Wendt a5a6189e61 chore: Remove empty files and outdated references 2022-11-23 20:45:37 -07:00
David Wendt 84b3162a57 chore: cargo fmt & fixes 2022-11-23 20:45:37 -07:00
Mark Richins d345523d02 Fix conflicts 2022-11-23 20:45:37 -07:00
Mark Richins 9941701b3a Fix: change twips_2d to use x and y and fix bug 2022-11-23 20:45:37 -07:00
Mark Richins 63a291ac4b Fix promblems caused by moving Twips 2022-11-23 20:45:37 -07:00
Mark Richins ca6c98785a Rename Twips2d.rs to twips_2d.rs 2022-11-23 20:45:37 -07:00
Mark Richins 331fd09953 Remove struct Twips from types.rs 2022-11-23 20:45:37 -07:00
Mark Richins 53df2bc8f5 add code to Twips2d.rs
TODO: redo comments
2022-11-23 20:45:37 -07:00
Mark Richins db4031ccc5 Create Twips2d.rs
see issue #6973
2022-11-23 20:45:37 -07:00
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