avm2: Stub `Bitmap.pixelSmoothing`

This commit is contained in:
David Wendt 2021-09-06 20:23:52 -04:00 committed by Mike Welsh
parent 8ae669b96c
commit 2ba0e12b7e
1 changed files with 26 additions and 1 deletions

View File

@ -143,6 +143,24 @@ pub fn set_bitmap_data<'gc>(
Ok(Value::Undefined)
}
/// Stub `Bitmap.pixelSnapping`'s getter
pub fn pixel_snapping<'gc>(
_activation: &mut Activation<'_, 'gc, '_>,
_this: Option<Object<'gc>>,
_args: &[Value<'gc>],
) -> Result<Value<'gc>, Error> {
Ok("auto".into())
}
/// Stub `Bitmap.pixelSnapping`'s getter
pub fn set_pixel_snapping<'gc>(
_activation: &mut Activation<'_, 'gc, '_>,
_this: Option<Object<'gc>>,
_args: &[Value<'gc>],
) -> Result<Value<'gc>, Error> {
Err("Bitmap.pixelSnapping is a stub".into())
}
/// Construct `Bitmap`'s class.
pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>> {
let class = Class::new(
@ -161,7 +179,14 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
&str,
Option<NativeMethodImpl>,
Option<NativeMethodImpl>,
)] = &[("bitmapData", Some(bitmap_data), Some(set_bitmap_data))];
)] = &[
("bitmapData", Some(bitmap_data), Some(set_bitmap_data)),
(
"pixelSnapping",
Some(pixel_snapping),
Some(set_pixel_snapping),
),
];
write.define_public_builtin_instance_properties(mc, PUBLIC_INSTANCE_PROPERTIES);
class