We've now had two different bug reports involving Adobe AIR
SWFs, so I'm going to go ahead and start adding a framework
for AIR support.
This commit just adds a command-line option
`--player-runtime <flash-player|air>` (defaulting to `flash-player`),
and passes it along to the `Player`. The actual value is currently
unused - in a follow-up PR, I'm going to implement namespace versioning
for AIR.
This more closely aligns our code with the corresponding avmplus code.
A user-supplied index of '0' is special-cased, and we correctly
resume iteration when a public index mismatch is detected.
This ensures that this flag is set regardless of whether the
object is constructed by the timeline or from ActionScript
(it was previously only set when constructed by the timeline).
* core: Fix MorphShape inaccuracy on complex paths
It's inaccurate to interpolate the moveTo/lineTo deltas individually
because on complex paths they're often small integers, which won't
interpolate smoothly.
Instead, interpolate absolute positions.
This ensures that a re-entrant 'construct_frame' call (e.g. due
to a goto or AVM2 button) does not end up marking a MovieClip as
initialized too early.
This issue was causing us to run 'fire_init_and_complete_events' too
early, firing Loader events before we had actually finished (and
before the SWF had registered the relevant listeners).
Avmplus constructs a full `QName`, and uses the normal
Multiname matching logic. This would be a large refactor,
so I've just modified the existing method to properly
handle multiple namespaces.
I've also included a closely related fix - we should only treat
a multiname with the literal local name "@foo" as an attribute
when the namespace is the empty public namespace. We were incorrectly
reparsing multinames that contained multiple namespaces.
This preserves object identity across a serialization
round-trip. Unfortunately, we don't currently implement this
correctly in flash_lso, so I've added a stub message.
Once flash_lso is fixed, this code will start working. For now,
it just allows us to detect (via the stub) if this is actually
used by an SWF.
An Avm2 button appears to run a 'nested frame' during construction -
the same type of 'nested frame' performed by a goto. This will
run framescripts for all objects in the display hierarchy (including
orphans), resulting in an unusual child->parent framescript execution
order that DeathVsMonstars_decrypted.swf depends on.
This is a better default than using the lowest possible version,
as it allows things like AMF deserialization to see all properties
on the target object.
This only affects explicit Ruffle-side property setting - interpreted
code will continue to use the namespace version determined by the
SWF version.
This allows us to hide things like `MovieClip.isPlaying` from older
SWFs, which may define an `isPlaying` method without marking it
as an override.
This has the largest impact on public namespaces. There is no longer
just one public namespace - we now have a public namespace per API
version. Most callsites should use `Avm2.find_public_namespace()`,
which determines the public namespace based on the root SWF API version.
This ensures that explicit property access in Ruffle (e.g. calling
"toString") are able to see things defined in the user SWF.
This requires several changes other:
* A new `ApiVersion` enum is introduced, storing all of the api versions
defined in avmplus
* NamespaceData::Namespace now holds an `ApiVersion`. When we read a
namespace from a user-defined ABC file, we use the `ApiVersion` from
the root movie clip. This matches Flash Player's behavior - when a
child SWF is loaded through `Loader`, its API version gets overwritten
with the parent's API version, which affects definition visibility and
'override' requirements in the child SWF. Note that 'behavior changes'
in methods like `gotoAndPlay` are unaffected.
* The `PartialEq` impl for `Namespace` has been removed - each call site must now choose
to compare namespaces either by an exact version match, or by
'compatible' versions (a `<=` check) with `Namespace::matches_ns`
* `PropertyMap` now uses `Namespace::matches_ns` to check for a
compatible version when looking up a definition.
* When compiling our playerglobal, we pass in the `-apiversioning` flag,
which causes asc.jar to convert `[API]` metadata into a special
Unicode 'version mark' suffix in namespace URLs. We parse this
when loading namespaces to determine the API version to use for
playerglobal definitions (unmarked definitions use the lowest possible
version).
Unfortunately, this makes ffdec unable to decompile our
playerglobal.swc
I've going to file an upstream issue
The previous method, which used `coerce_to_string`, calls `toString` on the object,
which has special handling for simple content, which is not used here.
When a UTF-16 BOM is present, ByteArray.toString automatically
strips it out, and treats the remaining data as a UTF-16 string
with the specified endianness.
* avm2: Use RawTable to implement 'public index' iteration
This makes our implementation more closely aligned with avmplus.
In particular, it's now possible to delete keys from an object
while iterating without disturbing the iteration order (as long
as those keys were already produced by the iterator).
This is based on @Bale001's work on RawTable-based iteration
A few tests had their output changed (they depend on the exact
object iteration order, and don't neccessarily match Flash Player
exactly).
* Use Cell to store index fields
* Remove outdated comment
This is our first non-rgba texture format (it uses Bc3RgbaUnorm).
ATF files store these textures in a very convoluted way - fortunately,
the 'dds2atf' tool is open-source, which allowed me to figure out
how to decode the texture back to a DXT5/DXT1 texture.
Some SWFs rely on catching the error.
In order to reproduce Flash's error messages, we now store a `QName`
in `FunctionObject`, which is set when we make a bound method.
Normally, Flash Player will ignores frames for a movie clip with
a symbol class that doesn't extend `MovieClip` (e.g. it extends
`Sprite`). However, the root movie appears to have frame run
unconditionally, even if it only extends `Sprite`. This can
be observed by adding a Graphics child in the second frame only -
the child will flicker in and out as the player switches between
frames, but only for the root movie clip.
Seedling relies on this behavior - it has `DoAbc2` tags in the second
frame, and has a main `Preloader` class that extends `Sprite`.
Our list of 'playing' streams is now a list of 'active' streams. This nomenclature change also indicates a rule change: streams are activated whenever there is work for them to do, and they are only ever deactivated by themselves when they're out of work to do. We no longer deactivate streams when they are paused as they may still have a queued seek to process.
Unfortunately, the OpenFL implementation has a TODO
noting that their implementation doesn't match Flash,
so getting this to work will require figuring out
how Flash does things.
We previously ran these tags during preloading - however,
they are actually run as part of frame execution. This is observable
by ActionScript - a SWF can load in a class from a stop()'d MoveClip,
and then advance the clip to a frame with a SymbolClass referencing
the loaded class.
This fixes 'who_killed_travolta', and unblocks DeathvsMonstars and
NeoPets Lost City Lanes once some additional button fixes are merged.
This isn't 100% correct (as shown by the disabled test), but it brings
us closer to what Flash Player does.
* avm2: Add error 1087
* avm2: Add deep_copy method to XmlObject
Changes existing AS3 copy method to use this instead
* avm2: Add a few utility methods to E4XNode
* avm2: Change XML.replace impl to use new utility methods
* avm2: allow setting XML/XMLList as a element
* avm2: Fix `xml_namespaced_property` test failure
* chore: fmt
* chore: Appease clippy
* avm2: Add test for XML/XMLList as element
* avm2/tests: Implement XML.setName; add a test
* avm2: Basic support for QNames in XML.setName (no namespace support yet)
* avm2: Reorder order of Attribute/Element/PI checks in XML.setName
* avm2: Throw error #1117 when the name passed to XML.setName is not a valid XML name
Previously, the volume transformation to adapt the volume for
logarithmic hearing has been performed in the VolumeControls Rust struct
and TypeScript class each.
Since this calculation is the same on desktop and web and should be
implemented in the audio backend, it has been moved into the
AudioMixer::mix_audio method.
The VolumeControls struct and class now only calculate the linear volume
out of the checkbox and the slider.
Player::set_volume and Player::volume now don't take and return the
adapted volume, but use the linear volume (which gets saved internally).
Some SWFS (in particular, anything using Unity) call
avmplus.describeTypeJSON, and rely on the behavior of the various
flags.
This PR changes our internal implementation to implement
describeTypeJSON (producing an `Object` with dynamic fields).
We then convert this to XML in `describeType`, using an implementation
inspired by avmplus.
The existing describeType tests are passing - in a follow-up PR,
I'll add tests for describeTypeJSON
SetTarget currently sets the target clip to the base clip if the
target passed to tellTarget() is an undefined object. This causes
goto's to run on the base clip in Ruffle, when Adobe Flash Player
does not run the goto's at all.
Fixes#12389 and #12390
`Loader` override `removeChild` and `removeChildAt` to try to prevent
user code from removing the loaded content child. However, this can be
bypassed by calling `otherContainer.addChild(loader.content)`, which
actually removes the child from the loader. Stealth Hunter 2 relies
on this behavior.
To make this work, `Loader.content` needs to go through
`contentLoaderInfo`, instead of relying on a child being present.
This also removes `append_substream` since `Substream` now handles that internally.
This requires duplicating a huge chunk of the decoder code to work with `Buffer` types instead of `SwfMovie` types. Eventually we'll want to wipe out all the SWF-specific stuff and use `Buffer` exclusively.
* `start_substream` plays audio data from a `Substream`, giving back a `SoundInstanceHandle` that can be manipulated the same way as the one from `start_stream`
* `append_substream` adds more data to an already playing `Substream` backed `SoundInstance`. In the event that a sound has finished playing, `append_substream` will fail, and you have to start a new sound stream.
This is ultimately intended to replace the current streaming audio setup, which is SWF-specific and has a number of unused parameters. It is also designed to support progressive download in the future.
We also include stub impls for `NullAudioBackend`.
A `Substream` can be read in one of two ways:
* Converting it to an iterator that yields individual chunks of the substream in `Slice` form.
* Converting it to a `SubstreamCursor`, which implements `Read` for bytewise read access.
Chunk-based reading is intended for code that needs to know about chunk boundaries. Self-terminating chunk formats should be read with the cursor type.
This is ultimately intended to replace `Vec<u8>` in both `SwfMovie` and `NetStream`, but for the time being we only apply this to streams. SWF-related types are deeply embedded elsewhere and the changes to slice dereferencing will be quite invasive.
We also remove some unnecessary reader drops in `NetStream.tick` at the same time.
avm1_unload_movie has been adapted to only enter the unloaded state with
one frame delay if the MovieClip is a root MovieClip. The unloaded state
is now immediately entered for non-root MovieClips.
This fixes the regressions #12254 and #12265 which got introduced
because of this delay.
However, in Flash Player, even non-root MovieClips enter the unloaded
state one frame after the unloadMovie command has been read. Ruffle is
probably replacing a MovieClip differently to Flash, therefore
introducing these regressions when trying to emulate that delay.
Documentation explaining this all has been added to avm1_unload_movie.
Therefore, the test movieclip_library_state_values has been added. It
tests the default state and the unloaded state of a (non-root) child
MovieClip that's loaded from the library. It is marked as known_failure
because Ruffle currently doesn't implement the delay before entering the
unloaded state for non-root MovieClips.
The method MovieClip::replace_with_movie accepts an
Option<Arc<SwfMovie>>. If no movie is given, an empty stub movie is
generated and used.
Previously, the IS_ROOT flag has been set for the new replaced SwfMovie,
depending on whether a movie was given to the method or not.
However, there are cases where an explicitely given movie should not be
set as a root movie (e.g. if a specific empty stub movie is given to the
method). Conversely, there are also cases where no movie is given, but
the stub movie should still be set as a root movie (e.g. in specific
MovieClip states).
Therefore, an is_root parameter has been added to the method. This
explicit parameter is now used to set the flag for the new replaced
SwfMovie.
All calls of replace_with_movie have been adapted to use the new
parameter correctly.
Previously, a MovieUnloader has been kept in the LoadManager, even after
the movie has been unloaded.
This has been fixed. A remove_loader method has been added to the
LoadManager. It is now called in the avm1_unload_movie method; every
MovieUnloader will be removed after the unloaded state has been entered.
The documentation about loaders has been improved and fixed in multiple
places, clarifying how loaders are removed.
Clears the read and write buffer of Socket before returning to ActionScript, this could potentially be problematic
when a SWF reuses the same Socket to connect.
Also remove the handle from Arena when server closes the connection, this fixes
connected still returning true after server disconnection.
Some of the tests are currently disabled because (separate from this PR)
we can't actually run `toString()` on a Vector.<Object>, due to our
broken vector handling.
* avm2+tests: Allow setting prototype to undefined
This is used internally by Adobe Flex in many places. Also add test.
* avm2: Set prototype when constructing a Function with null prototype
* tests: Expand prototype_set_null test
* chore: fmt
The special meta key `defaultValue` should be used to set
the default `value` field. Also, `index` is the position
within *just* the image or texture params, not within
all of the params.
This adds a way to modify socket behavior to restrict, ask, or allow all
connections. Also adds a whitelist which can be used to allow specific hosts
without enabiling ask or allow all behaviors.
Use ProgressEvent for socketData event instead of a bare event.
Remove unwraps and use correct errors/exceptions.
Correct name in make_error_2008 call.
Use expect() for getting ByteArray instead of an error.
Correct some get_*() calls
Interfaces should only be listed when calling describeType
with a class instance (not with a `Class` object).
Additionally, AS3 methods can actually be displayed under
some circumstances. This is due to weird legacy behavior
that avmplus implements. A full fix requirs us to implement
namespace versioning, but we can get closer by special-casing
playerglobals (which is special-cased by namespace versioning
anyway).
The 'DisplayObject.visible' flag seems to be ignored for mask objects
(and their descendants) - mouse picking still takes them into account,
and they get rendered as part of the mask.
This commit changes display object rendering and AVM2 mouse picking
to ignore DisplayObject.visibility when dealing with mask objects/
descendants.
The variable use_new_invalid_bounds has been moved from the
UpdateContext and the Player to the Avm1 struct because it is only used
for AVM1 code. A getter method and an activator method setting it to
true have been added as well.
The get_bounds function, which uses the variable, has been adapted to
use the getter and the activator.
Additionally, documentation has been added and improved.
The MovieClip now contains documentation about all MovieClip states and
the use_new_invalid_bounds documentation has been extended to explain
the logic of how the variable is set and used.
The MovieClip variable oldest_parent_swf_version and its getter method
have been removed because they were unnecessary, as the UpdateContext
already provides the root movie.
The call of the getter method has been replaced by
activation.context.swf.version().
The suggested changes in the feedback to the pull request have been
implemented.
Therefore, this commit consists of multiple smaller changes:
- The unload_movie method has been renamed to avm1_unload_movie.
- The movieclip_default_state test now doesn't test
getTextSnapshot().getCount() because the underlying methods haven't
been implemented in AVM1 yet.
This should be reverted when they have been implemented or stubbed in
AVM1.
An unload_movie method has been added to the MovieClip. It unloads the
MovieClip, which means that one frame after it has been called,
avm1_unload and the new transform_to_unloaded_state method get called
and the MovieClip enters the unloaded state in which some attributes
have certain values.
To do this, it creates and spawns a future which calls avm1_unload and
transform_to_unloaded_state (which actually makes the MovieClip enter
the unloaded state).
It uses the new MovieUnloader (which has been added to the Loader enum)
to pass the MovieClip to the asynchronous code. The MovieUnloader saves
a handle and the target clip, and the asynchronous code retrieves it
from the LoadManager.
unload_movie is now called when a MovieClip should be unloaded.
TODOs have been added, describing to check whether other avm1_unload
calls also need to be delayed by one frame and whether unload_movie also
needs to be called in other places.
Additionally, a spelling mistake has been corrected.
Previously, the MovieClip default state contained wrong values for
opaqueBackground, transform.pixelBounds and getRect & getBounds with
another default MovieClip as the parameter.
This has been corrected; the calculation of these values has been fixed.
To do that, a use_new_invalid_bounds_value variable has been added to
the UpdateContext and the Player (from which the UpdateContext is
created).
Additionally, an oldest_parent_swf_version variable has been added to
the MovieClip with a getter method for it. It is calculated and saved on
demand in the getter.
These variables are retrieved in the get_bounds function and used to set
use_new_invalid_bounds_value and to calculate the correct bounds.
Ruffle now uses the correct MovieClip default state.
The set_cur_preload_frame and set_current_frame methods have been added
to the MovieClip.
If the Loader now loads an image, these methods are called to set the
MovieClip image state correctly.
Additionally, load_error_swf now uses set_cur_preload_frame instead of
the removed movie_not_available method.
A load_initial_loading_swf function has been added to the Loader. It
makes the MovieClip enter the initial loading state in which some
attributes have certain initial loading values to signal that the file
is currently being loaded and neither an error has occurred nor the
first frame has been successfully loaded yet.
The Loader calls the function when initialising the loading before it
gets an error or success.
Additionally, load_error_swf has been improved: If a local URL is
fetched on a WASM target, the _url property will now be correctly set as
in the flash player.
The documentation has been improved.
All NavigatorBackend implementations have been refactored, resulting in
improved code quality, less duplicated code, more consistent and easier
to understand procedures, additional error handling and better error
messages.
A resolve_url method has been added to the NavigatorBackend trait. It
takes a URL and and resolves it to the actual URL from which a file can
be fetched (including handling of relative links and pre-processing). It
has been implemented in each NavigatorBackend implementation.
Duplicated code has been put into new public functions in
core/src/backend/navigator.rs which are called by all NavigatorBackend
implementations.
ExternalNavigatorBackend:
- The navigate_to_url and fetch methods have been adapted to use
resolve_url, removing redundant code.
- Error handling has been added in case that the URL can't be converted
to a PathBuf.
- A TODO about differences between the flash player fetch and the
Ruffle fetch implementation has been added.
WebNavigatorBackend:
- The previous resolve_url method exclusively to the WebNavigatorBackend
has been replaced by the new resolve_url method. It is used by
navigate_to_url and fetch.
- resolve_url now always pre-processes the URL if it's valid (even if no
base_url exists) and explicitly returns whether the URL can be parsed.
- navigate_to_url now traces an explanatory error each if the URL can't
be parsed or is local.
- fetch now returns an explanatory error each if the URL can't be parsed
or is local (previously, a vague "Got JS error" has been returned).
TestNavigatorBackend & NullNavigatorBackend:
- fetch pre-processes the URL now (using the resolve_url implementation).
- If the URL isn't local, an explanatory error is returned (previously,
it was just an "Invalid URL" error).
- If the URL can't be parsed, an explanatory error with the reason is
returned (previously, it was just an "Invalid URL" error).
Additionally, error messages in all NavigatorBackend implementations
have been improved and made more consistent, e.g. if a local file can't
be read.
Previously, the MovieClip error state contained one TODO in order to be
completely implemented: The HeaderExt variable uncompressed_len needs to
be -1 in the error state, but its type has been u32.
The type has now been changed to i32, and the variable is set to -1 in
the default_error_header function. Therefore, the MovieClip error state
is now fully implemented.
Other connected functions and variables like SwfMovie::uncompressed_len
or MovieClip::total_bytes have been adjusted to this type change. Code
has been adjusted if needed where this value is used.
A load_error_swf function has been added to the Loader. It makes the
MovieClip enter the error state in which some attributes have certain
error values to signal that no valid file could be loaded. This happens
if no file could be loaded or if the loaded content is no valid
supported content.
The function creates an error state movie stub using the new
SwfMovie::error_movie function (which uses a new default_error_header
function) and configures remaining variables with the
movie_not_available method.
One TODO in order for the error state to be completely implemented has
been added.
Since the error state of the MovieClip includes the final URL of the SWF
file obtained after any redirects, the load_error_swf and
movie_loader_error functions (now) take an swf_url attribute.
To get this URL in case no file could be loaded, the
NavigatorBackend::fetch method has been changed to return an
ErrorResponse struct (including the url and the actual error) in the
error case. The Response struct returned in the success case has been
renamed to SuccessResponse.
All fetch implementations have been adapted accordingly. Code has been
adjusted to return the actual error where that's needed.
Documentation has been added and improved.
If an SWF tries to load a movie that can't be loaded, the Flash Player
sets _framesloaded of the MovieClip to -1. This has previously not been
implemented in Ruffle.
A new movie_not_available function has been added to the MovieClip
class. It sets the cur_preload_frame variable to 0.
This function is now called in the movie_loader_error function of the
Loader class (if a movie can't be loaded).
The frames_loaded function (which returns _framesloaded of the
MovieClip, which is given to the SWF) now returns an i32 and not an u16
value. This allows it to return a negative value. Code has been adjusted
where an u16 value is expected (clamping negative values to 0).
frames_loaded now returns cur_preload_frame - 1. Previously, it has
returned cur_preload_frame - 1 and clamped it to zero, but since the -1,
in case cur_preload_frame is zero, is explicitly wanted, this has been
corrected.
* avm2: Do not remove an EditText's selection on unfocus (fix#9006)
There are significant differences between how selection and caret info
work between AVM1 and AVM2.
In AVM1, there is only a single, global selection, which applies to
whichever element is currently focused. Therefore changing the focus
necessarily erases any information of what was selected before. There
can also be no active selection at all.
In AVM2, every text field has its own independent selection info. It is
NOT optional, the default selection is just a caret at position 0. If a
field loses focus, the selection is not rendered, but it is still
present. Movies such as #9006 rely on the same selection still being
there once you give back focus to the field.
Ruffle's model of selections (an Option per text field) is different
from both the AVM1 model (an optional singleton) and the AVM2 model
(mandatory per text field). This fix does not change that, it is only a
narrow fix targeted at 9006.
* avm2: implement selectionBegin/selectionEnd/caretIndex and add a test.
The selection test validates a few situations, including the behaviour
when unfocusing that was fixed in the previous commit.
The test does not validate how the selection changes after replacing
text, as there are still some inaccuracies there.
* avm2: Additional selection fixes needed after merging with master.
1. The default caret for an AVM2 textbox is at the end of the textbox,
not the beginning.
2. Selection should not be changed when focusing on a textbox in AVM2.
3. Fixed a test whose output.txt didn't actually match the flash player
output.
* avm2: Make the selection AVM checks compatible with mixed AVM, and revert the on_focus_changed parameters
---------
Co-authored-by: Nathan Adams <dinnerbone@dinnerbone.com>
The 'gc_arena' dependency was only used to manipulate the `GcCell`s
containing the vertex and fragment shaders; replacing these by a
reference to a plain old `Cell` means tha the Context3D traits and
types do not need to interact with GC'd object anymore.
As a knock-on effect, we can also remove the `Activation` parameter
from most of the `Context3DObject` methods.
* core: add temporary, ruffle-internal copy of `gc-arena` crate
This will allow bumping the upstream `gc-arena` version while
reexporting our own version of the old `GcCell` API, so that
Ruffle's code can be gradually migrated.
Once the migration is done, this crate should be removed.
* core: bump `gc-arena` to kyren/gc-arena#56
Add back the removed `GcCell` to our internal facade crate
* core: bump `gc-arena` to current master
This bump renames `Gc::allocate` to `Gc::new`
* core: rename `GcCell::allocate` to `GcCell::new`, to match `Gc`
* core: bump gc-arena to (slighly after) v0.3.1
Add typedefs for old `*Context` names in the gc-arena facade crate
* core: replace uses of `CollectionContext<'_>` by `&Collection`
* core: Add `gc()` convenience method for `*Context` and `Activation` types
This allows shortening most instances of `[activation.]context.gc_context`
to `activation.gc()` or `context.gc()` (but not all instances, because of
borrowck) Note that this doesn't actually do these shortenings to avoid
major code churn.
The bind group layout only depends on the texture registers
(and 2D/cubemap type) accessed by the fragment shader, not on
the runtime texture bound with Context3D. This means that we can
build and cache it when we compile the AGAL program to a Naga
module.
Since the bind group layout is used for the overall pipeline, I've
refactored the shader caching code into `ShaderPairAgal`, which
holds both the vertex and fragment shader bytecode, and compiles
both in the `compile` function.
When using a 'Loader', properties on the 'contentLoaderInfo' become
set during specific events in the load sequence. In particular,
'LoaderInfo.bytesTotal' becomes available during the first 'progress'
event.
Also, 'LoaderInfo.parameters' is now properly set from the URL query
parameters. In Flash player, this work even with filesystem urls
(e.g. 'file:///some/path/to/file.txt?paramOne=valOne' will load
a file named 'file.txt', setting and expose the parameter 'paramOne'
with value 'valOne' in `LoaderInfo.parameters`). This required some
cleanup to the desktop and test NavigatorBackend impls to strip
out query parameters when loading a parameter from disk.
Previously, we would set `SwfMovie.parameters` manually from the url.
Now, the various `SwfMovie` constructors automatically extract
query parameters from the provided url. Outside of `SwfMovie`,
we only append *extra* parameters (e.g. those set from `flashvars`).
This makes CPMStar ads work, since the loaded SWF needs to access
`LoaderInfo.parameters`
The 'winding' argument and filling behavior described in the docs
are not yet implemented. However, this implementation is good enough
for Scratch to render its default cat image.
We were previously only ever checking children,
and not attributes.
In order to avoid matching both attributes and elements
with a given name in 'descendants', `E4xNode::matches_name`
now checks `is_attribute` on the provided `Multiname`. This
requries changing several other parts of the codebase to
properly set this flag on `Multinames` provided by ActionScript.
The only generic class is `Vector`, which only has a single parameter.
However, we currently store a list of type parameters in several places,
which requires redundant checks that the list only has one entry.
Instead, we now store an `Option` everwhere except for
`swf::Multiname::TypeName` (since the actual SWF format supports
multiple type parameters). We still perform the same check when loading
bytecode (the swf Multiname should only have at most one type
parameter), but the rest of the codebase can deal with an `Option`
instead.
In the special case where y_min==y_max==(height-1),
we would create a bad 'encompassing' region - subtracing
one from the max would make it smaller than the min,
causing `PixelRegion::encompassing_pixels` to treat it
as the minimum, and add one to `height - 1`
There's no work to do when x_min==x_max or y_min==y_max,
so we can also skip the sync and GC write in this case.