Commit Graph

436 Commits

Author SHA1 Message Date
renovate[bot] 93f08d7738 chore(deps): lock file maintenance rust dependencies 2023-08-14 23:58:45 +02:00
Nathan Adams f2ca88bb34 core: Readd max(0) to blur size 2023-08-12 13:00:27 +02:00
Nathan Adams 1a4a808c23 render: Make Filter::calculate_dest_rect work in Twips 2023-08-12 13:00:27 +02:00
Nathan Adams da090f0bd7 render: Move filter size calculation from wgpu to render/swf 2023-08-12 13:00:27 +02:00
renovate[bot] a4b179e1e0 chore(deps): lock file maintenance rust dependencies 2023-08-08 23:19:16 +02:00
TÖRÖK Attila 41377c5472 swf: Different blur impotency check 2023-07-26 13:03:11 +02:00
relrelb 5f6d8d72ea render: Skip unreasonably large bitmaps
Some SWFs report unreasonable bitmap dimensions, and trying to reserve
enough capacity for them always fails. To avoid panics, skip those bitmaps.

Fixes #1191
Fixes #2759
Fixes #10701
2023-07-24 09:37:37 +03:00
Nathan Adams b201e19cc7 wgpu: Don't create an extra fresh texture for applying filters to a CAB 2023-07-20 23:19:20 +02:00
Lord-McSweeney 5975714f75 avm2+swf+tests: Store metadata on Traits and VTable, report metadata in describeType; parse ABC metadata key-value pairs correctly; add test 2023-07-19 16:24:23 +02:00
Kornelius Rohrschneider 687c0e7516 core: Complete MovieClip error state & Change uncompressed_len to i32
Previously, the MovieClip error state contained one TODO in order to be
completely implemented: The HeaderExt variable uncompressed_len needs to
be -1 in the error state, but its type has been u32.
The type has now been changed to i32, and the variable is set to -1 in
the default_error_header function. Therefore, the MovieClip error state
is now fully implemented.

Other connected functions and variables like SwfMovie::uncompressed_len
or MovieClip::total_bytes have been adjusted to this type change. Code
has been adjusted if needed where this value is used.
2023-07-17 00:08:02 +02:00
Kornelius Rohrschneider 893052c2a6 core: Add MovieClip error state
A load_error_swf function has been added to the Loader. It makes the
MovieClip enter the error state in which some attributes have certain
error values to signal that no valid file could be loaded. This happens
if no file could be loaded or if the loaded content is no valid
supported content.
The function creates an error state movie stub using the new
SwfMovie::error_movie function (which uses a new default_error_header
function) and configures remaining variables with the
movie_not_available method.
One TODO in order for the error state to be completely implemented has
been added.

Since the error state of the MovieClip includes the final URL of the SWF
file obtained after any redirects, the load_error_swf and
movie_loader_error functions (now) take an swf_url attribute.
To get this URL in case no file could be loaded, the
NavigatorBackend::fetch method has been changed to return an
ErrorResponse struct (including the url and the actual error) in the
error case. The Response struct returned in the success case has been
renamed to SuccessResponse.
All fetch implementations have been adapted accordingly. Code has been
adjusted to return the actual error where that's needed.

Documentation has been added and improved.
2023-07-17 00:08:02 +02:00
Lord-McSweeney 3e193214df swf: Ignore bad ConstantPool string reads 2023-07-15 12:10:36 +02:00
Lord-McSweeney 61a4ded851 swf: Ignore bad ActionTry opcodes 2023-07-15 12:10:36 +02:00
Nathan Adams c3fdfc17dd swf: Scale filter distances where appropriate 2023-07-12 18:51:11 +02:00
Nathan Adams 5c13d323b3 wgpu: Implement the undocumented ability to disable compositeSource for glow/shadow 2023-07-12 18:51:11 +02:00
Nathan Adams 8cb6e5bdf0 wgpu: Implement drop shadow filter 2023-07-12 18:51:11 +02:00
Nathan Adams 8f78fd410b swf: Don't require Coordinate (only Twips) for Rectangles, only when using valid-checking stuff 2023-07-12 18:51:11 +02:00
Nathan Adams 44024e77c3 swf: Add inner_blur_filter() method to filters that contain blurs 2023-07-12 18:51:11 +02:00
Nathan Adams 2459ae5230 chore: Fix clippy 'useless-vec' 2023-07-12 18:17:43 +02:00
renovate[bot] f0607d6a1f chore(deps): lock file maintenance rust dependencies 2023-07-11 22:42:51 +02:00
renovate[bot] 664227dcdf fix(deps): update rust crate libflate to v2 2023-07-10 08:20:45 +02:00
Nathan Adams 146d565c02 render: Add Filter::scale() and use it to scale filter values (currently just blur_) 2023-07-03 20:13:40 +02:00
renovate[bot] 13b1078142 chore(deps): lock file maintenance rust dependencies 2023-07-03 08:28:13 +03:00
David Wendt 34625524ad swf: Zero is a valid video codec and it indicates no codec. 2023-06-30 16:14:28 -06:00
Nathan Adams a5915a9bdb swf: Make Color Copy 2023-06-29 20:32:36 +02:00
Nathan Adams c0247c020a swf: Add write_swf_raw_tags for reconstructing a swf from its parts 2023-06-21 18:27:12 +02:00
renovate[bot] 7a21756ddb chore(deps): lock file maintenance rust dependencies 2023-06-17 11:00:52 -05:00
Nathan Adams a26a64d88f core: Format Rectangle to 2 decimal places 2023-06-03 09:11:06 +02:00
Nathan Adams e12e2a2e54 core: Initial Debug UI 2023-06-03 09:11:06 +02:00
relrelb ee30646745 avm1: Migrate `DisplacementMapFilter` to `NativeObject` 2023-05-27 23:08:42 +03:00
renovate[bot] 5d2477fe98 chore(deps): lock file maintenance rust dependencies 2023-05-22 19:12:08 +03:00
iwannabethedev 8cd5414c5d
Fix overflow bug in `shape_utils::winding_number_line()` 2023-05-17 07:21:13 +03:00
Toad06 aac0c43372 swf: Bail out if swf version is 0 2023-05-16 20:23:23 +02:00
relrelb 660acac427 swf: Use `PointDelta<Twips>` in `ShapeRecord` 2023-05-11 08:55:44 +03:00
relrelb b93a32af0f swf: Use `Point<Twips>` in `StyleChangeData::move_to`
No functionality change.
2023-05-11 08:55:44 +03:00
relrelb 182ae6c9a9 swf: Introduce `ShapeRecordFlag`
No functionality change.
2023-05-02 20:24:38 +03:00
relrelb 3046d68da1 swf: Introduce `PointDelta`
Generally, when transforming a difference between two points, `p1`
and `p2`, with a matrix `m`, we would like the following property
to hold:

```
m * (p1 - p2) == m * p1 - m * p2
```

Unfortunately, it wasn't like this before, because matrices have a
translation component, which is non-linear. In `m * p1 - m * p2`,
the translations of `m * p1` and `m * p2` are the same and therefore
cancel out each other. However, in `m * (p1 - p2)` the translation
stays.

In order to preserve this property, introduce a new `PointDelta`
type which is not subject to translation when transformed by a matrix.

For now, the following operations are supported:

* `Point - Point -> PointDelta`
* `Point + PointDelta -> Point`
* `Point += PointDelta`
* `Point - PointDelta -> Point`
* `Point -= PointDelta`

As a consequence, the expression `position + global_to_local_matrix * mouse_delta`
in `update_drag()` now ignores translation, which fixes #817.
2023-04-29 22:29:37 +03:00
relrelb 60ffe07ae7 chore: Use `swf::Point` in many places
Convert nearly all instances of `(Twips, Twips)` (maybe besides in
`shape_utils.rs`) to `swf::Point<Twips>`.
2023-04-27 22:14:03 +03:00
renovate[bot] 3b3c08a354 chore(deps): lock file maintenance rust dependencies 2023-04-24 01:22:07 +02:00
relrelb 814cb00821 avm1: Migrate `GlowFilter` to `NativeObject` 2023-04-08 13:40:32 +03:00
relrelb 236a97bf31 render: Replace `ColorTransform` with `swf::ColorTransform` 2023-03-29 23:27:20 -07:00
Mike Welsh 74b2ff6997 swf: Inline `Color` methods 2023-03-26 18:20:15 -07:00
Mike Welsh df5f5451f4 swf: Inline `Point` methods 2023-03-26 18:20:15 -07:00
Mike Welsh 49ea1b0f36 swf: Inline `Twips` methods 2023-03-26 18:20:15 -07:00
renovate[bot] f6f646a756 chore(deps): lock file maintenance rust dependencies 2023-03-19 19:45:30 -07:00
Toad06 e2415be734 core: Store correct data for loaded images 2023-03-20 01:36:04 +01:00
Nathan Adams bc9e1d7c14 swf: Rename HAS_FILL_WINDING_RULE to NON_ZERO_WINDING_RULE 2023-03-18 19:14:08 -07:00
TÖRÖK Attila 96d1f19e6c
chore: Port to bitflags 2.0.0
* Bump bitflags to 2.0.0
* Sprinkle Clone, Copy, Eq, PartialEq, and Debug derives where needed
* Call `bits` on bitflags, as it is now a method
* Switch from `from_bits_truncate` to `from_bits_retain` on bitflags where needed
* Bump h263-rs for the bitflags 2.0.0 dependency

As part of porting to bitflags 2.0.0, see:
https://kodraus.github.io/rust/2022/10/07/bitflags2.html#upgrading-to-2x
2023-03-15 20:06:10 -07:00
relrelb 83c15b8033 render: Replace `BoundingBox` with `swf::Rectangle` 2023-03-04 21:54:23 +02:00
relrelb 5756c847cd swf: Make `Twips::new` a `const fn` 2023-03-04 21:54:23 +02:00
Nathan Adams 545193b098 swf: Deduplicate GradientFilter again 2023-02-28 16:25:12 +01:00
Nathan Adams f79015e201 render: Use swf Filter types where possible. Gradient types had to be split into duplicate classes to allow for different trait impls based on which gradient filter type it is. 2023-02-28 16:25:12 +01:00
Nathan Adams 9224aeca5d swf: Add DropShadowFilter::hide_object(), it's the only time COMPOSITE_SOURCE is used 2023-02-28 16:25:12 +01:00
Nathan Adams 7da2a061cc swf: ColorMatrixFilter::matrix is actually f32, not Fixed16 2023-02-28 16:25:12 +01:00
Nathan Adams ce9159cba4 swf: Fixed read order of BevelFilter colors. The swf spec is wrong. 2023-02-28 16:25:12 +01:00
Aaron Hill 016ab56cdf avm2: Shrink `Op` enum by using a `Box<[i32]>` in `LookupSwitch`
This shaves off one `usize` from the size of `Op`.
2023-02-27 18:09:40 -06:00
relrelb 4e84488c6e chore: Appease clippy 2023-02-27 12:43:23 +02:00
renovate[bot] 71e24eedba fix(deps): update rust dependencies 2023-02-27 11:48:53 +02:00
relrelb dc9ec40d31 chore: Allow `clippy::bool_to_int_with_if`
Seems like Clippy no longer complains about it.
2023-02-26 13:23:38 +02:00
relrelb 5f4f23cceb swf: Don't truncate `ClipEventFlag` in SWFv5
Although in SWFv5 the 2nd byte is documented to be reserved (all 0),
Flash does read it and treats it the same as for SWFv6.

Fixes #8620
2023-02-25 23:20:45 +02:00
relrelb e98aa54599 swf: Introduce `ConvolutionFilterFlags` 2023-02-21 16:55:13 +02:00
relrelb 35ef402b95 swf: Introduce `GradientFilterFlags` 2023-02-21 16:55:13 +02:00
relrelb 1fbfd2cbbc swf: Introduce `BevelFilterFlags` 2023-02-21 16:55:13 +02:00
relrelb 1f9c940331 swf: Introduce `GlowFilterFlags` 2023-02-21 16:55:13 +02:00
relrelb 2aaf337b6a swf: Introduce `BlurFilterFlags` 2023-02-21 16:55:13 +02:00
relrelb c86cd4fa9d swf: Introduce `DropShadowFilterFlags` 2023-02-21 16:55:13 +02:00
relrelb 5a3bb33b78 swf: Cleanup `Twips2d`
* Rename it to `Point`.
* Remove unnecessary methods, such as `.get()`.
2023-02-18 17:51:02 +02:00
Nathan Adams f2acb7c230 swf: Added DoAbc2 tag 2023-02-14 08:51:45 +01:00
Nathan Adams 69f93f926e swf: Rename DoAbc to DoAbc2 2023-02-14 08:51:45 +01:00
renovate[bot] a27bd66b58 fix(deps): update rust dependency patches 2023-02-13 04:59:31 +01:00
Nathan Adams 284a58c817 avm2: Implement BitmapData.apply_filter for ColorMatrixFilter 2023-02-05 18:41:43 +01:00
nosamu 0e4db6a2c9 swf: Accept Scaleform GFx header signatures 2023-01-16 18:25:34 +01:00
renovate[bot] 630558a936 fix(deps): update rust dependencies 2023-01-10 16:37:40 +01:00
Nathan Adams cb6d72b49b wgpu: Split up gradient shader based on type and repeat 2023-01-03 03:39:13 +01:00
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