avm2: Hookup `DisplayObject.opaqueBackground`
This commit is contained in:
parent
8fa00de8a8
commit
5632ade09c
|
@ -1005,28 +1005,34 @@ pub fn set_cache_as_bitmap<'gc>(
|
||||||
|
|
||||||
/// `opaqueBackground`'s getter.
|
/// `opaqueBackground`'s getter.
|
||||||
pub fn get_opaque_background<'gc>(
|
pub fn get_opaque_background<'gc>(
|
||||||
activation: &mut Activation<'_, 'gc>,
|
_activation: &mut Activation<'_, 'gc>,
|
||||||
_this: Option<Object<'gc>>,
|
this: Option<Object<'gc>>,
|
||||||
_args: &[Value<'gc>],
|
_args: &[Value<'gc>],
|
||||||
) -> Result<Value<'gc>, Error<'gc>> {
|
) -> Result<Value<'gc>, Error<'gc>> {
|
||||||
avm2_stub_getter!(
|
if let Some(color) = this
|
||||||
activation,
|
.and_then(|this| this.as_display_object())
|
||||||
"flash.display.DisplayObject",
|
.and_then(|this| this.opaque_background())
|
||||||
"opaqueBackground"
|
{
|
||||||
);
|
return Ok(color.to_rgb().into());
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `opaqueBackground`'s setter.
|
/// `opaqueBackground`'s setter.
|
||||||
pub fn set_opaque_background<'gc>(
|
pub fn set_opaque_background<'gc>(
|
||||||
activation: &mut Activation<'_, 'gc>,
|
activation: &mut Activation<'_, 'gc>,
|
||||||
_this: Option<Object<'gc>>,
|
this: Option<Object<'gc>>,
|
||||||
_args: &[Value<'gc>],
|
args: &[Value<'gc>],
|
||||||
) -> Result<Value<'gc>, Error<'gc>> {
|
) -> Result<Value<'gc>, Error<'gc>> {
|
||||||
avm2_stub_setter!(
|
if let Some(dobj) = this.and_then(|this| this.as_display_object()) {
|
||||||
activation,
|
let value = args.get(0).unwrap_or(&Value::Undefined);
|
||||||
"flash.display.DisplayObject",
|
let color = match value {
|
||||||
"opaqueBackground"
|
Value::Null | Value::Undefined => None,
|
||||||
);
|
value => Some(Color::from_rgb(value.coerce_to_u32(activation)?, 255)),
|
||||||
|
};
|
||||||
|
dobj.set_opaque_background(activation.context.gc_context, color);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Value::Undefined)
|
Ok(Value::Undefined)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
null
|
||||||
|
255
|
||||||
|
null
|
||||||
|
255
|
||||||
|
null
|
||||||
|
255
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,9 @@
|
||||||
|
num_frames = 1
|
||||||
|
# FIXME - does not rendered correctly
|
||||||
|
ignore = true
|
||||||
|
|
||||||
|
[image_comparison]
|
||||||
|
tolerance = 1
|
||||||
|
|
||||||
|
[player_options]
|
||||||
|
with_renderer = { optional = true, sample_count = 1 }
|
Loading…
Reference in New Issue