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.
|
||||
pub fn get_opaque_background<'gc>(
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
_this: Option<Object<'gc>>,
|
||||
_activation: &mut Activation<'_, 'gc>,
|
||||
this: Option<Object<'gc>>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm2_stub_getter!(
|
||||
activation,
|
||||
"flash.display.DisplayObject",
|
||||
"opaqueBackground"
|
||||
);
|
||||
if let Some(color) = this
|
||||
.and_then(|this| this.as_display_object())
|
||||
.and_then(|this| this.opaque_background())
|
||||
{
|
||||
return Ok(color.to_rgb().into());
|
||||
}
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
||||
/// `opaqueBackground`'s setter.
|
||||
pub fn set_opaque_background<'gc>(
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
_this: Option<Object<'gc>>,
|
||||
_args: &[Value<'gc>],
|
||||
this: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm2_stub_setter!(
|
||||
activation,
|
||||
"flash.display.DisplayObject",
|
||||
"opaqueBackground"
|
||||
);
|
||||
if let Some(dobj) = this.and_then(|this| this.as_display_object()) {
|
||||
let value = args.get(0).unwrap_or(&Value::Undefined);
|
||||
let color = match value {
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -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