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