Commit Graph

6660 Commits

Author SHA1 Message Date
dependabot[bot] abe77636bf build(deps-dev): bump typedoc from 0.22.13 to 0.22.17 in /web
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.22.13 to 0.22.17.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.22.13...v0.22.17)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01 23:27:46 +03:00
relrelb 4fb77edfb1 render: Move `srgb_to_linear` to `common_tess`
Since it's the only user of it. Also make it mutate the float array
parameter instead of returning a new one, just to simply things a
bit.
2022-05-31 21:48:11 +03:00
relrelb 34d5a8f9d4 canvas: Remove dead `srgb_to_linear` function
There's another similar function in `core/src/backend/render.rs`.
2022-05-31 21:48:11 +03:00
dependabot[bot] e4ef3c6406 build(deps): bump enum-map from 2.2.0 to 2.3.0
Bumps [enum-map](https://github.com/xfix/enum-map) from 2.2.0 to 2.3.0.
- [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/commits/v2.3.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-30 23:36:14 +03:00
dependabot[bot] 3ce6412a2e build(deps): bump flate2 from 1.0.23 to 1.0.24
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.23 to 1.0.24.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-30 23:36:08 +03:00
Toad06 d53af46c76 web: Disable "Report bug" link if build is outdated 2022-05-30 20:50:15 +03:00
relrelb ec23a64a13 swf: Mark some `Fixed` functions as `const` 2022-05-29 23:35:03 +03:00
relrelb cec9850a33 core: Use `swf::Matrix::translate` in more places
Replace direct instatiations of `swf::Matrix` where only `tx` and
`ty` are specified, and other fields are default.

This results in a slightly more shorter, readable code.
2022-05-29 21:33:53 +03:00
relrelb 60a1dbfb07 swf: Mark some `Matrix` functions as `const` 2022-05-29 21:33:53 +03:00
Robert Setter 6114f14fe0
Updating the verbiage for the AS3 warnings to try and reduce the number of support questions about it. (#7106)
* Updating AS3 warning verbiage.

* Updating AS3 verbiage

* Increase root font size

* Refining font size.

* correcting font size in .message
2022-05-29 15:08:46 +03:00
Toad06 aad3ad6c08 tests: Add test for `Value::as_bool(String)` in SWFv6 2022-05-27 23:05:55 +03:00
Toad06 61fa38e70f avm1: Correct `Value::as_bool(String)` in SWFv6 and below 2022-05-27 23:05:55 +03:00
Aaron Hill 811af340c3 render: Fix swapped 'width' and 'height' in wgpu `register_bitmap_raw`
These arguments were being passed in the wrong order, leading to a crash
when the width and height are not equal.
2022-05-25 21:56:34 +03:00
Aaron Hill 15cb9a9ce6 Use `instance_scope` when making `super` method call
A method called with `super` is always an instance method,
so we should be using `instance_scope` for consistency with
`call_property`. This fixes a bug where a method cannot
access static class members (via `getlex`) when called bia
`super.method()`
2022-05-24 18:49:47 -06:00
Aaron Hill fd2d14618d
core: Correctly calculate the length passed to `resize_to_reader`
In several places, we read some data from a tag, and then pass
the original tag length to `resize_to_reader`. This is incorrect -
the provided length is used an an offset from the current position
in the reader, so we will extend past the end of the current tag if
we've already read some bytes.

In practice, this doesn't appear to cause any problems - AVM bytecode
has internal length fields, which end up ensuring that we will never
try to read past where the slice *should* end. However, if a `DoAbc`
tag is the last tag in the file, then we'll end up trying to use
`resize_to_reader` with an offset past the end of the movie.

This commit subtracts the number of already-read bytes from `tag_len`,
to ensure that we always construct a correctly-sized `SwfSlice`
2022-05-24 11:46:16 -07: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
Toad06 580a499e56 core: Run `update_drag` in `Player::handle_event` 2022-05-23 19:05:35 -07:00
Mike Welsh 4f6959184b canvas: Remove `BitmapDataStorage` and fix lifetime of bitmap data
* Remove `BitmapDataStorage` as its no longer necessary, and store
   the bitmap canvas/context in `BitmapData` instead.
 * Store the `Bitmap` RBGA buffer in the canvas backend. Previously
   this was thrown away when converted to `ImageData`, but this
   causes the glitchy pixels mentioned in:
   https://github.com/ruffle-rs/ruffle/pull/6975#issuecomment-1127942520
   `ImageData` does not copy the buffer passed to it, so store it
   to keep it alive. See:
   https://github.com/rustwasm/wasm-bindgen/issues/2445
2022-05-22 05:47:46 -07:00
Mike Welsh 32bf7e1412 chore: Appease clippy 2022-05-22 02:34:18 -07:00
dependabot[bot] 5a50f4cec1 build(deps): bump enum-map from 2.1.0 to 2.2.0
Bumps [enum-map](https://gitlab.com/KonradBorowski/enum-map) from 2.1.0 to 2.2.0.
- [Release notes](https://gitlab.com/KonradBorowski/enum-map/tags)
- [Changelog](https://gitlab.com/KonradBorowski/enum-map/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/KonradBorowski/enum-map/commits/master)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-21 23:04:43 -07:00
Mike Welsh ff3407cbe0 canvas: Use `DomMatrix` instead of `SvgMatrix` 2022-05-21 19:34:49 -07:00
Mike Welsh 169e86ceb4 canvas: Reimplement masking
Use `CanvasRenderingContext2d.clip` for masking instead of using
intermediate canvases.
2022-05-21 19:34:49 -07:00
bbb651 cf820b4f95 desktop: Add fullscreen command line option 2022-05-20 19:51:22 -07:00
relrelb a398c619a3 tests: Unignore `xml_inspect_xmldecl`
It passes now.
2022-05-20 18:46:19 -07:00
relrelb e3da0d2bfd avm1: Simplify `XML.xmlDecl`
Store just the XML declaration string itself, rather than the attributes
it consists of. Then simply return it in ActionScript's `XML.xmlDecl`
property, without using `quick_xml::Writer` at all. This also matches
Flash behavior by capturing the XML declaration as-is, preserving
whitespaces, quotes, casing etc.
2022-05-20 18:46:19 -07:00
Daniel Jacobs cddf5796a3 avm2: Add more Event classes' methods and properties 2022-05-20 18:42:07 -07:00
David Wendt e926af7796 core: Prevent recursive execution of frame scripts on the same movie clip.
To be clear, recursive execution of frame scripts between *different* movie clips is still allowed.
2022-05-20 18:37:42 -07:00
David Wendt 85d98d8c07 core: Always clear the `EXECUTING_AVM2_FRAME_SCRIPT` flag, even if we didn't actually execute frames.
Prior to this commit, executing frame scripts on a movie that doesn't have them for this frame, or didn't advance to a new frame, would cause the the movie to ignore all gotos until the next time it ran a frame script.
2022-05-20 18:37:42 -07:00
Aaron Hill eaeecfcfbc Adjust error message 2022-05-20 11:41:17 -07:00
Aaron Hill 613a255fb3 Use binary literal 2022-05-20 11:41:17 -07:00
Aaron Hill d3689de25d Use QName::dynamic_name 2022-05-20 11:41:17 -07:00
Aaron Hill 7a870ad10a Make some methods private 2022-05-20 11:41:17 -07:00
Aaron Hill 8d8a7600d8 avm2: Partially implement `URLLoader` and related classes
This PR implements the `URLLoader` class, allowing AVM2 scripts
to load data from a URL. This requires several other related
classes (`URLLoaderDataFormat`, `URLRequest`, `IOError`) to be
implemented as well.

Currently implemented:
* Fetching from URLs using the 'navigator' backend
* The `text` and `binary` data formats (which store data
in a `String` or `ByteArray` respectively)
* The `open`, `complete`, and `ioError` events
* The `bytesLoaded`, `bytesTotal`, and `data` properties

Not yet implemented:
* The HTTP and security events
* All of the properties of `IOError`
* The properties on `URLRequest` (besides `url`)
* The "variables" data format

This should be enough to get some basic uses of `URLLoader` working
(e.g. simple GET requests to a particular website).

Note that in Flash's `playerglobal`, the `URLLoader` class is just
a think wrapper around the more general `URLStream`. However,
implementing `URLStream` will require changes to `Navigator``
to support notifications when data arrives in the stream. When
that happens, we should be able to re-use a large amount of the
code in this PR.
2022-05-20 11:41:17 -07:00
Toad06 7130c6c1c1 tests: Remove `Value::from_bool` 2022-05-19 20:24:53 -06:00
Toad06 39e46e5bd3 avm1: Remove `Value::from_bool` 2022-05-19 20:24:53 -06:00
Mike Welsh c503f78e13 canvas: Remove `pixelated_property_value`
This is no longer used with the removal of the SVG paths in #6975.
2022-05-19 16:12:54 -07:00
Mike Welsh a10c2ff9c7 canvas: Remove Firefox hack for additive alpha color transforms
This was added in fecb981 to workaround an issue with additive
alpha color transforms in Firefox. This seems to have been fixed
and is no longer necessary, so Firefox can use the normal code
path.
2022-05-19 16:12:54 -07:00
TÖRÖK Attila 81749f900b avm2: Implement GradientType, InterpolationMethod, SpreadMethod in flash.display 2022-05-19 23:47:55 +02:00
Mike Welsh de99dcd37b core: Add `BitmapFormat::bytes_per_pixel` 2022-05-19 10:43:54 -07:00
Mike Welsh 48f7ff5f4d core: Add `Bitmap::to_rgba` 2022-05-19 10:43:54 -07:00
Mike Welsh e710f3fa0e core: Clean up `render::Bitmap`
* Make `BitmapFormat` a fieldless enum and move `data` to its own
   field for ease of use.
 * Make `Bitmap` fields private.
2022-05-19 10:43:54 -07:00
Mike Welsh 6615ed17f9 core: Verify bitmap length after decoding
Guarantee bitmap data after decoding has the expected length for
the given width+height+format. This eases the burden from backends
to worry about this. Pad or truncate the data if it doesn't have
the expected size.
2022-05-19 10:43:54 -07:00
Mike Welsh b88e77573d core: Handle greyscale PNGs
`render::decode_png` now handles greyscale or greyscale+alpha PNGs.
2022-05-19 10:43:54 -07:00
Toad06 78dcfe604d tests: `action_enumerate` can handle paths 2022-05-18 19:30:48 -07:00
Toad06 b50f1201e1 avm1: `action_enumerate` can handle paths 2022-05-18 19:30:48 -07:00
TÖRÖK Attila 135833e400 chore: Add a note to cargo config about RUSTFLAGS in the web build 2022-05-17 13:07:40 -07:00
TÖRÖK Attila 71f7f28fb0 chore: Allow unknown_lints in both WASM modules 2022-05-17 13:07:40 -07:00
relrelb 4021cb54a4 ci: Run cargo in locked mode
Per https://doc.rust-lang.org/cargo/commands/cargo-test.html#manifest-options,
`cargo --locked` assumes that `Cargo.lock` is up-to-date, and otherwise
exits with an error.
Besides the nice validation, this might hopefully speed-up CI a bit.

This could be done on Web as well, but I'm not sure what's the best
way of doing it.
2022-05-17 12:47:50 -07:00
relrelb f3af11db9c canvas: Remove some unused dependencies
They're now unused thanks to #6975.
Also remove the `crate-type` field from `Cargo.toml`. I'm not sure
exactly what it does and why it was introduced, but seems working
without it.
2022-05-17 09:51:13 -07:00
Mike Welsh 62d62d9667 chore: Allow unknown_lints in web build
The web build script in `core\package.json` sets the `RUSTFLAGS`
env var, which overrides any settings in `.cargo/config.toml`.

Add `-Aunknown_lints` to these `RUSTFLAGs` to squelch a stray
`unused_macro_rules` warning.
2022-05-17 08:36:41 -07:00