Commit Graph

205 Commits

Author SHA1 Message Date
dependabot[bot] f4e7f43d1a build(deps): bump bytemuck from 1.12.1 to 1.12.2
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.12.1 to 1.12.2.
- [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.1...v1.12.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-01 00:17:08 +02:00
Aaron Hill 8ae6454337 webgl: Update 'viewport_scale_factor' field
Previously, we were ignoring changes to the scale factor.
2022-10-18 14:00:54 -05:00
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 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 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
relrelb bf0ace0b88 chore: Appease clippy 2022-10-09 13:46:28 +05:45
Tal Hayon 7d27a5acb5 webgl: vertex array, buffer and texture cleanup 2022-10-06 22:19:45 +03:00
relrelb ed9e9c2a83 webgl: Remove dead `u_num_colors`
It wasn't been used since its introduction in fa5c09b0cd.
2022-10-03 22:38:38 +03:00
relrelb b5084eef25 Revert "web: Bump `wasm-bindgen` to 0.2.83"
This reverts commit 1954f6162f.
2022-09-24 09:52:25 +03:00
relrelb 1954f6162f web: Bump `wasm-bindgen` to 0.2.83
This reverts commit cf721d45f9 and restores
commit 084b252030, this time without updating
`web-sys`, due to being coupled to `wgpu`.
2022-09-23 17:23:35 +03:00
Aaron Hill 423d7e4cc4 render: Treat `update_texture` with invalid `BitmapHandle` as an error
This should be impossible to trigger from ActionScript, so
we shouldn't ignore it.
2022-09-16 22:03:15 -06:00
Daniel Jacobs cf721d45f9 Revert "web: Bump `wasm-bindgen` to 0.2.83"
This reverts commit 084b252030.
2022-09-15 22:33:07 +02:00
relrelb 084b252030 web: Bump `wasm-bindgen` to 0.2.83
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.

Due to https://github.com/rustwasm/wasm-bindgen/pull/3031, use the
`serde-wasm-bindgen` crate as a replacement to the deprecated
`JsValue::from_serde` function.
2022-09-14 09:03:31 +03:00
Aaron Hill 1d6b3b6f57 chore: Fix Clippy lints and allow `clippy::bool_to_int_with_if`
In several cases, the current code seems preferable to the
code required by `clippy::bool_to_int_with_if`. Let's suppress
this for now to get the build passing, and decide later if this
is something that we want to enable.
2022-09-11 13:31:46 +02:00
Nathan Adams 267ea0fd13 render: Introduced render commands, moved to a command list model instead of direct rendering 2022-09-11 09:07:53 +02:00
relrelb ca701c4aeb webgl: Remove `Texture` wrapper
`width` and `height` are already stored in `Bitmap`, so simply use
a `WebGlTexture` directly.
2022-09-08 21:04:02 -05:00
relrelb e0aba46bb2 chore: Remove unused `image` dependency
This basically reverts #7254 for all `.toml` files, except for `wgpu`
where it's actually needed on both desktop and web.
2022-09-07 13:09:29 -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
= 211a64b402 webgl: Replace Box<dyn Error> with actual Error enum 2022-08-25 23:43:21 +02:00
= 461c977be0 render: unregister_bitmap is infallible, removed error path 2022-08-25 23:43:21 +02:00
= 03eb769a33 render: Made render use a real Error enum and not generic box<error> 2022-08-25 23:43:21 +02: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 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
Mike Welsh 04c440e860 webgl: Stub out more blend modes 2022-08-18 16:38:17 -07:00
Aaron Hill f7205a02a9 render: Add BlendMode infrastructure and implement BlendMode.ADD
Each render backend keeps track of a stack of BlenModes,
which are pushed and popped by 'core' as we render objects
in the displaay tree. For now, I've just implemented BlendMode.ADD,
which maps directly onto blend mode supported by each backend.

All other blend modes (besides 'NORMAL') will produce a warning
when we try to render using them. This may produce a very large amount
of log output, but it's simpler than emitting each warning only once,
and will help to point developers in the right direction when they
get otherwise inexplicable rendering issues (due to a blend mode
not being implemented).

The wgpu implementation is by far the most complicated, as we need
to construct a `RenderPipeline` for each possible
`(BlendMode, MaskState)`. I haven't been able to find any documentation
about the maximum supported number of (simultaneous) WebGPU render
pipelines - if this becomes an issue, we may need to register them
on-demand when a particular blend mode is requested.
2022-08-18 16:38:17 -07:00
dependabot[bot] 82716d9be3 build(deps): bump bytemuck from 1.11.0 to 1.12.0
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.11.0 to 1.12.0.
- [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.11.0...v1.12.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-16 01:39:03 +03:00
Nathan Adams c4488fc883 render: Removed common_tess and moved tessellator to render 2022-08-14 18:38:14 -07:00
Nathan Adams e1f38b26c0 render: Removed ruffle_core dep from all renderers 2022-08-14 18:38:14 -07:00
Nathan Adams 824b4aa8d1 render: Moved render backend from core to render 2022-08-14 18:38:14 -07:00
Nathan Adams 35082b687f render: Moved shape_utils from core to render 2022-08-14 18:38:14 -07:00
Nathan Adams 91a7047ebb render: Moved Matrix from core to render 2022-08-14 18:38:14 -07:00
Nathan Adams bc0c7cbccb render: Made new render crate, moved Bitmap stuff to it 2022-08-14 18:38:14 -07:00
Mike Welsh 8c4dcf29ee web: Rollback to web-sys 0.3.58 2022-07-30 19:07:39 +02:00
relrelb 79f36964b4 web: Bump wasm-bindgen to 0.2.82
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-07-29 09:40:14 -07:00
relrelb afb9ecc4ab webgl: Avoid zeroing `renderbuffer_{width,height}`
This basically reverts #5737 and #6458 for the WebGL backend, which
regressed a bug where setting the style `display: none;` to a Ruffle
player logged many WebGL warnings to the console. This happened
because `renderbuffer_width` and `renderbuffer_height` were set to zero,
leading to problems when trying to pass them to WebGL APIs.

Avoid such situation by ensuring that `renderbuffer_width` and
`renderbuffer_height` are at least `1`, exactly as done before.
Also add a comment that explains why `.clamp()` isn't used.

Fixes #1264.
2022-07-24 23:37:54 +03:00
dependabot[bot] cfe3d37905 build(deps): bump bytemuck from 1.9.1 to 1.10.0
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.9.1 to 1.10.0.
- [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.9.1...v1.10.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 23:55:22 +03:00
Mike Welsh d3c64d4eb7 webgl/wgpu: Omit strokes when drawing a mask stencil
Adjust `common_tess` to add an additional `mask_index_count` to
draws. This is used to not render strokes when drawing a shape as
a mask stencil.

Fixes #7027.
2022-07-02 16:57:53 -07:00
relrelb 65be2adc63 wgpu: Bump to `0.13.0`
Based on the work in #6717, plus additional adaptions mentioned in
https://github.com/gfx-rs/wgpu/blob/master/CHANGELOG.md#wgpu-013-2022-06-30,
and more not-mentioned but required changes.

Also bump `wasm-bindgen` to `0.2.81` (along with its helper crates), as
required by the new `wgpu` version.

Note that I don't fully understand some of the required changes, notably:
* `wgpu::PresentMode::Mailbox` no longer works on my machine (Windows 11) -
The `wgpu` documentation says that `wgpu::PresentMode::Fifo` is the
only guaranteed to be supported, so I switched over to it instead.
* `self.staging_belt.recall()` doesn't return a `Future` anymore -
I assume it became synchronous so I simply removed the `executor`
from there.
2022-07-02 16:44:37 -07:00
Aaron Hill a79aa08f08
core: Free render backend resources on `BitmapData.dispose`
Currently, all three render backends hold on texture-related
resources indefinitely (`register_bitmap` pushes to a `Vec`,
and never removes anything). As a result, the resources used
by the render backend (which may include GPU memory) will grow
over time, even if the corresponding `BitmapData` has been deallocated.

This commit adds a new `unregister_bitmap` method, which is called from
`BitmapData.dispose`. All render backs are changed to now use an
`FnvHashMap<BitmapHandle, _>` instead of a `Vec`, allowing us to
remove individual entries.

Currently, we only call `unregister_bitmap in response to
`BitmapData.dispose` - when `BitmapData` is freed by the
garbage collector, `unregister_bitmap` is *not* called.
This will be addressed in a future PR.
2022-06-29 15:16:43 -07:00
relrelb 53ef80f514 render: Introduce `RenderBackend::register_bitmap`
Since all `RenderBackend::register_bitmap_*` implementations are
identical now, move them to the default implementation of `RenderBackend`.

Also, turn `RenderBackend::register_bitmap_raw` into `RenderBackend::register_bitmap`,
which accepts a single `Bitmap` parameter.
2022-06-02 15:27:29 -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
TÖRÖK Attila c40c0d7ef9 webgl: Use clamp(x, 0.0, 1.0) instead of saturate(x)
The latter seems to not exist
2022-05-13 09:31:21 -07:00
Mike Welsh edad1569fb webgl: Clamp alpha in shaders (fix #6954) 2022-05-12 14:50:25 -07:00
Mike Welsh 70b7222d20 webgl: Output premultiplied alpha 2022-04-17 08:33:51 -07:00
relrelb eeb5eb18f6 web: Bump wasm-bindgen to 0.2.80
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-04-08 09:56:23 -07:00
dependabot[bot] 1960fc57c3 build(deps): bump bytemuck from 1.9.0 to 1.9.1
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.9.0 to 1.9.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.9.0...v1.9.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-04-04 13:36:47 -07:00
dependabot[bot] 93d2a410a3 build(deps): bump bytemuck from 1.8.0 to 1.9.0
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.8.0 to 1.9.0.
- [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.8.0...v1.9.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-30 11:53:10 -07:00
Mike Welsh ac765bd187 chore: Update copyright
I (Michael R. Welsh) assign to Ruffle LLC all rights, title, and
interest to copyrights of my personal contributions to Ruffle,
effective March 26, 2022.
2022-03-26 18:13:14 -07:00
relrelb 7e3c85b0c1 web: Cleanup `web-sys` features
Remove unused ones, sort them alphabetically and wrap to 120 columns
per line.
2022-03-18 03:57:20 +02:00
relrelb e45810f585 webgl: Avoid clamp assertion
If `gl.drawingBufferWidth` returns `0`, then a `clamp` in
`WebGlRenderBackend::set_viewport_dimensions` hits an assertion that
`1 <= self.gl.drawing_buffer_width()` is `false`. I was able to
reproduce this on Chrome by creating many dummy WebGL contexts until
Ruffle's one is lost, and then resize the Ruffle player, but this may
happen in other cases as well.

Fix this by allowing `renderbuffer_width` and `renderbuffer_height`
to be `0`. From basic testing, this seems harmless.
2022-03-16 13:53:34 +02:00
relrelb 3e51b7d95b webgl: Remove parameters of `build_msaa_buffers`
Use `self.renderbuffer_{width,height}` instead.
2022-03-14 22:17:43 +02:00
relrelb 02812c7878 webgl: Inline `build_matrices` into `set_viewport_dimensions`
And remove the `view_{width,height}` fields, because they're now
used as locals.
2022-03-14 22:17:43 +02:00
relrelb d2bf6302fc webgl: De-duplicate code in `register_bitmap` 2022-03-14 22:17:43 +02:00
dependabot[bot] 697ad92db5 build(deps): bump bytemuck from 1.7.3 to 1.8.0
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.7.3 to 1.8.0.
- [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.7.3...v1.8.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 23:59:40 +02:00
dependabot[bot] c104b24cea build(deps): bump bytemuck from 1.7.2 to 1.7.3
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.7.2 to 1.7.3.
- [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.7.2...v1.7.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-21 08:35:41 +02:00
relrelb 00accf3e2a render: Rename `register_bitmap_jpeg_3` to `register_bitmap_jpeg_3_or_4`
It's actually used by both DefineBitsJpeg3 and DefineBitsJpeg4 tags.
2021-12-04 21:32:16 +02:00
relrelb e2b821e92f chore: Replace `min` + `max` with `clamp`
`clamp` is a bit more efficient, in both runtime and size terms.
2021-11-26 20:54:48 +02:00
Adrian Wielgosik bc82a4f705 build: Bump Rust edition to 2021 2021-10-21 10:24:05 -07:00
relrelb dd42b563ff web: Bump wasm-bindgen to 0.2.78
As usual, also bump its helper crates (`js-sys`, `wasm-bindgen-futures`)
to the latest versions, except for `web-sys` which is locked by wgpu
to 0.3.50.
2021-09-18 21:35:50 +02:00
Giles Cope 42c2b40052 unused deps 2021-09-18 15:28:24 +02:00
relrelb 08b6cf543a web: Guard logs behind a `log_enabled!()` macro
These logs perform somewhat expensive evaluation (crossing the Wasm-
JS boundary). So use the cheaper `log_enabled!()` macro to avoid
evaluation if the relevant log level is not enabled.
2021-09-16 02:56:18 -07:00
Mike Welsh 9978eaa954 chore: Bump to wasm-bindgen 0.2.77 2021-09-10 16:32:14 -07:00
dependabot[bot] 7f2f8a492e chore: Bump png from 0.17.0 to 0.17.1
Bumps [png](https://github.com/image-rs/image-png) from 0.17.0 to 0.17.1.
- [Release notes](https://github.com/image-rs/image-png/releases)
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image-png/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-30 23:27:18 +02:00
relrelb 7be7182eb9 web: Bump wasm-bindgen to 0.2.76
As usual, also bump its helper crates (js-sys, wasm-bindgen-futures)
to the latest versions, except for web-sys which is locked by wgpu
to 0.3.50.
2021-08-21 14:59:26 +02:00
dependabot[bot] 0e408052b1 chore: Bump png from 0.16.8 to 0.17.0
Bumps [png](https://github.com/image-rs/image-png) from 0.16.8 to 0.17.0.
- [Release notes](https://github.com/image-rs/image-png/releases)
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image-png/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-18 09:01:21 +03:00
relrelb 232bb26b7f web: Bump wasm-bindgen to 0.2.75
Also bump its helper crates (js-sys, wasm-bindgen-futures) to the
latest versions, except for web-sys which seems to be locked by wgpu
to 0.3.50.
2021-08-08 16:53:41 +03:00
relrelb 2ba103ac3f web: Bump wasm-bindgen to 0.2.74
Also bump its helper crates (js-sys, wasm-bindgen-futures) to the
latest versions, except for web-sys which seems to be locked by wgpu
to one version before the latest (0.3.50).
2021-07-23 22:17:51 -07:00
relrelb 87e9dda250 chore: Use from_le_bytes in more places 2021-07-09 19:56:52 +03:00
dependabot[bot] 12528e9f4f chore: Bump bytemuck from 1.5.1 to 1.7.0
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.5.1 to 1.7.0.
- [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.5.1...v1.7.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 00:47:13 -07:00
Mike Welsh 554aa7fd63 core: Add backend::render::BitmapSource trait
This interface handles returning a bitmap given an ID and is used
by the render backend to get the bitmap used for a bitmap fill.
This will allow for bitmap fills in the drawing API, as these will
manage their own list of bitmaps.
This also  removes the MovieLibrary dependency from render backends
and will allow for better decoupling in the future.
2021-06-13 20:03:53 -07:00
Mike Welsh d23ea90459 swf: Change Matrix to use Fixed16 for a, b, c, d
Matrices in an SWF file store their scale/skew components in
in 16.16 format (fbits).

Split `ruffle_core::Matrix` and `swf::Matrix`. `swf::Matrix` now
stores its data as `Fixed16` instead of immediately converting to
`f32`.
2021-06-08 14:57:15 -07:00
relrelb f82faf9603 chore: Appease clippy 2021-06-05 10:16:00 -07:00
Mike Welsh 2b98c878f0 swf: Use Fixed in more places 2021-05-30 21:24:03 -07:00
Mike Welsh 0552d26551 core: Use Fixed8 and i16 for ColorTransform
Use the proper types for ColorTransform:
 * Fixed8 (8.8) format for multiplicative component
 * i16 format for additive component

This matches the behavior of Flash (for example, alpha only changes
in units of 1/256).
2021-04-19 15:47:52 -07:00
Mike Welsh bab2701208 web: Bump wasm-bindgen and js-sys versions 2021-04-16 23:37:23 -07:00
relrelb 20d6fcc128 chore: Remove unnecessary type annotations 2021-04-10 18:39:16 -07:00
relrelb 0063f40af9 webgl: Use bytemuck
This avoids unsafe code, and reduces code size a bit.
2021-03-27 01:59:02 -07:00
relrelb 648e14e057 render: Final cleanups 2021-03-23 16:16:35 -07:00
relrelb 947f566b1b webgl: Implement From<TessGradient> for Gradient 2021-03-23 16:16:35 -07:00
relrelb 0017f909a7 webgl: Small cleanup 2021-03-23 16:16:35 -07:00
relrelb e840dce803 common_tess: Make Vertex layout-agnostic
And define a specific layout in webgl instead.
This brings common_tess closer to serve wgpu (which has a different
Vertex layout).
2021-03-23 16:16:35 -07:00
relrelb 7410495a6c web: Fix repeating bitmap textures rendering 2021-03-10 20:48:16 -08:00
Mike Welsh 3099914374 chore: Appease clippy 2021-02-27 16:10:46 -08:00
Mike Welsh e5fb1f09e7 chore: Appease clippy
* #[derive(Collect)] should be before #[collect]
 * Replace redunant `&buf[..]` with `buf`
 * Changes most cases of UPPERCase to UpperCase
 * Allow upper_case_acronym on most SWF types, as they are from
   SWF spec/more annoying to change.
2021-02-12 06:32:42 -08:00
Mike Welsh 48e1afc054 webgl: Use highp precision when available
Fixes issues relating to text rendering (#900) and other artifacts
on iOS.
2021-02-02 16:14:15 -08:00
dependabot-preview[bot] 6f14490f84 build(deps): bump jpeg-decoder from 0.1.21 to 0.1.22
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.21 to 0.1.22.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases)
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.1.21...v0.1.22)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-29 11:42:19 -08:00
Mike Welsh 44bfd46bf9 chore: Lock wasm-bindgen and wasm-bindgen-cli to 0.2.69 2021-01-25 12:27:21 -08:00
dependabot-preview[bot] 239ccb3511 build(deps): bump jpeg-decoder from 0.1.20 to 0.1.21
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.20 to 0.1.21.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases)
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/image-rs/jpeg-decoder/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 11:52:39 -08:00
Mike Welsh 09a48a71d8 render: Avoid asserts in masking state
Switch to debug_assert! instead of assert! in mask checks to avoid
panicking (#1347). This will render incorrectly and still needs
to be fixed, but we should fail gracefully and avoid killing the
entire player.
2021-01-14 14:18:14 -08:00
Mike Welsh 03b5edd4d1 render: Remove RenderBackend::draw_letterbox
Move letterbox draw logic to `Player`, using renderer.draw_rect
2021-01-07 11:46:07 -08:00
Mike Welsh 8d1d2efea4 webgl: Request OES_element_index_uint extension on WebGL1
Needed to support u32 index buffers.
2021-01-06 13:24:10 -08:00
Mike Welsh 0754f0a3b3 render: Use u32 indices 2021-01-04 18:08:14 -08:00
Mike Welsh 8cdf04384c webgl: Use mult color for draw_rect (fix #2189) 2020-12-31 15:20:37 -08:00
Mike Welsh 9b6295f33a render: Pass library to RenderBackend::register_shape (fix #2037)
Pass the movie library to `register_shape` methods so that bitmap
charcter IDs can be resolved immediately on the proper SWF.

This fixes #2037, which cause incorrect bitmaps to be used when
multiple movies were loaded.
2020-12-31 13:10:21 -08:00
Mike Welsh 3ff6a37ff4 webgl: Make separate VAO for color quad vs. bitmap quad (fix #1834) 2020-12-27 23:01:24 -08:00
Mike Welsh 99cfdd4ea7 render: Avoid excessive clones in register_bitmap calls 2020-12-15 00:04:51 -08:00
Mike Welsh 369c5bda56 render: Implement Bitmap smoothing property 2020-12-15 00:04:51 -08:00
Mike Welsh 69216b75fb webgl: Don't recreate texture on update 2020-12-15 00:04:51 -08:00