Commit Graph

7616 Commits

Author SHA1 Message Date
Aaron Hill 45515be0a3 render: Improve support for BitmapData.draw
This PR fixes a numbe of interconnected bugs:
* We weren't consistently uploading a dirty BitmapData to the render
  backend before drawing to/from it.
* BitmapData.draw should *not* add a fill color - it should draw over
  the current contents of the BitmapData
* After drawing to a non-transparent BitmapData, we need to manually
  set the opacity back to 255 for each pixel (the drawing process
  takes transparency into account, but the opacity information is
  thrown away at the end).
2022-10-17 12:53:38 -05:00
relrelb 86ef4bd7fe core: Simplify `Bitmap` creation
Change `Bitmap::new()` to accept a `ruffle_render::bitmap::Bitmap`
directly, instead of `width`, `height` and `bitmap_handle`. As a
consequence, all `RenderBackend::register_bitmap_*` methods are no
longer necessary - we can use `ruffle_redner::utils::*` to obtain
a `ruffle_render::bitmap::Bitmap` right before calling `Bitmap::new()`.
2022-10-17 20:05:30 +03:00
David Wendt 36844e5e2f chore: Use explicit `.clamp`
Also, update the tests to confirm that this doesn't break NaN handling.
2022-10-16 14:55:07 -06:00
David Wendt 10ad603566 avm1: Implement `TextField.antiAliasType`, `.gridFitType`, `.sharpness`, and `.thickness`.
Notably this required removing a few parameter checks from core that turned out to be AS3-only.
2022-10-16 14:55:07 -06:00
David Wendt 7155f88601 avm2: Implement `TextField.antiAliasType`, `.gridFitType`, `.sharpness`, and `.thickness`. 2022-10-16 14:55:07 -06:00
David Wendt b8693a3932 core: Retain Advanced render settings in Normal mode, even though they won't be used there. 2022-10-16 14:55:07 -06:00
David Wendt 77dadd7844 tests: Test the default values for Normal antialiasing, too. 2022-10-16 14:55:07 -06:00
David Wendt ca8f9c1103 tests: Add tests for `TextField.antiAliasType` and related properties for AVM1 and AVM2. 2022-10-16 14:55:07 -06:00
relrelb 760f9e29df avm1: Migrate `BevelFilter` to `NativeObject` 2022-10-16 11:48:59 +03:00
relrelb 37f171de06 wgpu: Use `Depth32FloatStencil8` over `Depth24PlusStencil8`
Credit to @crumblingstatue.

Per `wgpu` documentation, the latter has wider support than the former.

Fixes #8295, #8296.
2022-10-15 23:35:44 +03:00
relrelb b1665c40c5 docs: Add Kongregate to sponsors 2022-10-15 23:20:38 +03:00
relrelb 1cbc906b04 avm1: Migrate `BlurFilter` to `NativeObject` 2022-10-15 16:00:30 +03:00
relrelb 178bf4fe24 chore: Extract Cargo `edition` to `[workspace.package]`
This is possible since Rust 1.64.0: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
2022-10-14 22:13:29 +03:00
relrelb 183b8adbf0 wgpu: Bump to `0.14.0`
Also bump `raw-window-handle` to `0.5`, as now required.
2022-10-14 21:49:40 +03:00
relrelb dbfd28e708 web: Bump `wasm-bindgen` to 0.2.83
This restores commit 084b252030.

As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-10-14 21:49:40 +03:00
David Wendt 81ed624c26 avm2: Loaders should not be opaque to mouse events. 2022-10-14 12:27:31 -05:00
Tal Hayon 052ec75e2a avm2: BitmapData.perlinNoise and DisplacementMapFilter 2022-10-14 11:22:26 -05:00
relrelb 5f1adc2bbf extension: Avoid some non-null assertions 2022-10-14 11:56:44 +03:00
relrelb acdb5ccb52 web: Remove `RufflePlayer` element existence-checks
They should always be present.
2022-10-14 11:56:44 +03:00
relrelb 29b661b366 web: Avoid deprecated `HTMLDocument` type
As suggested, use `Document` instead.
2022-10-14 11:56:44 +03:00
relrelb b0b0e55c24 swf: Extract read/write of filters to separate functions
Also unify the identical `GradientGlowFilter` and `GradientBevelFilter`
structs into `GradientFilter`.
2022-10-14 02:27:49 +03:00
relrelb bc73301592 avm1: Require some more prototypes
Since they are never `None`.
2022-10-14 00:23:12 +03:00
Aaron Hill 491ffbbf09 wgpu: Fix argument order when calling `BitmapSamplers.get_sampler` 2022-10-13 15:07:53 -05:00
Aaron Hill feda41d6c1 avm2: Add LoaderInfo.uncaughtErrorEvents
We don't currently fire any events, but we store the object
so that listeners will be correctly registered.
2022-10-12 17:26:14 -05:00
relrelb 4b334ce03a tests: Rewrite `Date` tests 2022-10-13 01:06:17 +03:00
relrelb 967ff56e3b avm1: Rewrite `Date` implementation
The new implementation is simpler, and supports many AVM1 quirks not
supported before.

In addition, migrate `Date` to `NativeObject`.
2022-10-13 00:49:50 +03:00
relrelb a59114d569 tests: Expand `primitive_type_globals`
Cover the now-correct `NaN.toString(x)` cases.
2022-10-13 00:05:25 +03:00
relrelb 21e24936b7 avm1: Correct `Number.toString` edge-case
`NaN` and large numbers are actually treated like `i32::MIN`. As described
in https://github.com/ruffle-rs/ruffle/issues/7772#issuecomment-1235977709,
Flash (at least 7+) fails to convert `i32::MIN` to a string due to a bug.
Since `i32::MIN` has no `i32` positive counterpart, digits extracted using
modulo are actually negative and characters before ASCII `'0'` are selected.

Flash 6- somehow return just `0` in those cases. This was Ruffle's behavior
up until this commit. This commit matches Ruffle behavior to latest Flash
Player, as we usually prefer. A `TODO` is still there in case we ever add
player version emulation.
2022-10-13 00:05:25 +03:00
relrelb f5dcbb883e swf: Extract filters to separate files
For better code organization.
2022-10-12 21:20:07 +03:00
relrelb f504804379 avm1: Require `fn_proto` in `FunctionObject::bare_function`
It was never `None`, except for 3 tests in `script_object.rs`,
which now use `activation.context.avm1.prototypes().function`.
2022-10-12 21:01:18 +03:00
relrelb 47a22070a4 desktop: Avoid deprecated `winit::EventLoop::with_user_event()`
Use `EventLoopBuilder::with_user_event().build()` instead, as suggested
by the deprecation warning.
2022-10-11 10:59:19 +03:00
dependabot[bot] 7817301cc4 build(deps): bump winit from 0.26.1 to 0.27.4
Bumps [winit](https://github.com/rust-windowing/winit) from 0.26.1 to 0.27.4.
- [Release notes](https://github.com/rust-windowing/winit/releases)
- [Changelog](https://github.com/rust-windowing/winit/blob/v0.27.4/CHANGELOG.md)
- [Commits](https://github.com/rust-windowing/winit/compare/v0.26.1...v0.27.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 10:59:19 +03:00
dependabot[bot] 1d3412cce0 build(deps): bump serde_json from 1.0.85 to 1.0.86
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.85...v1.0.86)

---
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-10-11 01:29:10 +03:00
dependabot[bot] ce3a8440e6 build(deps): bump simple_asn1 from 0.4.1 to 0.6.2
Bumps [simple_asn1](https://github.com/acw/simple_asn1) from 0.4.1 to 0.6.2.
- [Release notes](https://github.com/acw/simple_asn1/releases)
- [Commits](https://github.com/acw/simple_asn1/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 01:05:10 +03:00
dependabot[bot] 76f18cbc37 build(deps): bump clap from 4.0.9 to 4.0.12
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.9 to 4.0.12.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.9...v4.0.12)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 00:32:53 +03:00
dependabot[bot] bdd7c27965 build(deps): bump syn from 1.0.101 to 1.0.102
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.101 to 1.0.102.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.101...1.0.102)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 23:42:49 +03:00
EmperorBale 35c9597032 chore: Appease clippy 2022-10-10 12:48:35 -07:00
EmperorBale bbeea8715c tests: Add test for SWZ parsing 2022-10-10 12:48:35 -07:00
EmperorBale d72ef587f2 avm2: Add digest property to URLRequest 2022-10-10 12:48:35 -07:00
EmperorBale 5c9bf3ffc0 swf: Support SWZ files 2022-10-10 12:48:35 -07:00
Adrian Wielgosik 10c19fef57
render: Bail on attempts on panicking recursive render. (#8248) 2022-10-09 14:33:57 -05:00
relrelb 84533e278d swf: De-duplicate code in `count_sbits_twips()`
Re-use `count_sbits()`, as already done in `count_fbits()`.
2022-10-09 14:18:50 +05:45
relrelb 2b9f0a6280 swf: Optimize `count_ubits()`
Use `u32::leading_zeros()` instead of manually counting bits.
2022-10-09 14:18:50 +05:45
relrelb bf0ace0b88 chore: Appease clippy 2022-10-09 13:46:28 +05:45
relrelb 5c94714363 avm2: Port `flash.ui.Keyboard` to ActionScript 2022-10-07 12:27:56 +03:00
David Wendt 066ca11cff tests: Add a test for AS3 `BitmapData.clone()` 2022-10-07 01:41:48 -05:00
David Wendt 23b5eb6d72 avm2: Implement `BitmapData.clone`. 2022-10-07 01:41:48 -05:00
David Wendt 1b0d23e569 core: Don't desync on frames with no audio blocks.
Fixes regression caused by me in 85cf383c84
2022-10-06 21:41:59 -06:00
Tal Hayon a8b96b676a avm2: Add More BitMapData methods
This also fixes a small bug in copyChannels
2022-10-06 18:53:06 -06:00
Tal Hayon 7d27a5acb5 webgl: vertex array, buffer and texture cleanup 2022-10-06 22:19:45 +03:00