Commit Graph

401 Commits

Author SHA1 Message Date
dependabot[bot] 103f384a08 build(deps): bump image from 0.24.3 to 0.24.4
Bumps [image](https://github.com/image-rs/image) from 0.24.3 to 0.24.4.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.24.3...v0.24.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 00:49:25 +03:00
dowgird 5ac4f4358d avm2: Added flash.net.URLVariables 2022-09-27 13:43:30 -05:00
Aaron Hill 53f42e0bec avm2: Fix getQualifiedClassName for null and undefined 2022-09-27 00:05:06 -05:00
Aaron Hill f5b59f869c avm2: Show native method names in stack trace
Previously, we would display an empty string for the method name.

We can now store a `&'static str` again in `NativeMethod`,
instead of needing a `Cow`
2022-09-26 14:13:48 -05:00
Aaron Hill dddc9e954a avm2: Add tests for looking up properties on Class objects 2022-09-25 15:37:50 -05:00
golfinq ceb877c55f avm2: Implement error types for avm2 2022-09-25 02:27:59 +03:00
dowgird e448f5e027 avm2: implemented flash.utils.unescapeMultiByte 2022-09-25 01:19:11 +03:00
Aaron Hill 66df5ea3de avm2: Implement typed 'catch' blocks
Now that we have a custom `Error` enum, this is very straightforwawrd.
I've converted `getDefinitionByName` return an AVM error, since this
is commonly used by games to test for a class.
2022-09-24 13:03:29 -05:00
Aaron Hill 7b0bc0fb74 avm2: Implement undocumented 'Function.length' property
This returns the function's parameter count, and is used by the Starling
framework to implement a custom event dispatcher.
2022-09-23 18:36:23 -05:00
David Wendt 293d52048b chore: Don't ask me how this `s` got in the output file 2022-09-23 11:45:52 -06:00
David Wendt 5a9f0ea099 tests: Add a test for `WaitForFrame`'s clamping behavior. 2022-09-23 11:45:52 -06:00
EmperorBale bfaedcf321 tests: Add test for checkfilter opcode 2022-09-22 15:18:23 -07:00
EmperorBale e40229d90b tests: Add test for ByteArray.writeObject 2022-09-21 13:39:58 -07:00
Aaron Hill 93b7de2fe6 avm2: Use custom Error instead of std::error::Error 2022-09-21 12:37:37 -05:00
Adrian Wielgosik d1ffaad927 avm2: Support enumerating null/undefined 2022-09-21 00:03:44 +02:00
EmperorBale e1eaa9770a avm2: Switch ByteArray to AS
avm2: Fix ByteArray

avm2: Implement ByteArray.defaultObjectEncoding

avm2: Rename ByteArray allocator
2022-09-17 12:31:43 -07:00
David Wendt f101160abc tests: Add a test for all `Stage.loaderInfo` properties that we weren't already testing for. 2022-09-17 12:32:15 -06:00
David Wendt eefe398f7c tests: `as3_bitmap_embedded` has a different stage size 2022-09-15 20:25:21 -06:00
David Wendt cf82a9d1c4 tests: Add a test for properties on Flex-style assets
We also re-enable the `bitmapdata_embedded` test now that we have a real renderer to work with.
2022-09-15 20:25:21 -06:00
David Wendt 2174c55d76 tests: Add a test for Flex-style image embeds. 2022-09-15 20:25:21 -06:00
David Wendt 613564baf7 tests: Adopt new expected images as the SWF stage size changed when I moved these tests to Flex/Flash Builder 2022-09-15 19:14:41 -06:00
David Wendt 0912ee4dff tests: Add an events test for `loadBytes` 2022-09-15 19:14:41 -06:00
David Wendt 0eff0bf91a core: Remove all synchronous preloading from core.
Backends that need synchronous preload behavior now explicitly ask for it as follows:

 * `tests` - repeatedly call `preload` in a loop with an exhausted execution limit to stress-test the chunked preload
 * `exporter`, `scanner` - synchronous/unlimited preload to match prior behavior

These may change in the future.
2022-09-15 19:14:41 -06:00
Aaron Hill 81a5f3f10a core: Always check mergeAlpha in BitmapData.copyPixels
Previously, we would only use mergeAlpha if alphaBitmapData
and alphaPoint. However, mergeAlpha can be used even when
those parameters are null.

Some of the AVM1 argument handling was also incorrect - I've fixed
it, and extended the existing test with the output-based test
added for AVM2.
2022-09-11 11:12:09 -05:00
Nathan Adams b2ecd39648 wgpu: Enable MSAA for offscreen textures 2022-09-11 09:07:53 +02:00
Nathan Adams c7f420dde5 wgpu: Moved WgpuRenderBackend into backend.rs 2022-09-11 09:07:53 +02:00
Aaron Hill 8370bc792d core: Use correct background alpha in BitmapData.draw
Previously, we would always use a transparent background,
even if the BitmapData is not transparent. This would normally
be corrected on the next frame when we copied the pixels to the
CPU. However, if an SWF ran `BitmapData.draw` on every frame,
this would never be corrected.
2022-09-09 19:24:21 -05:00
Aaron Hill 2f81f5814d render: Add `premultiplied_alpha` parameter for image capture
When rendering offscreen, we want the resulting image to use
premultiplied alpha, since the image will be stored in a texture.

However, when capturing an image in the exporter or test framework,
we want to use straight alpha, so that the resulting image can
be saved as a PNG.

Previously, we incorrectly used straight alpha everywhere, resulting
in incorrect output when using BitmapData.draw with transparency.
2022-09-09 15:46:48 -07:00
Aaron Hill ca030169f7 avm2: Implement BitmapData.rect and stub BitmapData.applyFilter
These are the last BitmapData methods needed for Solarmax
(the victory screen after beating the last level now renders).
2022-09-09 13:05:13 -05:00
Aaron Hill bb138d9082 avm2: Implement some of SharedObject
Our AVM2 `SharedObject` support is now *almost* equivalent
to our avm1 `SharedObject` support. We implement serialization
and deserialization for primitives, arrays, and `Object` instances
with local properties. We also implement serialization for `Date`,
but not `Xml` (since our AVM2 `Xml` class is just a stub at the moment).

This is enough to make 'This is the only level too' save level
progress to disk.

Currently, we always serialize to AMF3. When we implement
the `defaultObjectEncoding` and `objectEncoding`, we'll need
to adjust this.
2022-09-08 21:22:05 -05:00
Aaron Hill 974738fe10 tests: Add BitmapData.copyPixels image test from PR #2488 2022-09-08 19:52:48 -05:00
EmperorBale 5791423d43 tests: Enable avm_debug for regression tests 2022-09-07 13:54:33 -07:00
EmperorBale a5c3c0cab5 tests: Add test for Error.getStackTrace 2022-09-07 13:54:33 -07:00
Aaron Hill 7218146e04 avm2: Implement BitmapData.dispose
We now check if a BitmapData has been disposed by checking
for a zero width or height (which cannot happen otherwise).
As a result, we no longer need the 'disposed' field on the AVM1
BitmapData object.
2022-09-07 11:02:53 -07:00
Aaron Hill b764c4f6c1 avm2: Implement BitmapData.fillRect and BitmapData.getPixel32 2022-09-07 12:29:49 -05:00
dowgird 53ed748a54 avm2: added flash.utils.escapeMultiByte 2022-09-06 19:44:48 -07:00
Aaron Hill 93607aa86e
avm2: Implement `BitmapData.draw` for `wgpu` backend (#7254)
* avm2: Implement `BitmapData.draw` for `wgpu` backend

This method requires us to have the ability to render directly to a
texture. Fortunately, the `wgpu` backend already supports this in
the form of `TextureTarget`. However, the rendering code required
some refactoring in order to avoid creating duplicate `wgpu` resources.

The current implementation blocks on copying the pixels back
from the GPU to the CPU, so that we can immediately set them in
the Ruffle `BitmapData`. This is likely very inefficient, but will
work for a first implementation.

In the future, we could explore allowing the CPU image data and GPU
texture to be out of sync, and only synchronized when explicitly
necessary (e.g. on `getPixel` or `setPixel` calls).

* Rename `with_offscreen_backend` to `render_offscreen` and use Bitmap

* Don't panic when backend doesn't implement `render_offscreen`
2022-09-06 16:38:48 -05:00
Aaron Hill 45960de7dc avm2: Correctly implement DisplayObject.mask
The stub implementation was breaking code that relied on being
able to set a value for 'mask' and then retrieve it
(which used to work on a dynamic class like `MovieClip`).
2022-09-05 16:43:20 -07:00
dependabot[bot] 9b37c072db build(deps): bump pretty_assertions from 1.2.1 to 1.3.0
Bumps [pretty_assertions](https://github.com/rust-pretty-assertions/rust-pretty-assertions) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/rust-pretty-assertions/rust-pretty-assertions/releases)
- [Changelog](https://github.com/rust-pretty-assertions/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-pretty-assertions/rust-pretty-assertions/compare/v1.2.1...v1.3.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-05 23:30:37 +03:00
onkrot 1e0b59dbad avm2: Implement `String`.`localeCompare`, `search`, `toLocaleLowerCase`, `toLocaleUpperCase` methods. 2022-09-05 12:15:53 -07:00
Adrian Wielgosik 31780f15d8 tests: Add extra case to int_edge_cases test 2022-09-05 11:55:16 -07:00
= 91ae384682 tests: Removed software video impl for tests - it isn't used and adds a lot to compile time 2022-09-04 17:46:58 -07:00
Adrian Wielgosik 4707e4b6a8 tests: Add tests for int conversion edge cases 2022-09-04 08:57:18 +03:00
Mike Welsh c17da6e91a core: Fix some issues with `hitTest`
Fixes some issues with our winding # calculation which would cause
incorrect results for hitTest.

  * The convention for handling an intersection at endpoints was
    not the same between lines and bezier curves.
  * The bezier curve winding # function was not properly handling
    some cases where the curve was strictly y-monotonic.
  * Simplify the code a bit so that ray-curve intersections are
    returned in a consistent order based on upward/downward crossing.
2022-09-02 14:51:46 -07:00
Aaron Hill 7a7ea87679 avm2: Implement Sprite.startDrag and Sprite.stopDrag
For now, I've left 'dropTarget' unimplemented - unlike in
AVM1, the drop target can be non-interactive objects like `Shape`,
so we'll need additional refactoring to implement it.

This allows 'This is the only level too' to be playable
2022-09-02 13:03:14 -07:00
Aaron Hill 1a7c5339a7 avm2: Implement DisplayObject.localToGlobal and DisplayObject.globalToLocal
While writing tests for these methods, I discovered and fixed some
issues with how 'scrollRect' interacted with 'dobj.transform.matrix'
2022-08-29 23:12:40 -05:00
Aaron Hill e9697439de avm2: Skip over holes during array enumeration
This brings us closer to matching the Flash Player
enumeration behavior. Unfortunately, the precise enumeration
order for ScriptObject properties depends on the precise
order in the internal avmplus hashmap. This order is deterministic,
but adding/removing a property effectively randomizes it. Hopefully
there aren't any SWFS that depend on the *exact* order.
2022-08-29 15:53:44 -07:00
dependabot[bot] 802de0e7d1 build(deps): bump futures from 0.3.23 to 0.3.24
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.23 to 0.3.24.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.23...0.3.24)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-29 23:38:43 +03:00
Toad06 c4e64c5e26 avm1: Function calls in SWF4 bump the version to 5 2022-08-29 02:17:09 -07:00
David Wendt 4de46562ca tests: Add a test for class singleton properties. 2022-08-28 17:54:22 -06:00