Commit Graph

7238 Commits

Author SHA1 Message Date
= 2d2869f44f core: Font::from_swf_tag is currently infallible, remove error path 2022-08-25 23:43:21 +02:00
= 1df8de5bac core: set_text and set_html_text are currently infallible, remove error path 2022-08-25 23:43:21 +02:00
Mike Welsh bea757cc92 tests: Adjust function_base_clip_removed test
Add test for #5645.
2022-08-25 00:01:02 -07:00
Mike Welsh 78247a37ab avm1: Load correct _root and _parent registers if base clip is removed
Normally a function closures also closes around its base clip.
If the base clip is removed, and then the function is executed, the
base clip then defaults to `this`.

However, Ruffle was incorrectly using the wrong base clip when
loading the `_root` and `_parent` registers in this case.

Fixes #5645.
2022-08-25 00:01:02 -07:00
Roman Rogowski 66d144bbdd core: Fix incorrect rendering of word-wrap text boxes (close #1095) 2022-08-24 22:51:51 -07:00
Aaron Hill b5391c00f6 tests: Re-add per-platform image tests
Reverts #7267

The image tests for the upcoming 'DisplayObject.stageRect' support
differ between Linux and Windows, so we need this support again.

To avoid the Linux filename churn that we previously encountered,
we now only include the platform and graphics backend in the filename
(e.g. `expected-linux-Vulkan`). This may result in some unexpected
'mismatched image' test failures if GHA updates to a version of Lavapipe
that changes rendering output, but this should be relatively easy to
notice.
2022-08-24 21:29:53 -07:00
relrelb a8edce8294 core: Remove unneeded `Box` 2022-08-24 22:36:20 +03:00
Aaron Hill c7216bf842 avm2: Set URLRequest.method default to GET
This was missed when I added 'method'
2022-08-23 17:54:10 -05:00
onkrot 14abd01e91 avm2: Pull flash.crypto package method from globals to crypto.as 2022-08-23 09:58:19 -05:00
onkrot db22992b86 avm2: Pull flash.utils package methods from globals to utils.as 2022-08-23 09:58:19 -05:00
onkrot 1a243bdd86 avm2: Implement all remaining matrix methods 2022-08-23 10:44:12 +02:00
Aaron Hill 86e6983943 avm2: Partially implement Loader.load
This PR implements the `Loader.load` method, as well as
the associated `LoaderInfo` properties and events.

We can now load in an external AVM2 SWf: it will be added
as a child of `Loader` object, and will render properly
to the screen.

Limitations:
* The only supported `URLRequest` property is `url`
* `LoaderContext` is not supported at all - we always use the default
  behavior
* Only `Loader.load` is implemented - we do not yet support unloading.
* We fire a plain 'Event' for the 'progress' event, instead of using
  the (not yet implemented) 'ProgressEvent' class

The main changes in this PR are:
* The AVM2 `Loader` class now has an associated display object,
  `LoaderDisplay`. This is basically a stub, and just renders
  its single child (if it exists).
* `LoaderStream::Stage` is renamed to `LoaderStream::NotYetLoaded`.
  This is used for both the `Stage` and an 'uninitialized'
  `Loader.contentLoaderInfo`. In both cases, certain properties throw
  errors, while others return actual values.
* The rust `Loader` manager now handles both AVM1 and AVM2 movie loads.
2022-08-22 19:36:29 -07:00
dependabot[bot] 60b03bdcf2 build(deps): bump thiserror from 1.0.31 to 1.0.32
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.31 to 1.0.32.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.31...1.0.32)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 18:00:39 -07:00
dependabot[bot] 349a9bf31e build(deps): bump chrono from 0.4.19 to 0.4.20
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.19 to 0.4.20.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.19...v0.4.20)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 17:27:36 -07:00
dependabot[bot] 25a77869ab build(deps): bump serde from 1.0.143 to 1.0.144
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.143 to 1.0.144.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.143...v1.0.144)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 16:51:56 -07:00
dependabot[bot] fe9862725a build(deps): bump anyhow from 1.0.61 to 1.0.62
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.61 to 1.0.62.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.61...1.0.62)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 15:57:16 -07:00
dependabot[bot] fa6a9641c6 build(deps): bump serde_json from 1.0.83 to 1.0.85
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.83 to 1.0.85.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.83...v1.0.85)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 15:06:38 -07:00
dependabot[bot] f93a8800a3 build(deps): bump bytemuck from 1.12.0 to 1.12.1
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/Lokathor/bytemuck/releases)
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.12.0...v1.12.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 13:45:14 -07:00
Aaron Hill 98c7f443ce core: Only store viewport dimensions in `RenderBackend`
Previously, the viewport height and width were stored in
both `Stage` and the `RenderBackend`. Any changes to the viewport
dimensions (e.g. due to window resizing) needed to be updated in both
places to keep our handling of the viewport consistent.

This PR adds a new `ViewportDimensions` type, which holds the
width, height, and scale factor. It is stored inside the
`RenderBackend` impl, and is retrieved using the newly added
method `RenderBackend.get_viewport_dimensions`. After a `Player`
has been constructed, any code that needes access to the viewport
dimensions will ultimate go through this method.

Unfortunately, `Stage` needs to use the viewport dimensions
in `build_matrices`. Therefore, any code modifying the viewport
dimensions should go through `player.set_viewport_dimensions`,
which ensures that the stage matrices are rebuilt after the render
backend is updated.
2022-08-22 13:44:30 -07:00
Mike Welsh 1ce877292e tests: Add test for _droptarget 2022-08-21 21:16:02 -07:00
Mike Welsh 3629a55c00 core: Mouse picking respects order of children (fix #7393)
When doing mouse picking, interactive children were considered
before all non-interactives, which could cause an `_droptarget` to
be set to an underlying movieclip even if a shape occluded it.

Now consider all children in render order so that the top-most
shape will capture the mouse input.
2022-08-21 21:16:02 -07:00
= 3a1947445e core: Made SwfSlice::to_subslice return an empty slice in case of errors 2022-08-21 20:12:10 -07:00
= 44cfaa9200 core: Made SwfSlice::to_unbounded_subslice return an empty slice in case of errors 2022-08-21 20:12:10 -07:00
= 55566037f7 core: Made SwfSlice::resize_to_reader return an empty slice in case of errors 2022-08-21 20:12:10 -07:00
= 0cfbdc0385 core: Made SwfSlice::to_start_and_end return an empty slice in case of errors 2022-08-21 20:12:10 -07:00
Adrian Wielgosik b18329c8fe web: Allow modifying player volume via JS 2022-08-20 11:53:42 -07:00
Mike Welsh b38fce230d audio: Add AudioBackend::volume/set_volume 2022-08-20 11:53:42 -07:00
David Wendt f66e54bd03 core: Log a `debug` message every time we run a goto. 2022-08-19 18:52:21 -07:00
David Wendt fe828d7c24 core: At the end of a goto, fix tag stream desyncs caused by not hitting the target frame.
If we try to go to a frame that doesn't exist, or hasn't been loaded yet, we will stop on the last available frame, but skip any tags that would have run there. This is technically a desync, but it hasn't caused any problems so far as any further timeline interaction would trigger a rewind (which isn't affected by desyncs).

Of course, now that we're actually testing the tag stream position it *does* cause problems. We actually have to fix up the position to be correct even though it will never be used (hopefully). It may be prudent to do this outside of the `timeline_debug` feature as well in the future.
2022-08-19 18:52:21 -07:00
David Wendt 30b1d4af2a tests: Run all tests in timeline debug mode. 2022-08-19 18:52:21 -07:00
David Wendt 32542fdbc8 core: When `timeline_debug` is enabled, assert every goto's tag stream positions against the list of stream boundaries. 2022-08-19 18:52:21 -07:00
David Wendt 72e40423fa core: Calculate the start and end position of every frame when the `timeline_debug` feature is enabled. 2022-08-19 18:52:21 -07:00
Daniel Jacobs c2354c1a30 demo: Make open-modal kebab-case 2022-08-19 16:20:06 -07:00
Daniel Jacobs d8ed2f0d01 demo: Address feedback for metadata color scheme and icon placement 2022-08-19 16:20:06 -07:00
Daniel Jacobs a2968e6ecb demo: Use switch statement instead of branches 2022-08-19 16:20:06 -07:00
Daniel Jacobs 7343acf65b demo: Replace division & Math.round with bitshift (acts like Math.floor) 2022-08-19 16:20:06 -07:00
Daniel Jacobs 86f0813a79 demo: Use Object.entries for simpler code 2022-08-19 16:20:06 -07:00
Daniel Jacobs 9bd1a8c940 demo: Ensure metadata does not overflow 320 x 320 screen 2022-08-19 16:20:06 -07:00
Daniel Jacobs 92a4d7c831 demo: Add uncompressedLength to metadata on demo page 2022-08-19 16:20:06 -07:00
Daniel Jacobs 42cf08d578 demo: Show metadata on information icon click 2022-08-19 16:20:06 -07:00
Daniel Jacobs 75becaf3ba demo: Add metadata to status bar on the page 2022-08-19 16:20:06 -07:00
Mike Welsh 89cb1212ad render: Disable most blend modes
Avoid blend modes except ADD and SUBTRACT until they can be
implemented properly.
2022-08-19 14:59:08 -07:00
Aaron Hill 8a1e297e26 wgpu: Convert from premultiplied to straight alpha when capturing image
The captured WGPU texture uses premultiplied alpha.
This image gets saved as a PNG, so it should use straight alpha.
Note that all of our current image tests have 'alpha = 1.0' for all
of the pixels, so this currently has no effect.
2022-08-19 13:35:07 -07:00
Mike Welsh f72e02f4b2 core: Add unmultiply_alpha_rgba 2022-08-19 13:35:07 -07:00
relrelb c7941e7248 avm1: Remove `ScriptObject::bare_object`
Use `ScriptObject::new` instead.
2022-08-19 12:22:48 -07:00
relrelb 5cbfcde784 avm1: Remove `ScriptObject::object_cell`
Use `ScriptObject::new` instead.
2022-08-19 12:22:48 -07:00
relrelb 04b4a6cabe avm1: Rename `ScriptObject::object` to `ScriptObject::new` 2022-08-19 12:22:48 -07:00
Aaron Hill f3feaaf2be avm1: Set init object properties in reverse order
Fixes #7667

This behavior is by setter functions, and some SWFS
depend on it.
2022-08-19 11:49:40 -07:00
Aaron Hill 0cd6d13783
avm2: Stub ContextMenu.builtInItems (#7652) 2022-08-18 20:50:42 -04:00
Mike Welsh 7a53322cbb avm1: Wire up Button.blendMode 2022-08-18 16:38:17 -07:00