avm1: Remove `TextFormatObject::set_text_format`

Use `text_format_mut` instead.
This commit is contained in:
relrelb 2022-01-09 21:52:55 +02:00 committed by relrelb
parent bb3ef68499
commit b79144c122
2 changed files with 1 additions and 6 deletions

View File

@ -471,7 +471,7 @@ pub fn constructor<'gc>(
args: &[Value<'gc>], args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
if let Some(this) = this.as_text_format_object() { if let Some(this) = this.as_text_format_object() {
let mut text_format = TextFormat::default(); let mut text_format = this.text_format_mut(activation.context.gc_context);
set_font( set_font(
activation, activation,
&mut text_format, &mut text_format,
@ -537,7 +537,6 @@ pub fn constructor<'gc>(
&mut text_format, &mut text_format,
args.get(12).unwrap_or(&Value::Undefined), args.get(12).unwrap_or(&Value::Undefined),
)?; )?;
this.set_text_format(activation.context.gc_context, text_format);
} }
Ok(this.into()) Ok(this.into())

View File

@ -58,10 +58,6 @@ impl<'gc> TextFormatObject<'gc> {
pub fn text_format_mut(&self, gc_context: MutationContext<'gc, '_>) -> RefMut<TextFormat> { pub fn text_format_mut(&self, gc_context: MutationContext<'gc, '_>) -> RefMut<TextFormat> {
RefMut::map(self.0.write(gc_context), |o| &mut o.text_format) RefMut::map(self.0.write(gc_context), |o| &mut o.text_format)
} }
pub fn set_text_format(&self, gc_context: MutationContext<'gc, '_>, text_format: TextFormat) {
self.0.write(gc_context).text_format = text_format
}
} }
impl<'gc> TObject<'gc> for TextFormatObject<'gc> { impl<'gc> TObject<'gc> for TextFormatObject<'gc> {