nits: Fix a whole bunch of typos all over the place

This commit is contained in:
TÖRÖK Attila 2024-01-17 21:57:30 +01:00
parent 8f2292c2c7
commit d153290fd6
55 changed files with 104 additions and 104 deletions

View File

@ -297,7 +297,7 @@ fn strip_metadata(abc: &mut AbcFile) {
} }
} }
/// Handles native functons defined in our `playerglobal` /// Handles native functions defined in our `playerglobal`
/// ///
/// The high-level idea is to generate code (specifically, a `TokenStream`) /// The high-level idea is to generate code (specifically, a `TokenStream`)
/// which builds a table - mapping from the method ids of native functions, /// which builds a table - mapping from the method ids of native functions,

View File

@ -236,7 +236,7 @@ impl Drop for Activation<'_, '_> {
} }
impl<'a, 'gc> Activation<'a, 'gc> { impl<'a, 'gc> Activation<'a, 'gc> {
/// Convenience method to retrieve the current GC context. Note that explicitely writing /// Convenience method to retrieve the current GC context. Note that explicitly writing
/// `self.context.gc_context` can be sometimes necessary to satisfy the borrow checker. /// `self.context.gc_context` can be sometimes necessary to satisfy the borrow checker.
#[inline(always)] #[inline(always)]
pub fn gc(&self) -> &'gc gc_arena::Mutation<'gc> { pub fn gc(&self) -> &'gc gc_arena::Mutation<'gc> {
@ -3113,7 +3113,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
} }
/// Checks that the clip executing a script still exists. /// Checks that the clip executing a script still exists.
/// If the clip executing a script is removed during exectuion, return from this activation. /// If the clip executing a script is removed during execution, return from this activation.
/// Should be called after any action that could potentially destroy a clip (gotos, etc.) /// Should be called after any action that could potentially destroy a clip (gotos, etc.)
fn continue_if_base_clip_exists(&self) -> Result<FrameControl<'gc>, Error<'gc>> { fn continue_if_base_clip_exists(&self) -> Result<FrameControl<'gc>, Error<'gc>> {
// The exception is `unload` clip event handlers, which currently are called when the clip // The exception is `unload` clip event handlers, which currently are called when the clip

View File

@ -306,7 +306,7 @@ pub trait TObject<'gc>: 'gc + Collect + Into<Object<'gc>> + Clone + Copy {
} }
} }
/// Retrive a getter defined on this object. /// Retrieve a getter defined on this object.
fn getter( fn getter(
&self, &self,
name: AvmString<'gc>, name: AvmString<'gc>,
@ -315,7 +315,7 @@ pub trait TObject<'gc>: 'gc + Collect + Into<Object<'gc>> + Clone + Copy {
self.raw_script_object().getter(name, activation) self.raw_script_object().getter(name, activation)
} }
/// Retrive a setter defined on this object. /// Retrieve a setter defined on this object.
fn setter( fn setter(
&self, &self,
name: AvmString<'gc>, name: AvmString<'gc>,

View File

@ -1,5 +1,5 @@
//! The map of property names to values used by the ActionScript VM. //! The map of property names to values used by the ActionScript VM.
//! This allows for dynamically choosing case-sensitivty at runtime, //! This allows for dynamically choosing case-sensitivity at runtime,
//! because SWFv6 and below is case-insensitive. This also maintains //! because SWFv6 and below is case-insensitive. This also maintains
//! the insertion order of properties, which is necessary for accurate //! the insertion order of properties, which is necessary for accurate
//! enumeration order. //! enumeration order.
@ -25,7 +25,7 @@ impl<'gc, V> PropertyMap<'gc, V> {
if case_sensitive { if case_sensitive {
self.0.contains_key(&CaseSensitive(key.as_ref())) self.0.contains_key(&CaseSensitive(key.as_ref()))
} else { } else {
self.0.contains_key(&CaseInsentitive(key.as_ref())) self.0.contains_key(&CaseInsensitive(key.as_ref()))
} }
} }
@ -42,7 +42,7 @@ impl<'gc, V> PropertyMap<'gc, V> {
}), }),
} }
} else { } else {
match self.0.get_index_of(&CaseInsentitive(key.as_ref())) { match self.0.get_index_of(&CaseInsensitive(key.as_ref())) {
Some(index) => Entry::Occupied(OccupiedEntry { Some(index) => Entry::Occupied(OccupiedEntry {
map: &mut self.0, map: &mut self.0,
index, index,
@ -60,7 +60,7 @@ impl<'gc, V> PropertyMap<'gc, V> {
if case_sensitive { if case_sensitive {
self.0.get(&CaseSensitive(key.as_ref())) self.0.get(&CaseSensitive(key.as_ref()))
} else { } else {
self.0.get(&CaseInsentitive(key.as_ref())) self.0.get(&CaseInsensitive(key.as_ref()))
} }
} }
@ -69,7 +69,7 @@ impl<'gc, V> PropertyMap<'gc, V> {
if case_sensitive { if case_sensitive {
self.0.get_mut(&CaseSensitive(key.as_ref())) self.0.get_mut(&CaseSensitive(key.as_ref()))
} else { } else {
self.0.get_mut(&CaseInsentitive(key.as_ref())) self.0.get_mut(&CaseInsensitive(key.as_ref()))
} }
} }
@ -103,7 +103,7 @@ impl<'gc, V> PropertyMap<'gc, V> {
if case_sensitive { if case_sensitive {
self.0.shift_remove(&CaseSensitive(key.as_ref())) self.0.shift_remove(&CaseSensitive(key.as_ref()))
} else { } else {
self.0.shift_remove(&CaseInsentitive(key.as_ref())) self.0.shift_remove(&CaseInsensitive(key.as_ref()))
} }
} }
} }
@ -158,15 +158,15 @@ impl<'gc, 'a, V> VacantEntry<'gc, 'a, V> {
} }
/// Wraps a str-like type, causing the hash map to use a case insensitive hash and equality. /// Wraps a str-like type, causing the hash map to use a case insensitive hash and equality.
struct CaseInsentitive<T>(T); struct CaseInsensitive<T>(T);
impl<'a> Hash for CaseInsentitive<&'a WStr> { impl<'a> Hash for CaseInsensitive<&'a WStr> {
fn hash<H: Hasher>(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
swf_hash_string_ignore_case(self.0, state); swf_hash_string_ignore_case(self.0, state);
} }
} }
impl<'gc, 'a> Equivalent<PropertyName<'gc>> for CaseInsentitive<&'a WStr> { impl<'gc, 'a> Equivalent<PropertyName<'gc>> for CaseInsensitive<&'a WStr> {
fn equivalent(&self, key: &PropertyName<'gc>) -> bool { fn equivalent(&self, key: &PropertyName<'gc>) -> bool {
key.0.eq_ignore_case(self.0) key.0.eq_ignore_case(self.0)
} }

View File

@ -411,7 +411,7 @@ impl<'gc> Avm1<'gc> {
self.registers.get_mut(id) self.registers.get_mut(id)
} }
/// Find all display objects with negative depth recurisvely /// Find all display objects with negative depth recursively
/// ///
/// If an object is pending removal due to being removed by a removeObject tag on the previous frame, /// If an object is pending removal due to being removed by a removeObject tag on the previous frame,
/// while it had an unload event listener attached, avm1 requires that the object is kept around for one extra frame. /// while it had an unload event listener attached, avm1 requires that the object is kept around for one extra frame.

View File

@ -153,7 +153,7 @@ pub struct Avm2<'gc> {
#[collect(require_static)] #[collect(require_static)]
native_call_handler_table: &'static [Option<(&'static str, NativeMethodImpl)>], native_call_handler_table: &'static [Option<(&'static str, NativeMethodImpl)>],
/// A list of objects which are capable of recieving broadcasts. /// A list of objects which are capable of receiving broadcasts.
/// ///
/// Certain types of events are "broadcast events" that are emitted on all /// Certain types of events are "broadcast events" that are emitted on all
/// constructed objects in order of their creation, whether or not they are /// constructed objects in order of their creation, whether or not they are
@ -245,7 +245,7 @@ impl<'gc> Avm2<'gc> {
orphan_objects: Default::default(), orphan_objects: Default::default(),
// Set the lowest version for now - this be overriden when we set our movie // Set the lowest version for now - this will be overridden when we set our movie
root_api_version: ApiVersion::AllVersions, root_api_version: ApiVersion::AllVersions,
#[cfg(feature = "avm_debug")] #[cfg(feature = "avm_debug")]
@ -322,7 +322,7 @@ impl<'gc> Avm2<'gc> {
/// Adds a `MovieClip` to the orphan list. In AVM2, movies advance their /// Adds a `MovieClip` to the orphan list. In AVM2, movies advance their
/// frames even when they are not on a display list. Unfortunately, /// frames even when they are not on a display list. Unfortunately,
/// mutliple SWFS rely on this behavior, so we need to match Flash's /// multiple SWFS rely on this behavior, so we need to match Flash's
/// behavior. This should not be called manually - `movie_clip` will /// behavior. This should not be called manually - `movie_clip` will
/// call it when necessary. /// call it when necessary.
pub fn add_orphan_obj(&mut self, dobj: DisplayObject<'gc>) { pub fn add_orphan_obj(&mut self, dobj: DisplayObject<'gc>) {

View File

@ -147,7 +147,7 @@ pub struct Activation<'a, 'gc: 'a> {
} }
impl<'a, 'gc> Activation<'a, 'gc> { impl<'a, 'gc> Activation<'a, 'gc> {
/// Convenience method to retrieve the current GC context. Note that explicitely writing /// Convenience method to retrieve the current GC context. Note that explicitly writing
/// `self.context.gc_context` can be sometimes necessary to satisfy the borrow checker. /// `self.context.gc_context` can be sometimes necessary to satisfy the borrow checker.
#[inline(always)] #[inline(always)]
pub fn gc(&self) -> &'gc gc_arena::Mutation<'gc> { pub fn gc(&self) -> &'gc gc_arena::Mutation<'gc> {

View File

@ -74,7 +74,7 @@ To add versioning to an API:
1. Determine the first version where it was added. This can be seen in the Flash Documentation (e.g. "Runtime Versions: Flash Player 11.4, AIR 3.4") 1. Determine the first version where it was added. This can be seen in the Flash Documentation (e.g. "Runtime Versions: Flash Player 11.4, AIR 3.4")
2. Convert the Flash Player version to an SWF version number using [this chart](https://github.com/ruffle-rs/ruffle/wiki/SWF-version-chart) 2. Convert the Flash Player version to an SWF version number using [this chart](https://github.com/ruffle-rs/ruffle/wiki/SWF-version-chart)
2. Determine the corresponding asc.jar version code for the SWF version. This can be found in avmplus in https://github.com/adobe/avmplus/blob/master/core/api-versions.as 2. Determine the corresponding asc.jar version code for the SWF version. This can be found in avmplus in https://github.com/adobe/avmplus/blob/master/core/api-versions.as
3. Add an `[API("VersionCode")]` metadata to the defintion. In the `Event.WORKER_STATE` example, 3. Add an `[API("VersionCode")]` metadata to the definition. In the `Event.WORKER_STATE` example,
this looks like: this looks like:
```actionscript ```actionscript

View File

@ -1158,7 +1158,7 @@ fn parse_date(item: &WStr) -> Option<(u32, u32, u32)> {
Some(parsed) Some(parsed)
} }
/// Convert a month abbrevation to a number. /// Convert a month abbreviation to a number.
fn parse_mon(item: &WStr) -> Option<usize> { fn parse_mon(item: &WStr) -> Option<usize> {
const MONTHS: [&[u8]; 12] = [ const MONTHS: [&[u8]; 12] = [
b"Jan", b"Feb", b"Mar", b"Apr", b"May", b"Jun", b"Jul", b"Aug", b"Sep", b"Oct", b"Nov", b"Jan", b"Feb", b"Mar", b"Apr", b"May", b"Jun", b"Jul", b"Aug", b"Sep", b"Oct", b"Nov",

View File

@ -108,7 +108,7 @@ pub fn get_shader_args<'gc>(
.expect("ShaderInput.input is not an object"); .expect("ShaderInput.input is not an object");
let bitmap = input.as_bitmap_data().expect( let bitmap = input.as_bitmap_data().expect(
"ShaderInput.input is not a BitmapData (FIXE - support other types)", "ShaderInput.input is not a BitmapData (FIXME - support other types)",
); );
Some(bitmap.bitmap_handle( Some(bitmap.bitmap_handle(

View File

@ -356,7 +356,7 @@ pub fn set_program_constants_from_vector<'gc>(
let num_registers = args.get_i32(activation, 3)?; let num_registers = args.get_i32(activation, 3)?;
let to_take = if num_registers != -1 { let to_take = if num_registers != -1 {
// Each register requries 4 floating-point values // Each register requires 4 floating-point values
// FIXME - throw an error if 'vector' is too small // FIXME - throw an error if 'vector' is too small
num_registers as usize * 4 num_registers as usize * 4
} else { } else {

View File

@ -25,7 +25,7 @@ package flash.net
} }
public function get creator(): String { public function get creator(): String {
retunr this._creator; return this._creator;
} }
public function get data(): ByteArray { public function get data(): ByteArray {
@ -41,7 +41,7 @@ package flash.net
} }
public function get name(): String { public function get name(): String {
retunr this._name; return this._name;
} }
public static function get permissionStatus(): String { public static function get permissionStatus(): String {

View File

@ -12,7 +12,7 @@ package flash.net
// The duration of playback, in seconds, for the stream specified in streamName. // The duration of playback, in seconds, for the stream specified in streamName.
public var len: Number = -1; public var len: Number = -1;
// The absoulte stream time at which the server switches between streams of different bitrates for Flash Media Server dynamic streaming. // The absolute stream time at which the server switches between streams of different bitrates for Flash Media Server dynamic streaming.
public var offset: Number = -1; public var offset: Number = -1;
// The name of the old stream or the stream to transition from. // The name of the old stream or the stream to transition from.

View File

@ -9,7 +9,7 @@ package flash.text.engine
public final class BreakOpportunity public final class BreakOpportunity
{ {
// Treats all characters in the ContentElement object as line break opportunities, meaning that a line break will occur afer each character. // Treats all characters in the ContentElement object as line break opportunities, meaning that a line break will occur after each character.
public static const ALL:String = "all"; public static const ALL:String = "all";
// Treats any character in the ContentElement object as a line break opportunity. // Treats any character in the ContentElement object as a line break opportunity.

View File

@ -39,7 +39,7 @@ package flash.text.engine {
if (textJustifier) { if (textJustifier) {
this.textJustifier = textJustifier; this.textJustifier = textJustifier;
} else { } else {
// This should creaate a new TextJustifier with locale "en", but we don't actually support creating TextJustifiers yet. // This should create a new TextJustifier with locale "en", but we don't actually support creating TextJustifiers yet.
} }
this.lineRotation = lineRotation; this.lineRotation = lineRotation;

View File

@ -64,7 +64,7 @@ pub fn start<'gc>(
.coerce_to_object(activation)?; .coerce_to_object(activation)?;
// Note - we deliberately do *not* check if currentCount is less than repeatCount. // Note - we deliberately do *not* check if currentCount is less than repeatCount.
// Calling 'start' on a timer that has currentCount >= repeatCount will tick exactly // Calling 'start' on a timer that has currentCount >= repeatCount will tick exactly
// once, and then stop immediately. This is handeld by Timer.onUpdate // once, and then stop immediately. This is handled by Timer.onUpdate
let id = activation.context.timers.add_timer( let id = activation.context.timers.add_timer(
TimerCallback::Avm2Callback { TimerCallback::Avm2Callback {
closure: on_update, closure: on_update,

View File

@ -164,7 +164,7 @@ impl<'gc> Namespace<'gc> {
if is_playerglobals { if is_playerglobals {
if !has_version_mark if !has_version_mark
// NOTE - we deviate from avmplus by only appling VM_INTERNAL to unmarked playerglobal namespaces // NOTE - we deviate from avmplus by only applying VM_INTERNAL to unmarked playerglobal namespaces
// that use 'Package', instead of both 'Namespace' and 'Package'. This is because our version // that use 'Package', instead of both 'Namespace' and 'Package'. This is because our version
// of asc.jar does *not* apply version markers to method definitions in interfaces (unlike // of asc.jar does *not* apply version markers to method definitions in interfaces (unlike
// method definitions in normal classes). Interface method definitions in playerglobals always // method definitions in normal classes). Interface method definitions in playerglobals always
@ -299,7 +299,7 @@ impl<'gc> Namespace<'gc> {
/// Compares this namespace to another, considering them equal if this namespace's version /// Compares this namespace to another, considering them equal if this namespace's version
/// is less than or equal to the other (definitions in this namespace version can be /// is less than or equal to the other (definitions in this namespace version can be
/// seen by the other). This is used to implement `ProperyMap`, where we want to /// seen by the other). This is used to implement `PropertyMap`, where we want to
/// a definition with `ApiVersion::SWF_16` to be visible when queried from /// a definition with `ApiVersion::SWF_16` to be visible when queried from
/// a SWF with `ApiVersion::SWF_16` or any higher version. /// a SWF with `ApiVersion::SWF_16` or any higher version.
pub fn matches_ns(&self, other: Self) -> bool { pub fn matches_ns(&self, other: Self) -> bool {

View File

@ -197,7 +197,7 @@ use crate::font::Font;
)] )]
pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy { pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy {
/// Get the base of this object. /// Get the base of this object.
/// Any trait method implementations that were not overrided will forward the call to this instead. /// Any trait method implementations that were not overridden will forward the call to this instead.
fn base(&self) -> Ref<ScriptObjectData<'gc>>; fn base(&self) -> Ref<ScriptObjectData<'gc>>;
fn base_mut(&self, mc: &Mutation<'gc>) -> RefMut<ScriptObjectData<'gc>>; fn base_mut(&self, mc: &Mutation<'gc>) -> RefMut<ScriptObjectData<'gc>>;

View File

@ -137,7 +137,7 @@ impl<'gc> Debug for StageObject<'gc> {
Ok(obj) => f Ok(obj) => f
.debug_struct("StageObject") .debug_struct("StageObject")
.field("name", &obj.base.debug_class_name()) .field("name", &obj.base.debug_class_name())
// .field("display_object", &obj.display_object) TOOO(moulins) // .field("display_object", &obj.display_object) TODO(moulins)
.field("ptr", &self.0.as_ptr()) .field("ptr", &self.0.as_ptr())
.finish(), .finish(),
Err(err) => f Err(err) => f

View File

@ -339,7 +339,7 @@ pub struct XmlListObjectData<'gc> {
} }
/// Holds either an `E4XNode` or an `XmlObject`. This can be converted /// Holds either an `E4XNode` or an `XmlObject`. This can be converted
/// in-palce to an `XmlObject` via `get_or_create_xml`. /// in-place to an `XmlObject` via `get_or_create_xml`.
/// This deliberately does not implement `Copy`, since `get_or_create_xml` /// This deliberately does not implement `Copy`, since `get_or_create_xml`
/// takes `&mut self` /// takes `&mut self`
#[derive(Clone, Collect, Debug)] #[derive(Clone, Collect, Debug)]
@ -585,7 +585,7 @@ impl<'gc> TObject<'gc> for XmlListObject<'gc> {
// * If we're calling a method that *doesn't* exist on the prototype, it must not be an XML-related // * If we're calling a method that *doesn't* exist on the prototype, it must not be an XML-related
// method. In that case, the method will only be callable on our XML child if the child has simple // method. In that case, the method will only be callable on our XML child if the child has simple
// content (as we'll automatically convert it to a String, and call the method on that String). // content (as we'll automatically convert it to a String, and call the method on that String).
// * However, in order for a child to have a property matching the meethod name, it must be // * However, in order for a child to have a property matching the method name, it must be
// a non-simple XML object (simple XML objects have no properties to match). // a non-simple XML object (simple XML objects have no properties to match).
// //
// Nevertheless, there may be some weird edge case where this actually matters. // Nevertheless, there may be some weird edge case where this actually matters.

View File

@ -328,7 +328,7 @@ impl<'gc> TObject<'gc> for XmlObject<'gc> {
let method = self let method = self
.proto() .proto()
.expect("XMLList misisng prototype") .expect("XMLList missing prototype")
.get_property(multiname, activation)?; .get_property(multiname, activation)?;
// If the method doesn't exist on the prototype, and we have simple content, // If the method doesn't exist on the prototype, and we have simple content,
@ -336,7 +336,7 @@ impl<'gc> TObject<'gc> for XmlObject<'gc> {
// This lets things like `new XML("<p>Hello world</p>").split(" ")` work. // This lets things like `new XML("<p>Hello world</p>").split(" ")` work.
if matches!(method, Value::Undefined) { if matches!(method, Value::Undefined) {
// Checking if we have a child with the same name as the method is probably // Checking if we have a child with the same name as the method is probably
// unecessary - if we had such a child, then we wouldn't have simple content, // unnecessary - if we had such a child, then we wouldn't have simple content,
// so we already would bail out before calling the method. Nevertheless, // so we already would bail out before calling the method. Nevertheless,
// avmplus has this check, so we do it out of an abundance of caution. // avmplus has this check, so we do it out of an abundance of caution.
// Compare to the very similar case in XMLListObject::call_property_local // Compare to the very similar case in XMLListObject::call_property_local

View File

@ -153,8 +153,8 @@ impl<'gc> VectorStorage<'gc> {
/// Change an arbitrary i32 into a positive parameter index. /// Change an arbitrary i32 into a positive parameter index.
/// ///
/// This converts negative indicies into positive indicies indexed from the /// This converts negative indices into positive indices indexed from the
/// end of the array. Negative indicies that point before the start of the /// end of the array. Negative indices that point before the start of the
/// array are clamped to zero. /// array are clamped to zero.
pub fn clamp_parameter_index(&self, pos: i32) -> usize { pub fn clamp_parameter_index(&self, pos: i32) -> usize {
if pos < 0 { if pos < 0 {

View File

@ -264,7 +264,7 @@ impl<'gc> VTable<'gc> {
// such slot with `getslot` wouldn't have passed verification in the first place. // such slot with `getslot` wouldn't have passed verification in the first place.
// So such SWFs shouldn't be encountered in the wild. // So such SWFs shouldn't be encountered in the wild.
// //
// Worst-case is that someone can hand-craft such an SWF speficically for Ruffle // Worst-case is that someone can hand-craft such an SWF specifically for Ruffle
// and be able to access private class members with `getslot/setslot, // and be able to access private class members with `getslot/setslot,
// so long-term it's still something we should verify. // so long-term it's still something we should verify.
// (and it's far from the only verification check we lack anyway) // (and it's far from the only verification check we lack anyway)

View File

@ -134,11 +134,11 @@ pub trait AudioBackend: Downcast {
fn stop_all_sounds(&mut self); fn stop_all_sounds(&mut self);
/// Get the position of a sound instance in milliseconds. /// Get the position of a sound instance in milliseconds.
/// Returns `None` if ther sound is not/no longer playing /// Returns `None` if the sound is not/no longer playing
fn get_sound_position(&self, instance: SoundInstanceHandle) -> Option<f64>; fn get_sound_position(&self, instance: SoundInstanceHandle) -> Option<f64>;
/// Get the duration of a sound in milliseconds. /// Get the duration of a sound in milliseconds.
/// Returns `None` if sound is not registered. /// Returns `None` if the sound is not registered.
fn get_sound_duration(&self, sound: SoundHandle) -> Option<f64>; fn get_sound_duration(&self, sound: SoundHandle) -> Option<f64>;
/// Get the size of the data stored within a given sound. /// Get the size of the data stored within a given sound.
@ -359,7 +359,7 @@ impl<'gc> AudioManager<'gc> {
/// The threshold in seconds where an audio stream is considered too out-of-sync and will be stopped. /// The threshold in seconds where an audio stream is considered too out-of-sync and will be stopped.
pub const STREAM_RESTART_THRESHOLD: f64 = 1.0; pub const STREAM_RESTART_THRESHOLD: f64 = 1.0;
/// The minimum audio sycning threshold in seconds. /// The minimum audio syncing threshold in seconds.
/// ///
/// The player will adjust animation speed to stay within this many seconds of the audio track. /// The player will adjust animation speed to stay within this many seconds of the audio track.
pub const STREAM_DEFAULT_SYNC_THRESHOLD: f64 = 0.2; pub const STREAM_DEFAULT_SYNC_THRESHOLD: f64 = 0.2;

View File

@ -22,7 +22,7 @@ pub mod turbulence;
/// - Widths and heights exceeding 0x666666 are invalid in all versions /// - Widths and heights exceeding 0x666666 are invalid in all versions
/// - Pixel counts (of any width/height) exceeding 0x20000000 pixels /// - Pixel counts (of any width/height) exceeding 0x20000000 pixels
/// ///
/// All of these are curently enforced. /// All of these are currently enforced.
pub fn is_size_valid(swf_version: u8, width: u32, height: u32) -> bool { pub fn is_size_valid(swf_version: u8, width: u32, height: u32) -> bool {
// From : // From :
// //

View File

@ -71,7 +71,7 @@ impl<'a, 'gc> GcContext<'a, 'gc> {
} }
} }
/// Convenience method to retrieve the current GC context. Note that explicitely writing /// Convenience method to retrieve the current GC context. Note that explicitly writing
/// `self.gc_context` can be sometimes necessary to satisfy the borrow checker. /// `self.gc_context` can be sometimes necessary to satisfy the borrow checker.
#[inline(always)] #[inline(always)]
pub fn gc(&self) -> &'gc Mutation<'gc> { pub fn gc(&self) -> &'gc Mutation<'gc> {
@ -450,7 +450,7 @@ impl<'a, 'gc> UpdateContext<'a, 'gc> {
} }
impl<'a, 'gc> UpdateContext<'a, 'gc> { impl<'a, 'gc> UpdateContext<'a, 'gc> {
/// Convenience method to retrieve the current GC context. Note that explicitely writing /// Convenience method to retrieve the current GC context. Note that explicitly writing
/// `self.gc_context` can be sometimes necessary to satisfy the borrow checker. /// `self.gc_context` can be sometimes necessary to satisfy the borrow checker.
#[inline(always)] #[inline(always)]
pub fn gc(&self) -> &'gc Mutation<'gc> { pub fn gc(&self) -> &'gc Mutation<'gc> {
@ -611,7 +611,7 @@ impl<'gc> Default for ActionQueue<'gc> {
/// Shared data used during rendering. /// Shared data used during rendering.
/// `Player` creates this when it renders a frame and passes it down to display objects. /// `Player` creates this when it renders a frame and passes it down to display objects.
/// ///
/// As a convenience, this type can be deref-coerced to `Mutation<'gc>`, but note that explicitely /// As a convenience, this type can be deref-coerced to `Mutation<'gc>`, but note that explicitly
/// writing `context.gc_context` can be sometimes necessary to satisfy the borrow checker. /// writing `context.gc_context` can be sometimes necessary to satisfy the borrow checker.
pub struct RenderContext<'a, 'gc> { pub struct RenderContext<'a, 'gc> {
/// The renderer, used by the display objects to register themselves. /// The renderer, used by the display objects to register themselves.
@ -643,7 +643,7 @@ pub struct RenderContext<'a, 'gc> {
} }
impl<'a, 'gc> RenderContext<'a, 'gc> { impl<'a, 'gc> RenderContext<'a, 'gc> {
/// Convenience method to retrieve the current GC context. Note that explicitely writing /// Convenience method to retrieve the current GC context. Note that explicitly writing
/// `self.gc_context` can be sometimes necessary to satisfy the borrow checker. /// `self.gc_context` can be sometimes necessary to satisfy the borrow checker.
#[inline(always)] #[inline(always)]
pub fn gc(&self) -> &'gc Mutation<'gc> { pub fn gc(&self) -> &'gc Mutation<'gc> {

View File

@ -210,7 +210,7 @@ impl MovieWindow {
if movie.header().is_action_script_3() { if movie.header().is_action_script_3() {
ui.label("Uses Actionscript 3"); ui.label("Uses Actionscript 3");
} }
if movie.header().has_metdata() { if movie.header().has_metadata() {
ui.label("Has XMP Metadata"); ui.label("Has XMP Metadata");
} }
if movie.header().use_direct_blit() { if movie.header().use_direct_blit() {

View File

@ -255,7 +255,7 @@ pub struct DisplayObjectBase<'gc> {
#[collect(require_static)] #[collect(require_static)]
next_scroll_rect: Rectangle<Twips>, next_scroll_rect: Rectangle<Twips>,
/// Rectangle used for 9-slice scaling (`DislayObject.scale9grid`). /// Rectangle used for 9-slice scaling (`DisplayObject.scale9grid`).
#[collect(require_static)] #[collect(require_static)]
scaling_grid: Rectangle<Twips>, scaling_grid: Rectangle<Twips>,
@ -1020,12 +1020,12 @@ pub fn apply_standard_mask_and_scroll<'gc, F>(
// There are two parts to 'DisplayObject.scrollRect': // There are two parts to 'DisplayObject.scrollRect':
// a scroll effect (translation), and a crop effect. // a scroll effect (translation), and a crop effect.
// This scroll is implementing by appling a translation matrix // This scroll is implementing by applying a translation matrix
// when we defined 'scroll_rect_matrix'. // when we defined 'scroll_rect_matrix'.
// The crop is implemented as a rectangular mask using the height // The crop is implemented as a rectangular mask using the height
// and width provided by 'scrollRect'. // and width provided by 'scrollRect'.
// Note that this mask is applied *in additon to* a mask defined // Note that this mask is applied *in addition to* a mask defined
// with 'DisplayObject.mask'. We will end up rendering content that // with 'DisplayObject.mask'. We will end up rendering content that
// lies in the intersection of the scroll rect and DisplayObject.mask, // lies in the intersection of the scroll rect and DisplayObject.mask,
// which is exactly the behavior that we want. // which is exactly the behavior that we want.
@ -1797,7 +1797,7 @@ pub trait TDisplayObject<'gc>:
} }
/// Whether this display object prefers to be cached into a bitmap rendering. /// Whether this display object prefers to be cached into a bitmap rendering.
/// This is the PlaceObject `cacheAsBitmap` flag - and may be overriden if filters are applied. /// This is the PlaceObject `cacheAsBitmap` flag - and may be overridden if filters are applied.
/// Consider `is_bitmap_cached` for if a bitmap cache is actually in use. /// Consider `is_bitmap_cached` for if a bitmap cache is actually in use.
fn is_bitmap_cached_preference(&self) -> bool { fn is_bitmap_cached_preference(&self) -> bool {
self.base().is_bitmap_cached_preference() self.base().is_bitmap_cached_preference()
@ -2599,7 +2599,7 @@ impl SoundTransform {
/// This matches the behavior of AVM1 `Sound.getPan()` /// This matches the behavior of AVM1 `Sound.getPan()`
pub fn pan(&self) -> i32 { pub fn pan(&self) -> i32 {
// It's not clear why Flash has the weird `abs` behavior, but this // It's not clear why Flash has the weird `abs` behavior, but this
// mathes the values that Flash returns (see `sound` regression test). // matches the values that Flash returns (see `sound` regression test).
if self.left_to_left != Self::MAX_VOLUME { if self.left_to_left != Self::MAX_VOLUME {
Self::MAX_VOLUME - self.left_to_left.abs() Self::MAX_VOLUME - self.left_to_left.abs()
} else { } else {

View File

@ -84,8 +84,8 @@ pub fn dispatch_added_to_stage_event<'gc>(
} }
} }
/// Dispatch an `added` event to one object, and log an errors encounted whilst /// Dispatch an `added` event to one object, and log any errors encountered
/// doing so. /// whilst doing so.
pub fn dispatch_added_event_only<'gc>( pub fn dispatch_added_event_only<'gc>(
child: DisplayObject<'gc>, child: DisplayObject<'gc>,
context: &mut UpdateContext<'_, 'gc>, context: &mut UpdateContext<'_, 'gc>,
@ -413,7 +413,7 @@ pub trait TDisplayObjectContainer<'gc>:
this.invalidate_cached_bitmap(context.gc_context); this.invalidate_cached_bitmap(context.gc_context);
} }
/// Remove a set of children identified by their render list indicies from /// Remove a set of children identified by their render list indices from
/// this container's render and depth lists. /// this container's render and depth lists.
fn remove_range<R>(&mut self, context: &mut UpdateContext<'_, 'gc>, range: R) fn remove_range<R>(&mut self, context: &mut UpdateContext<'_, 'gc>, range: R)
where where

View File

@ -534,7 +534,7 @@ impl<'gc> Avm2MousePick<'gc> {
// If the parent has `mouseChildren=false` and `mouseEnabled=true`, // If the parent has `mouseChildren=false` and `mouseEnabled=true`,
// we have a weird case. The event can propagate through this 'fully disabled' // we have a weird case. The event can propagate through this 'fully disabled'
// parent - if it reaches an ancestor with `mouseEnabled=true`, it will get // parent - if it reaches an ancestor with `mouseEnabled=true`, it will get
// 'abosrbed' by that ancestor. Otherwise, no event will be fired. // 'absorbed' by that ancestor. Otherwise, no event will be fired.
} else { } else {
Avm2MousePick::PropagateToParent Avm2MousePick::PropagateToParent
} }

View File

@ -215,7 +215,7 @@ impl MorphShapeStatic {
} }
/// Retrieves the `Frame` for the given ratio. /// Retrieves the `Frame` for the given ratio.
/// Lazily intializes the frame if it does not yet exist. /// Lazily initializes the frame if it does not yet exist.
fn get_frame(&self, ratio: u16) -> RefMut<'_, Frame> { fn get_frame(&self, ratio: u16) -> RefMut<'_, Frame> {
let frames = self.frames.borrow_mut(); let frames = self.frames.borrow_mut();
RefMut::map(frames, |frames| { RefMut::map(frames, |frames| {
@ -226,7 +226,7 @@ impl MorphShapeStatic {
} }
/// Retrieves the `ShapeHandle` for the given ratio. /// Retrieves the `ShapeHandle` for the given ratio.
/// Lazily intializes and tessellates the shape if it does not yet exist. /// Lazily initializes and tessellates the shape if it does not yet exist.
fn get_shape<'gc>( fn get_shape<'gc>(
&self, &self,
context: &mut RenderContext<'_, 'gc>, context: &mut RenderContext<'_, 'gc>,

View File

@ -54,7 +54,7 @@ pub struct StageData<'gc> {
/// Base properties for interactive display objects. /// Base properties for interactive display objects.
/// ///
/// This particular base has additional constraints currently not /// This particular base has additional constraints currently not
/// expressable by the type system. Notably, this should never have a /// expressible by the type system. Notably, this should never have a
/// parent, as the stage does not respect it. /// parent, as the stage does not respect it.
base: InteractiveObjectBase<'gc>, base: InteractiveObjectBase<'gc>,
@ -108,7 +108,7 @@ pub struct StageData<'gc> {
/// Whether to use high quality downsampling for bitmaps. /// Whether to use high quality downsampling for bitmaps.
/// ///
/// This is usally implied by `quality` being `Best` or higher, but the AVM1 /// This is usually implied by `quality` being `Best` or higher, but the AVM1
/// `ToggleHighQuality` op can adjust stage quality independently of this flag. /// `ToggleHighQuality` op can adjust stage quality independently of this flag.
/// This setting is currently ignored in Ruffle. /// This setting is currently ignored in Ruffle.
use_bitmap_downsampling: bool, use_bitmap_downsampling: bool,

View File

@ -274,7 +274,7 @@ pub enum GlyphSource {
/// Used by `DefineEditText` tags. /// Used by `DefineEditText` tags.
code_point_to_glyph: fnv::FnvHashMap<u16, usize>, code_point_to_glyph: fnv::FnvHashMap<u16, usize>,
/// Kerning infomration. /// Kerning information.
/// Maps from a pair of unicode code points to horizontal offset value. /// Maps from a pair of unicode code points to horizontal offset value.
kerning_pairs: fnv::FnvHashMap<(u16, u16), Twips>, kerning_pairs: fnv::FnvHashMap<(u16, u16), Twips>,
}, },
@ -887,7 +887,7 @@ impl FontDescriptor {
/// The text rendering engine that a text field should use. /// The text rendering engine that a text field should use.
/// This is controlled by the "Anti-alias" setting in the Flash IDE. /// This is controlled by the "Anti-alias" setting in the Flash IDE.
/// Using "Anti-alias for readibility" switches to the "Advanced" text /// Using "Anti-alias for readability" switches to the "Advanced" text
/// rendering engine. /// rendering engine.
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub enum TextRenderSettings { pub enum TextRenderSettings {
@ -904,7 +904,7 @@ pub enum TextRenderSettings {
}, },
/// This text should render with the advanced rendering engine. /// This text should render with the advanced rendering engine.
/// Set via "Anti-alias for readibility" in the Flash IDE. /// Set via "Anti-alias for readability" in the Flash IDE.
/// The parameters are set via the CSMTextSettings SWF tag. /// The parameters are set via the CSMTextSettings SWF tag.
/// Ruffle does not support this currently, but this also affects /// Ruffle does not support this currently, but this also affects
/// hit-testing behavior. /// hit-testing behavior.

View File

@ -97,7 +97,7 @@ impl<'gc> Avm2ClassRegistry<'gc> {
if let Some(old) = self.class_map.get(&class_object) { if let Some(old) = self.class_map.get(&class_object) {
if Arc::ptr_eq(&movie, &old.0) && symbol != old.1 { if Arc::ptr_eq(&movie, &old.0) && symbol != old.1 {
// Flash player actually allows using the same class in multiple SymbolClass // Flash player actually allows using the same class in multiple SymbolClass
// entires in the same swf, with *different* symbol ids. Whichever one // entries in the same swf, with *different* symbol ids. Whichever one
// is processed first will *win*, and the second one will be ignored. // is processed first will *win*, and the second one will be ignored.
// We still log a warning, since we wouldn't expect this to happen outside // We still log a warning, since we wouldn't expect this to happen outside
// of deliberately crafted SWFs. // of deliberately crafted SWFs.

View File

@ -878,7 +878,7 @@ impl<'gc> NetStream<'gc> {
} }
Err(e) => { Err(e) => {
tracing::error!( tracing::error!(
"Got error when registring FLV video stream: {}", "Got error when registering FLV video stream: {}",
e e
); );
return; //TODO: This originally breaks and halts tag processing return; //TODO: This originally breaks and halts tag processing
@ -1039,7 +1039,7 @@ impl<'gc> NetStream<'gc> {
_ => unreachable!(), _ => unreachable!(),
}, },
Err(e) => { Err(e) => {
tracing::error!("Got error when registring FLV video stream: {}", e) tracing::error!("Got error when registering FLV video stream: {}", e)
} }
} }
} else { } else {

View File

@ -164,7 +164,7 @@ impl App {
return; return;
} }
WindowEvent::Resized(size) => { WindowEvent::Resized(size) => {
// TODO: Change this when winit adds a `Window::minimzed` or `WindowEvent::Minimize`. // TODO: Change this when winit adds a `Window::minimized` or `WindowEvent::Minimize`.
minimized = size.width == 0 && size.height == 0; minimized = size.width == 0 && size.height == 0;
if let Some(mut player) = self.player.get() { if let Some(mut player) = self.player.get() {

View File

@ -16,7 +16,7 @@ pub enum TagData<'a> {
/// The tag data was recognized but could not be parsed due to an error. /// The tag data was recognized but could not be parsed due to an error.
/// ///
/// The error contained will never be EndOfData; this should only be used /// The error contained will never be EndOfData; this should only be used
/// to flag unparseable data within an otherwise complete tag. /// to flag unparsable data within an otherwise complete tag.
Invalid(Error), Invalid(Error),
} }

View File

@ -37,7 +37,7 @@ pub struct WebCanvasRenderBackend {
mask_state: MaskState, mask_state: MaskState,
blend_modes: Vec<RenderBlendMode>, blend_modes: Vec<RenderBlendMode>,
// This is currnetly unused - we just store it to report // This is currently unused - we just store it to report
// in `get_viewport_dimensions` // in `get_viewport_dimensions`
viewport_scale_factor: f64, viewport_scale_factor: f64,
} }
@ -1099,7 +1099,7 @@ fn swf_to_canvas_gradient(
) -> Result<Gradient, JsError> { ) -> Result<Gradient, JsError> {
let matrix = if transformed { let matrix = if transformed {
// When we are rendering a complex gradient, the gradient transform is handled later by // When we are rendering a complex gradient, the gradient transform is handled later by
// transforming the path before rendering; so use the indentity matrix here. // transforming the path before rendering; so use the identity matrix here.
swf::Matrix::scale(swf::Fixed16::from_f64(20.0), swf::Fixed16::from_f64(20.0)) swf::Matrix::scale(swf::Fixed16::from_f64(20.0), swf::Fixed16::from_f64(20.0))
} else { } else {
swf_gradient.matrix swf_gradient.matrix

View File

@ -19,7 +19,7 @@ use crate::{
SHADER_ENTRY_POINT, SHADER_ENTRY_POINT,
}; };
const VERTEX_PROGRAM_CONTANTS: u64 = 128; const VERTEX_PROGRAM_CONSTANTS: u64 = 128;
const FRAGMENT_PROGRAM_CONSTANTS: u64 = 28; const FRAGMENT_PROGRAM_CONSTANTS: u64 = 28;
pub const TEXTURE_SAMPLER_START_BIND_INDEX: u32 = 2; pub const TEXTURE_SAMPLER_START_BIND_INDEX: u32 = 2;
@ -46,7 +46,7 @@ pub(crate) struct NagaBuilder<'a> {
pub(crate) module: Module, pub(crate) module: Module,
pub(crate) func: Function, pub(crate) func: Function,
// This evaluate to a Pointer to the temporary 'main' destiation location // This evaluate to a Pointer to the temporary 'main' destination location
// (the output position for a vertex shader, or the output color for a fragment shader) // (the output position for a vertex shader, or the output color for a fragment shader)
// which can be used with Expression::Load and Expression::Store // which can be used with Expression::Load and Expression::Store
// This is needed because an AGAL shader can write to the output register // This is needed because an AGAL shader can write to the output register
@ -110,7 +110,7 @@ pub(crate) struct NagaBuilder<'a> {
/// Any subsequent opcodes will be added to the `after_if` block. /// Any subsequent opcodes will be added to the `after_if` block.
/// When we encounter an 'else' opcode, we switch to adding opcodes to the `after_else` block /// When we encounter an 'else' opcode, we switch to adding opcodes to the `after_else` block
/// by setting `in_after_if` to false. /// by setting `in_after_if` to false.
/// When we encouter an `eif` opcode, we pop our `IfElse` entry from the stack, and emit /// When we encounter an `eif` opcode, we pop our `IfElse` entry from the stack, and emit
/// a `Statement::If` with the `after_if` and `after_else` blocks. /// a `Statement::If` with the `after_if` and `after_else` blocks.
#[derive(Debug)] #[derive(Debug)]
enum BlockStackEntry { enum BlockStackEntry {
@ -245,7 +245,7 @@ impl VertexAttributeFormat {
/// Combines information extracted from the AGAL bytecode itself /// Combines information extracted from the AGAL bytecode itself
/// with information provided from the AVM side of ruffle /// with information provided from the AVM side of ruffle
/// (based on the Context3D methods that ActionSCript called) /// (based on the Context3D methods that ActionScript called)
#[derive(Debug)] #[derive(Debug)]
pub struct ShaderConfig<'a> { pub struct ShaderConfig<'a> {
pub shader_type: ShaderType, pub shader_type: ShaderType,
@ -583,7 +583,7 @@ impl<'a> NagaBuilder<'a> {
base: vec4f, base: vec4f,
size: ArraySize::Constant( size: ArraySize::Constant(
NonZeroU32::new(match shader_config.shader_type { NonZeroU32::new(match shader_config.shader_type {
ShaderType::Vertex => VERTEX_PROGRAM_CONTANTS as u32, ShaderType::Vertex => VERTEX_PROGRAM_CONSTANTS as u32,
ShaderType::Fragment => FRAGMENT_PROGRAM_CONSTANTS as u32, ShaderType::Fragment => FRAGMENT_PROGRAM_CONSTANTS as u32,
}) })
.unwrap(), .unwrap(),

View File

@ -81,7 +81,7 @@ pub struct ShaderBuilder<'a> {
/// Any subsequent opcodes will be added to the `after_if` block. /// Any subsequent opcodes will be added to the `after_if` block.
/// When we encounter an 'OpElse' opcode, we switch to adding opcodes to the `after_else` block /// When we encounter an 'OpElse' opcode, we switch to adding opcodes to the `after_else` block
/// by setting `in_after_if` to false. /// by setting `in_after_if` to false.
/// When we encouter an `OpEndIf` opcode, we pop our `IfElse` entry from the stack, and emit /// When we encounter an `OpEndIf` opcode, we pop our `IfElse` entry from the stack, and emit
/// a `Statement::If` with the `after_if` and `after_else` blocks. /// a `Statement::If` with the `after_if` and `after_else` blocks.
#[derive(Debug)] #[derive(Debug)]
enum BlockStackEntry { enum BlockStackEntry {
@ -900,7 +900,7 @@ impl<'a> ShaderBuilder<'a> {
}) })
} }
Opcode::Sub | Opcode::Add | Opcode::Mul => { Opcode::Sub | Opcode::Add | Opcode::Mul => {
// The destiation is also used as the first operand: 'dst = dst <op> src' // The destination is also used as the first operand: 'dst = dst <op> src'
let left = self.load_src_register(&dst)?; let left = self.load_src_register(&dst)?;
let op = match opcode { let op = match opcode {
@ -1671,7 +1671,7 @@ impl<'a> ShaderBuilder<'a> {
) { ) {
panic!("Unexpected to matrix channel for dst {dst:?}"); panic!("Unexpected to matrix channel for dst {dst:?}");
} }
// Write each channel of the source to the channel specified by the destiation mask // Write each channel of the source to the channel specified by the destination mask
let src_component_index = *src_channel as u32; let src_component_index = *src_channel as u32;
let dst_component_index = *dst_channel as u32; let dst_component_index = *dst_channel as u32;
let src_component = self.evaluate_expr(Expression::AccessIndex { let src_component = self.evaluate_expr(Expression::AccessIndex {

View File

@ -39,7 +39,7 @@ const FRAGMENT_SHADER_UNIFORMS_BUFFER_SIZE: u64 =
// In WGPU, this state is associated by a `RenderPipeline` object, // In WGPU, this state is associated by a `RenderPipeline` object,
// which needs to be rebuilt whenever the state changes. // which needs to be rebuilt whenever the state changes.
// //
// To match up these APIs, we store the current state in `CurentPipeline`. // To match up these APIs, we store the current state in `CurrentPipeline`.
// Whenever a state-changing `Context3DCommand` is executed, we mark the `CurrentPipeline` // Whenever a state-changing `Context3DCommand` is executed, we mark the `CurrentPipeline`
// as dirty. When a `wgpu::RenderPipeline` is actually needed by `drawTriangles`, // as dirty. When a `wgpu::RenderPipeline` is actually needed by `drawTriangles`,
// we build a new `wgpu::RenderPipeline` from the `CurrentPipeline` state (if it's dirty). // we build a new `wgpu::RenderPipeline` from the `CurrentPipeline` state (if it's dirty).

View File

@ -45,7 +45,7 @@ const STENCIL_MASK: u32 = 1 << 2;
/// lifetime management - we can store an `Rc<dyn VertexBuffer>` or `Rc<dyn IndexBuffer>` /// lifetime management - we can store an `Rc<dyn VertexBuffer>` or `Rc<dyn IndexBuffer>`
/// in the `VertexBuffer3DObject` or `IndexBuffer3DObject`. If we delayed creating them, /// in the `VertexBuffer3DObject` or `IndexBuffer3DObject`. If we delayed creating them,
/// we would need to store a `GcCell<Option<Rc<dyn VertexBuffer>>>`, which prevents /// we would need to store a `GcCell<Option<Rc<dyn VertexBuffer>>>`, which prevents
/// us from obtaining a long-lived reference to the `wgpu:Bufer` (it would instead be /// us from obtaining a long-lived reference to the `wgpu:Buffer` (it would instead be
/// tied to the `Ref` returned by `GcCell::read`). /// tied to the `Ref` returned by `GcCell::read`).
pub struct WgpuContext3D { pub struct WgpuContext3D {
// We only use some of the fields from `Descriptors`, but we // We only use some of the fields from `Descriptors`, but we
@ -373,7 +373,7 @@ const MAX_VERTEX_ATTRIBUTES: usize = 8;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct VertexAttributeInfo { pub struct VertexAttributeInfo {
// An offset in units of buffer entires (f32 or u8) // An offset in units of buffer entries (f32 or u8)
offset_in_32bit_units: u64, offset_in_32bit_units: u64,
format: Context3DVertexBufferFormat, format: Context3DVertexBufferFormat,
buffer: Rc<VertexBufferWrapper>, buffer: Rc<VertexBufferWrapper>,
@ -717,7 +717,7 @@ impl Context3D for WgpuContext3D {
// to keep a copy of the data on the CPU side. We round *down* the offset to // to keep a copy of the data on the CPU side. We round *down* the offset to
// the closest multiple of 4 bytes, and round *up* the length to the closest // the closest multiple of 4 bytes, and round *up* the length to the closest
// multiple of 4 bytes. We then perform a copy from our CPU-side buffer, which // multiple of 4 bytes. We then perform a copy from our CPU-side buffer, which
// which uses the existing data (at the beiginning or end) to fill out the copy // which uses the existing data (at the beginning or end) to fill out the copy
// to the required length and offset. Without this, we would lose data in the CPU // to the required length and offset. Without this, we would lose data in the CPU
// buffer whenever we performed a copy with an unalignd offset or length. // buffer whenever we performed a copy with an unalignd offset or length.
let offset_bytes = start_offset * std::mem::size_of::<u16>(); let offset_bytes = start_offset * std::mem::size_of::<u16>();
@ -1067,7 +1067,7 @@ impl Context3D for WgpuContext3D {
}, },
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
}, },
// The copy size uses the orignal image, with the original row size // The copy size uses the original image, with the original row size
wgpu::Extent3d { wgpu::Extent3d {
width: dest.width(), width: dest.width(),
height: dest.height(), height: dest.height(),

View File

@ -36,7 +36,7 @@ pub struct Pipelines {
pub color: ShapePipeline, pub color: ShapePipeline,
/// Renders a bitmap without any blending, and does /// Renders a bitmap without any blending, and does
/// not write to the alpha channel. This is used for /// not write to the alpha channel. This is used for
/// drawing a finished Stage3D buffer onto the backgroud. /// drawing a finished Stage3D buffer onto the background.
pub bitmap_opaque: wgpu::RenderPipeline, pub bitmap_opaque: wgpu::RenderPipeline,
/// Like `bitmap_opaque`, but with a no-op `DepthStencilState`. /// Like `bitmap_opaque`, but with a no-op `DepthStencilState`.
/// This is used when we're inside a `RenderPass` that is /// This is used when we're inside a `RenderPass` that is

View File

@ -58,7 +58,7 @@ pub fn analyze_main(opt: AnalyzeOpt) -> Result<(), std::io::Error> {
match r { match r {
Ok(fr) => fr, Ok(fr) => fr,
Err(e) => { Err(e) => {
// Treat unparseable CSV rows as a scanner panic // Treat unparsable CSV rows as a scanner panic
FileResults { FileResults {
error: Some(format!("{e}")), error: Some(format!("{e}")),
..FileResults::default() ..FileResults::default()

View File

@ -214,7 +214,7 @@ fn make_lzma_reader<'a, R: Read + 'a>(
// Bytes 0..5: LZMA properties // Bytes 0..5: LZMA properties
// Bytes 5..13: Uncompressed length // Bytes 5..13: Uncompressed length
// //
// To deal with the mangled header, use lzma_rs options to anually provide uncompressed length. // To deal with the mangled header, use lzma_rs options to manually provide uncompressed length.
// Read compressed length (ignored) // Read compressed length (ignored)
let _ = input.read_u32::<LittleEndian>()?; let _ = input.read_u32::<LittleEndian>()?;

View File

@ -87,7 +87,7 @@ impl Header {
/// The extended metadata of an SWF file. /// The extended metadata of an SWF file.
/// ///
/// This includes the SWF header data as well as metdata from the FileAttributes and /// This includes the SWF header data as well as metadata from the FileAttributes and
/// SetBackgroundColor tags. /// SetBackgroundColor tags.
/// ///
/// This metadata may not reflect the actual data inside a malformed SWF; for example, /// This metadata may not reflect the actual data inside a malformed SWF; for example,
@ -163,7 +163,7 @@ impl HeaderExt {
/// Whether this SWF contains XMP metadata in a Metadata tag. /// Whether this SWF contains XMP metadata in a Metadata tag.
#[inline] #[inline]
pub fn has_metdata(&self) -> bool { pub fn has_metadata(&self) -> bool {
self.file_attributes.contains(FileAttributes::HAS_METADATA) self.file_attributes.contains(FileAttributes::HAS_METADATA)
} }

View File

@ -10,7 +10,7 @@ use std::path::Path;
bitflags! { bitflags! {
/// A set of currently held-down mouse buttons. /// A set of currently held-down mouse buttons.
/// ///
/// Convertable from `MouseButton`, which is intended to represent ONE /// Convertible from `MouseButton`, which is intended to represent ONE
/// button being held or released. /// button being held or released.
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct MouseButtons: u8 { pub struct MouseButtons: u8 {

View File

@ -16,7 +16,7 @@ for (var red = 0; red < 256; red += 1) {
var destPixel:uint = (alpha << 24) | red; var destPixel:uint = (alpha << 24) | red;
var tmp = dest.clone(); var tmp = dest.clone();
tmp.setPixel32(0, 0, destPixel); tmp.setPixel32(0, 0, destPixel);
// Account for lossy rountrip caused by premultiply/unmulitply // Account for lossy roundtrip caused by premultiply/unmultiply
var expected = tmp.getPixel32(0, 0); var expected = tmp.getPixel32(0, 0);
tmp.copyPixels(source, new Rectangle(0, 0, 1, 1), new Point(0, 0), null, null, true); tmp.copyPixels(source, new Rectangle(0, 0, 1, 1), new Point(0, 0), null, null, true);
var roundTrip = tmp.getPixel32(0, 0); var roundTrip = tmp.getPixel32(0, 0);

View File

@ -79,9 +79,9 @@ package
* @param positionX X component of the camera's position * @param positionX X component of the camera's position
* @param positionY Y component of the camera's position * @param positionY Y component of the camera's position
* @param positionZ Z component of the camera's position * @param positionZ Z component of the camera's position
* @param targetX X compoennt of the point the camera is aiming at * @param targetX X component of the point the camera is aiming at
* @param targetY Y compoennt of the point the camera is aiming at * @param targetY Y component of the point the camera is aiming at
* @param targetZ Z compoennt of the point the camera is aiming at * @param targetZ Z component of the point the camera is aiming at
* @param upDirX X component of the direction considered to be "up" * @param upDirX X component of the direction considered to be "up"
* @param upDirX X component of the direction considered to be "up" * @param upDirX X component of the direction considered to be "up"
* @param upDirY Y component of the direction considered to be "up" * @param upDirY Y component of the direction considered to be "up"

View File

@ -48,7 +48,7 @@ package
stacks = MIN_STACKS; stacks = MIN_STACKS;
} }
// Pre-compute many constants used in tesselation // Pre-compute many constants used in tessellation
const stepTheta:Number = (2.0*Math.PI) / slices; const stepTheta:Number = (2.0*Math.PI) / slices;
const stepPhi:Number = Math.PI / stacks; const stepPhi:Number = Math.PI / stacks;
const stepU:Number = 1.0 / slices; const stepU:Number = 1.0 / slices;
@ -56,7 +56,7 @@ package
const verticesPerStack:uint = slices + 1; const verticesPerStack:uint = slices + 1;
const numVertices:uint = verticesPerStack * (stacks+1); const numVertices:uint = verticesPerStack * (stacks+1);
// Allocate the vectors of data to tesselate into // Allocate the vectors of data to tessellate into
var positions:Vector.<Number> = new Vector.<Number>(numVertices*3); var positions:Vector.<Number> = new Vector.<Number>(numVertices*3);
var texCoords:Vector.<Number> = new Vector.<Number>(numVertices*2); var texCoords:Vector.<Number> = new Vector.<Number>(numVertices*2);
var tris:Vector.<uint> = new Vector.<uint>(slices*stacks*6); var tris:Vector.<uint> = new Vector.<uint>(slices*stacks*6);

View File

@ -30,7 +30,7 @@ function isFlashEnabledBrowser(): boolean {
if ("favorFlash" in globalConfig && globalConfig["favorFlash"] === false) { if ("favorFlash" in globalConfig && globalConfig["favorFlash"] === false) {
return false; return false;
} }
// Otherwise, check for pre-exisiting Flash support. // Otherwise, check for pre-existing Flash support.
return ( return (
(navigator.plugins.namedItem("Shockwave Flash")?.filename ?? (navigator.plugins.namedItem("Shockwave Flash")?.filename ??
"ruffle.js") !== "ruffle.js" "ruffle.js") !== "ruffle.js"

View File

@ -19,7 +19,7 @@ declare global {
* Represents a potential installation of a Ruffle public API. * Represents a potential installation of a Ruffle public API.
* *
* Unlike [[PublicAPI]], this may come from any source, past or future. * Unlike [[PublicAPI]], this may come from any source, past or future.
* It needs to be forwards compatible and convertable into a modern day [[PublicAPI]]. * It needs to be forwards compatible and convertible into a modern day [[PublicAPI]].
*/ */
interface PublicAPILike { interface PublicAPILike {
config?: DataLoadOptions | URLLoadOptions | object; config?: DataLoadOptions | URLLoadOptions | object;

View File

@ -2174,7 +2174,7 @@ export class RufflePlayer extends HTMLElement {
]); ]);
break; break;
case PanicError.JavascriptConflict: case PanicError.JavascriptConflict:
// Self hosted: Cannot load `.wasm` file - a native object / function is overriden // Self hosted: Cannot load `.wasm` file - a native object / function is overridden
errorBody = textAsParagraphs("error-javascript-conflict"); errorBody = textAsParagraphs("error-javascript-conflict");
if (isBuildOutdated) { if (isBuildOutdated) {
errorBody.appendChild( errorBody.appendChild(
@ -2189,7 +2189,7 @@ export class RufflePlayer extends HTMLElement {
]); ]);
break; break;
case PanicError.CSPConflict: case PanicError.CSPConflict:
// General error: Cannot load `.wasm` file - a native object / function is overriden // General error: Cannot load `.wasm` file - a native object / function is overridden
errorBody = textAsParagraphs("error-csp-conflict"); errorBody = textAsParagraphs("error-csp-conflict");
errorFooter = this.createErrorFooter([ errorFooter = this.createErrorFooter([
new PanicLinkInfo( new PanicLinkInfo(

View File

@ -9,7 +9,7 @@ use core::ptr::NonNull;
use super::utils::{encode_raw_utf16, split_ascii_prefix, split_ascii_prefix_bytes, DecodeAvmUtf8}; use super::utils::{encode_raw_utf16, split_ascii_prefix, split_ascii_prefix_bytes, DecodeAvmUtf8};
use super::{ptr, Units, WStr, WStrMetadata}; use super::{ptr, Units, WStr, WStrMetadata};
/// An owned, extensible UCS2 string, analoguous to `String`. /// An owned, extensible UCS2 string, analogous to `String`.
pub struct WString { pub struct WString {
data: NonNull<()>, data: NonNull<()>,
meta: WStrMetadata, meta: WStrMetadata,

View File

@ -3,7 +3,7 @@ use core::ops::{Bound, Index, IndexMut, Range, RangeBounds};
use super::{ptr, FromWStr, Pattern, WString}; use super::{ptr, FromWStr, Pattern, WString};
/// A UCS2 string slice, analoguous to `&'a str`. /// A UCS2 string slice, analogous to `&'a str`.
#[repr(transparent)] #[repr(transparent)]
pub struct WStr { pub struct WStr {
/// See the `ptr` module for more details. /// See the `ptr` module for more details.