Nathan Adams
f7da335083
avm2: Renamed as_bitmap_data_wrapper into as_bitmap_data
2023-04-03 18:25:20 +02:00
Nathan Adams
1521c7b6ee
avm2: Removed Object::as_bitmap_data() as it's no longer used (or recommended to use)
2023-04-03 18:25:20 +02:00
Nathan Adams
b1f7fecacb
avm2: Don't sync in new Bitmap(x)
2023-04-03 18:25:20 +02:00
Nathan Adams
444e256708
avm2: Made Bitmap.bitmapData not recreate a new BitmapDataWrapper every time its called
2023-04-03 18:25:20 +02:00
Tom Schuster
b0576c2155
avm2: Improve the Sound::extract stub
2023-04-03 00:22:23 -07:00
onkrot
d047ecb130
avm2: Add X509 certificate classes
2023-04-02 23:59:37 -07:00
renovate[bot]
cd3ad90d61
chore(deps): lock file maintenance rust dependencies
2023-04-02 22:00:49 -07:00
Lord-McSweeney
d1b8ec7a7e
avm2: Stub Shader
2023-04-02 19:56:14 -07:00
Lord-McSweeney
c19031a6fc
avm2: Stub ShaderData
2023-04-02 19:56:14 -07:00
Aaron Hill
a2fa362091
wgpu: Implement double buffering for Context3D
...
This matches the Context3D docs. Calling 'present' swaps
the buffers.
I wasn't certain if we actually need a double-buffered depth
texture, but I included one just to be safe.
2023-04-02 19:24:23 -07:00
Aaron Hill
671ebdfa8f
wgpu: Execute Context3D commands immediately
...
Now that most of the complicated Context3D methods have been
implemented, we can simplify the overall design. Instead of queueing
up commands and having `present` execute them in a loop, we
can execute each command immediately. The key insight is that
a `RenderPass` is only needed for `DrawTriangles`, so we don't
have to store it in `Context3D` and deal with complicated lifetime
issues.
The old behavior gave us implicit double-buffering behavior,
since nothing would get rendered until a 'present' call.
Now that a 'drawTriangles' call will immediately submit
a draw command, we need to implement actual double buffering.
This is done in the next commit.
2023-04-02 19:24:23 -07:00
Moulins
9441182b7d
avm2: move event dispatch error handling in a single place
...
The `Avm2::{dispatch, broadcast}_event` methods now log and swallow any
AVM2 error occuring during the dispatch, instead of repeating the
handling code for each caller.
This also introduces some behavioral changes:
- Errors messages are more consistent;
- For consistency with `broadcast_event`, `dispatch_event` panics if
given a non-event object to dispatch.
2023-04-02 16:52:42 -07:00
Udeshya
34775965ea
avm2: Implement `Transform.pixelBounds`
2023-04-02 23:25:10 +00:00
AllinolCP
f0a8e50be1
avm2: implement decodeURI
2023-04-02 14:49:07 -07:00
Tom Schuster
5a18a409f7
avm2: Only reject a single explicit namespace in XML
2023-04-02 16:09:03 -05:00
Toad06
35528913bf
core: Make `ExternalInterface` support undefined values
2023-04-02 13:48:14 -07:00
Toad06
5e14aabed6
core: Make `ExternalInterface` support undefined values in browsers
2023-04-02 13:48:14 -07:00
Lord-McSweeney
4777c13528
avm2: ByteArray should have toJSON defined on...
...
...its prototype.
2023-04-01 17:17:48 -07:00
Lord-McSweeney
58cbc38983
avm2: Use RegExp.valueOf in RegExp.toString
...
This fixes flag ordering issues
2023-04-01 13:49:41 -07:00
Lord-McSweeney
17ebb8c5bc
avm2: Add RegExp.prototype.toString
2023-04-01 13:49:41 -07:00
Lord-McSweeney
ab6d5006b4
avm2: Make sure RegExp prototype is not enumerable
2023-04-01 13:49:41 -07:00
Lord-McSweeney
18bff18d0b
avm2: Fix QName's prototype
2023-04-01 13:49:41 -07:00
Tom Schuster
86395f194f
avm2: Strip BOM in ByteArray::toString
2023-04-01 12:48:22 -07:00
Aaron Hill
6ce6fd1681
avm2: Use custom_unescape wherever we unescape XML
...
When we were using a fork of quick-xml, we modified the actual
unescape method. Now that we're using the crates.io release again,
we need to go through our `custom_unescape` function.
2023-04-01 02:25:24 -05:00
Aaron Hill
18f5ba18e9
core: Don't overwrite font descriptor with a duplicate
...
If a SWF contains multiple DefineFont tags with the same
font name (but different font IDs), the first tag will win
when a font is looked up by *name*. This affects the behavior
of EditText objects, which can have embedded HTML like
`<font face="MyFontName">` which performs a font lookup by name.
This fixes Fancy Pants World 4 Part 3, which contains two
DefineFont3 tags with the name FancyFont. The second font is
missing many glyphs, so using it causes us to be unable to
render the squiggle and life count text.
2023-03-31 22:47:00 -07:00
Mike Welsh
4c13da8fcb
avm2: Unstub `BitmapData.lock` and `BitmapData.unlock`
...
These functions are intentionally no-ops in Ruffle because it has
no concept of a player dirty region, so unmark them as stubs.
The only observable difference is that Flash Player will sometimes
not re-render a `Bitmap` instance on the stage immediately if it's
`BitmapData` is locked and changed, but this is only temporary and
depends on the redraw behavior of the Flash Player.
2023-03-31 22:13:28 -07:00
Nathan Adams
1c6aaba57a
core: Use actual clone() method when cloning bitmap
2023-03-31 21:56:41 -07:00
Nathan Adams
62d30251f2
core: Move clone to bitmapdata operations
2023-03-31 21:56:41 -07:00
Nathan Adams
b07bf84da5
core: Skip a gpu->cpu sync in set_pixels_from_byte_array if we're filling the whole bmd
2023-03-31 21:32:15 -07:00
Nathan Adams
fcaf462423
core: Fix set_pixels_from_byte_array respecting the bytearray position + tests
2023-03-31 21:32:15 -07:00
Nathan Adams
445912e760
core: Move set_pixels_from_byte_array out from avm2 to bmd operations
2023-03-31 21:32:15 -07:00
Aaron Hill
7f6cb99b08
avm2: Convert QName to ActionScript
2023-03-31 22:05:18 -05:00
Aaron Hill
27092ecb76
avm2: Convert RegExp to ActionScript
2023-03-31 17:08:21 -07:00
Mike Welsh
b62040884c
core: Make `DisplayObject::global_to_local` fallible
...
* `global_to_local` returns `None` if the object has zero scale.
* Adjust AVM `globalToLocal` methods to return the untransformed
point on failure.
* Add `DisplayObject::mouse_to_local` to handle AVM `mouseX`
and `mouseY` coordinates. For zero scale objects, these end up
returning values based on the twips-to-pixels scale,
divided by 20.
2023-03-31 16:26:11 -07:00
Mike Welsh
664b168d3d
core: Make `DisplayObject::global_to_local_matrix` fallible
...
This will return `None` if the object is zero scale, and callers
can handle this appropriately.
2023-03-31 16:26:11 -07:00
Mike Welsh
54b7094c16
render: Make `Matrix::inverse` fallible
...
* Add `Matrix::determinant`.
* Rename `Matrix::invert` to `inverse`.
* `Matrix::inverse` return an `Option`, with `None` returned
for non-invertible matrices.
* AMV `Matrix::invert` duplicates the code as the behavior is
different (works in f64 and not twips, etc.)
2023-03-31 16:26:11 -07:00
Nathan Adams
6f7493f16a
avm2: Don't sync BitmapData when getting .rect
2023-03-31 21:07:38 +02:00
Nathan Adams
c51ba098f6
render: Rename PixelRegion's (min|max)_(x|y) to (x|y)_(min|max)
2023-03-31 16:57:52 +02:00
Nathan Adams
cfb18718a1
core: Remove debug output
2023-03-31 16:57:52 +02:00
Nathan Adams
fd702dabcc
core: Remove disposed checks from operations, it's responsibility of avm1 and avm2 to handle it their own way
2023-03-31 16:57:52 +02:00
Nathan Adams
66e2eb77e5
core: Rename bitmap_data_operations to just operations
2023-03-31 16:57:52 +02:00
Nathan Adams
94e5aa8f34
core: Fix calculating dirty area of BitmapData.draw() with rotation
2023-03-31 16:57:52 +02:00
Nathan Adams
c85910b46d
wgpu: Fixed panic when rendering texture to itself, by always rendering to an intermediary
2023-03-31 16:57:52 +02:00
Nathan Adams
68343369a3
core: Don't sync cpu->gpu in overwrite_cpu_pixels_from_gpu
2023-03-31 16:57:52 +02:00
Nathan Adams
cae8f89c9b
core: Remove clone from copy_pixels_with_alpha_source and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
d7b0a6f611
core: Remove clone from copy_pixels and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
f5501b57da
core: Remove clone from merge and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
44c35a5b50
core: Made palette_map not sync if copying outside of dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
b1b3eef283
core: Remove clone from threshold and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
2b84e926ec
core: Remove clone from copy_channel and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
966f5bc816
core: Skip bitmapdata.draw which will affect 0 pixels
2023-03-31 16:57:52 +02:00
Nathan Adams
e6d36ade7f
core: Make get_pixels_as_byte_array not sync if the pixel is outside a dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
fd0ba4a753
core: Make get_vector not sync if the pixel is outside a dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
864ee1c6df
core: Make hit test methods not sync if the pixel is outside a dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
8fc1b0d48e
core: Make get_pixel and get_pixel32 not sync if the pixel is outside a dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
e1f76bf135
core: Use map instead of and_then for MovieLibrarySource::bitmap_handle
2023-03-31 16:57:52 +02:00
Nathan Adams
b035c7f24e
core: noise and perlin_noise shouldn't perform a gpu->cpu sync
2023-03-31 16:57:52 +02:00
Nathan Adams
2b483a5953
core: Ensure MovieLibrarySource::bitmap_handle updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
d44bdc16a8
avm2: Ensure Graphics.lineBitmapStyle updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
7e2382d804
avm2: Ensure DisplacementMapFilter.mapBitmap updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
29ad46daf5
avm1: Ensure MovieClip.beginBitmapFill updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
c364deb545
avm2: Ensure Graphics.beginBitmapFill updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
9e5c56fc4f
core: BitmapData.transparent (in both avm1 and 2) shouldn't sync the whole bmd
2023-03-31 16:57:52 +02:00
Nathan Adams
e62e05cd09
core: Move get_pixels from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
89c2fc841e
core: Move get_vector from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
e4caedcc12
core: Move draw from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
57648b6380
core: Move apply_filter from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
8bb02c38c0
core: Move copy_pixels from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
eb04738b73
core: Move set_pixel from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
a41a797b4a
core: Move merge from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
60a157224f
core: Move color_bounds_rect from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
62b90c6c8e
core: Move hit test methods from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
2c65f23eb8
core: Move compare from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
8a0cb4685e
core: Move palette_map from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
b1b0394101
core: Move scroll from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
4510eb305b
core: Move threshold from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
f476968693
core: Move color_transform from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
43716bbdc7
core: Move copy_channel from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
ea6fb1a3d4
core: Move perlin_noise from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
ffe6828e9c
core: Move noise from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
285122a1fa
core: Move flood_fill from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
c2af7b92c0
core: Move get_pixel from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
758d8f1492
core: Move get_pixel32 from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
31f46c6acf
core: Move set_pixel32 from BitmapData to bitmap_data_operations, fixed set_pixels to no longer use it
2023-03-31 16:57:52 +02:00
Nathan Adams
1024fc8be5
core: Optimise fill_rect when replacing entire region after a draw call
2023-03-31 16:57:52 +02:00
Nathan Adams
e614265c17
core: Move fill_rect from BitmapData to bitmap_data_operations, fixed a bug when using non-standard values, and added better tests for fill_rect showing the bug
2023-03-31 16:57:52 +02:00
Nathan Adams
033ab34c14
core: Extract bitmap_data_operations for common avm operations
2023-03-31 16:57:52 +02:00
Nathan Adams
311a165149
wgpu: Reintroduce texture promoting; only preassign buffer when the texture is frequently written/&read
2023-03-31 16:57:52 +02:00
Nathan Adams
579f046122
core: Don't mark anything dirty in an invalid drawRect call
2023-03-31 16:57:52 +02:00
Nathan Adams
68c87c7485
core: When drawing display objects to bitmapdatas, use their minimum bounds
2023-03-31 16:57:52 +02:00
Nathan Adams
6e859891af
render: Take in dirty region in update_texture, only upload those pixels
2023-03-31 16:57:52 +02:00
Nathan Adams
137593b6a6
render: Extract (u32, u32, u32, u32) to PixelRegion
2023-03-31 16:57:52 +02:00
Nathan Adams
e0bd911f2f
render: Only copy a possible dirty area for bitmapdata.draw & read
2023-03-31 16:57:52 +02:00
Gleb Piskunov
ed282f016b
avm1: Exclude __proto__ prop from object props enumeration
...
---------
Co-authored-by: Gleb Piskunov <emgfc@ya.ru>
2023-03-31 10:14:33 +00:00
Toad06
c81460beb0
avm1: Support strings in `MovieClip.setMask(str)`
2023-03-31 02:39:39 -07:00
Tom Schuster
8a8071e6d5
avm2: Stub XMLNode.nodeName setter and XMLNode.appendChild
2023-03-31 00:11:52 -07:00
Tom Schuster
ce4ddee792
avm2: Shim flash.xml.XMLNode using XML
2023-03-31 00:11:52 -07:00
Aaron Hill
3e97f0e223
core: Update to latest quick-xml
...
I've moved our special entity handling logic into
a `custom_unescape` function. This lets us move off
of our fork of `quick-xml` back onto the crates.io release
2023-03-30 22:25:24 -07:00
Gleb Piskunov
b18d3a2645
avm2: Add AS3 implementation of BitmapData.paletteMap ( #10344 )
...
Co-authored-by: Gleb Piskunov <emgfc@ya.ru>
2023-03-30 17:39:05 +00:00
relrelb
236a97bf31
render: Replace `ColorTransform` with `swf::ColorTransform`
2023-03-29 23:27:20 -07:00