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