Commit Graph

363 Commits

Author SHA1 Message Date
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