Commit Graph

7866 Commits

Author SHA1 Message Date
dependabot[bot] 281ca6a1b8 build(deps): bump insta from 1.21.1 to 1.21.2
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.21.1 to 1.21.2.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.21.1...1.21.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-30 12:36:14 +01:00
dependabot[bot] 83487ae5d1 build(deps): bump serde from 1.0.147 to 1.0.148
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.147 to 1.0.148.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.147...v1.0.148)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-30 10:04:26 +01:00
dependabot[bot] e3923e0d3d build(deps): bump syn from 1.0.103 to 1.0.104
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.103 to 1.0.104.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.103...1.0.104)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 20:47:36 -07:00
dependabot[bot] bbaeb8c1b6 build(deps): bump embed-resource from 1.7.2 to 1.7.4
Bumps [embed-resource](https://github.com/nabijaczleweli/rust-embed-resource) from 1.7.2 to 1.7.4.
- [Release notes](https://github.com/nabijaczleweli/rust-embed-resource/releases)
- [Commits](https://github.com/nabijaczleweli/rust-embed-resource/compare/v1.7.2...v1.7.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-30 01:11:46 +01:00
Calvin304 5d5a56a7a3 avm2: Address feedback to DropShadowFilter stub 2022-11-27 09:46:18 -05:00
Calvin304 e46fc4fe8a avm2: stub DropShadowFilter 2022-11-27 09:46:18 -05:00
Marco Grassi 0c851ecfde don't include all the features in chrono to avoid including the vulnerable time dependency 2022-11-26 14:04:59 -05:00
Marco Grassi 6873cda76e move away from unmaintained clipboard crate and use arboard crate 2022-11-26 14:04:59 -05:00
Marco Grassi ad81b3bf14 upgrade lock and toml dependencies 2022-11-26 14:04:59 -05:00
Aaron Hill b8745f0ff1 avm2: Partially implement Stage3D for wgpu backend
This PR implements core 'stage3D' APIs. We are now able
to render at least two demos from the Context3D docs - a simple
triangle render, and a rotating cube.

Implemented in this PR:
* Stage3D access and Context3D creation
* IndexBuffer3D and VertexBuffer3D creation, uploading, and usage
* Program3D uploading and usage (via `naga-agal`)
* Context3D: configureBackBuffer, clear, drawTriangles, and present

Not yet implemented:
* Any 'dispose()' methods
* Depth and stencil buffers
* Context3D texture apis
* Scissor rectangle

General implementation strategy:

A new `Object` variant is added for each of the Stage3D objects
(VertexBuffer3D, Program3D, etc). This stores a handle to the
parent `Context3D`, and (depending on the object) a handle
to the underlying native resource, via `Rc<dyn
SomeRenderBackendTrait>`).

Calling methods on Context3D does not usually result in an immediate
call to a `wgpu` method. Instead, we queue up commands in our
`Context3D` instance, and execute them all on a call to `present`.
This avoids some nasty wgpu lifetime issues, and is very similar
to the approah we use for normal rendering.

The actual rendering happens on a `Texture`, with dimensions
determined by `createBackBuffer`. During 'Stage' rendering,
we render all of these Stage3D textures *behind* the normal
stage (but in front of the overall stage background color).
2022-11-25 21:43:00 -07:00
Toad06 460458812b avm1: Correct some properties in SWFv4 2022-11-25 20:35:59 -07:00
Aaron Hill 104b2265f2 Fix rebase fallout 2022-11-25 16:08:42 -07:00
Aaron Hill 3bef8c4fd6 render: Remove `get_bitmap_pixels` and store data in `Character::Bitmap`
We only called `get_bitmap_pixels` when creating a `BitmapData`
for an SWF-provided `Bitmap`. We now store the initial pixels
in `Character::Bitmap`, and use them to initialize a `BitmapData`
when needed.

This lets us simplify the wgpu backend, which no longer needs
to store a `Bitmap` object. In addition to saving space for
`BitmapData` objects that lack an SWF `Bitmap`, this will make
it easier to move data from `bitmap_registry` into `BitmapHandle`
itself.
2022-11-25 16:08:42 -07:00
David Wendt 14f27a9e4a docs: Fix up Twips2D doctests 2022-11-23 20:45:37 -07:00
David Wendt a5a6189e61 chore: Remove empty files and outdated references 2022-11-23 20:45:37 -07:00
David Wendt 84b3162a57 chore: cargo fmt & fixes 2022-11-23 20:45:37 -07:00
Mark Richins d345523d02 Fix conflicts 2022-11-23 20:45:37 -07:00
Mark Richins 9941701b3a Fix: change twips_2d to use x and y and fix bug 2022-11-23 20:45:37 -07:00
Mark Richins 63a291ac4b Fix promblems caused by moving Twips 2022-11-23 20:45:37 -07:00
Mark Richins ca6c98785a Rename Twips2d.rs to twips_2d.rs 2022-11-23 20:45:37 -07:00
Mark Richins 331fd09953 Remove struct Twips from types.rs 2022-11-23 20:45:37 -07:00
Mark Richins 53df2bc8f5 add code to Twips2d.rs
TODO: redo comments
2022-11-23 20:45:37 -07:00
Mark Richins db4031ccc5 Create Twips2d.rs
see issue #6973
2022-11-23 20:45:37 -07:00
EmperorBale 7a0f3d5d32 chore: Formatting 2022-11-23 17:28:28 -07:00
EmperorBale e922a118d8 avm2: Improve inlining of stack related functions 2022-11-23 17:28:28 -07:00
EmperorBale c919890a1e chore: Use if/else instead of matching cmp 2022-11-23 17:28:28 -07:00
EmperorBale 657f54b2f1 chore: Cleanup clippy lint 2022-11-23 17:28:28 -07:00
EmperorBale 35219cf592 avm2: `op_get_scope_object` should start at the scope depth. 2022-11-23 17:28:28 -07:00
EmperorBale eb9ce4073e avm2: Clear stack & scope when execution is complete. 2022-11-23 17:28:28 -07:00
EmperorBale 4d151931f8 chore: Improve doc comments 2022-11-23 17:28:28 -07:00
EmperorBale 601f36df33 avm2: Introduce `clear_stack` & `clear_scope`. 2022-11-23 17:28:28 -07:00
EmperorBale 98d3b8f3c1 avm2: Enforce max scope depth & minimum scope depth
when pushing/popping from scope stack.
2022-11-23 17:28:28 -07:00
EmperorBale 7a48014d36 avm2: Enforce max stack & stack depth when pushing/popping from stack 2022-11-23 17:28:28 -07:00
EmperorBale d46b2c39ca avm2: Share scope stack across AVM2 2022-11-23 17:28:28 -07:00
EmperorBale 16805a350b avm2: Store stack information in activations 2022-11-23 17:28:28 -07:00
Moulins c10244b0a4 core: Only unload D.O.s when they are removed from the render list
D.O.s removed by the timeline may only be removed from the depth list
(if they were manipulated by AS3 scripts), but their unload method
would still be called, which is wrong.
2022-11-23 16:44:38 -07:00
Moulins 53010544db core: Simplify core::do::container::Lists bitflags into boolean enum
Callsites only ever used two values, as children in the display list are
always in the render list.
2022-11-23 16:44:38 -07:00
Moulins 58e39623a5 core: Make all ChildContainer's methods private
And also, remove some dead code
2022-11-23 16:44:38 -07:00
Aaron Hill 4b8cd45f4b
avm2: Partially implement StaticText (#8343)
This is linked to the legacy DisplayObject::Text, which can
only be created by Flash CS6 (but is allowed in AVM2 swfs).

The 'StaticText' class cannot be constructed from ActionScript.
To support this, I've added support for native initializers to
playerglobal. This allows us to throw an exception in the
ActionScript constructor in Test.as, and do nothing in the native
intiializer (so that we can construct it from a DisplayObject).

I've left StaticText.text unimplemented for now, since it will require
dealing with Glyphs

Co-authored-by: kmeisthax <dcrkid@yahoo.com>
2022-11-23 18:30:47 -05:00
Moulins 9529a1cbdb avm1: address Scope nitpicks 2022-11-23 15:50:45 -07:00
Moulins 05e3e6434b avm1: Remove all allocations in `Activation::from_nothing`
This is done by:
  - using the global constant pool instead of a fresh empty one:
    - OK, as no call-site is directly executing arbitrary bytecode that
      could care about the contents of the constant pool.
  - pre-allocating the global scope object in the `Avm1` context
  - using the global scope directly instead of allocating a local scope:
    - OK, because no call-site is directly defining locals on the
      returned Activation's scope.
2022-11-23 15:50:45 -07:00
Moulins 5faba34eb2 avm1: remove 'globals' parameter from Activation::from_nothing
Across all invocations, this is always set to the global object so it
can be hard-coded inside the call.
2022-11-23 15:50:45 -07:00
Moulins ea03aa04b8 avm1: make scope references immutable; they were never actually modified
Rewrite Scope::new_target_scope, as the previous approach is unusable
now that Scope doesn't have interior mutability anymore.
2022-11-23 15:50:45 -07:00
Moulins 8cb0b47d1f avm1: make constant pool reference immutable; it was never actually modified 2022-11-23 15:50:45 -07:00
TÖRÖK Attila a9c94513a0 avm2,audio: Implement leftPeak and rightPeak in SoundChannel 2022-11-23 15:38:41 -07:00
michiel2005 50724448c8 Update array.rs 2022-11-23 15:19:07 -07:00
michiel2005 7c5f2805ef Avoid code duplication
Avoided code duplication in avm1 array.rs as asked
2022-11-23 15:19:07 -07:00
Moulins 2fa3d31732 Appease Clippy on nightly 2022-11-23 22:39:45 +01:00
Toad06 eb2ee06588 avm1: Fix `ExternalInterface.call` with blank strings in SWFv8 2022-11-22 16:51:59 -07:00
Aaron Hill bdadb17a95 render: Don't use BitmapHandle in tessellator
Currently, we rely on ShapeTessellator being able to get a BitmapHandle
without a RenderBackend. With the upcoming BitmapData refactor,
we will always need a RenderBackend to get a BitmapHandle, which creates
borrow-checker issues in ShapeTessellator (which is stored in a
RenderBackend).

To solve this, we split BitmapSource.bitmap into two methods -
BitmapSource.bitmap and BitmapSource.bitmap_handle. ShapeTessellator
continues to use BitmapSource.bitmap, and uses the u16 bitmap id
instead of a BitmapHandle. The BitmapSource.bitmap_handle method
is used inside each render backend to convert the id to a BitmapHandle,
avoiding borrow-checker issues.
2022-11-21 21:04:40 -07:00