core: Ensure bitmaps run post_instantiate
This commit is contained in:
parent
1f96af6b64
commit
4687eb6d4e
|
@ -221,6 +221,13 @@ fn attach_bitmap<'gc>(
|
||||||
display_object.into(),
|
display_object.into(),
|
||||||
depth,
|
depth,
|
||||||
);
|
);
|
||||||
|
display_object.post_instantiation(
|
||||||
|
&mut activation.context,
|
||||||
|
display_object.into(),
|
||||||
|
None,
|
||||||
|
Instantiator::Avm1,
|
||||||
|
true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
//! Bitmap display object
|
//! Bitmap display object
|
||||||
|
|
||||||
|
use crate::avm1;
|
||||||
use crate::backend::render::BitmapHandle;
|
use crate::backend::render::BitmapHandle;
|
||||||
use crate::context::{RenderContext, UpdateContext};
|
use crate::context::{RenderContext, UpdateContext};
|
||||||
use crate::display_object::{DisplayObjectBase, TDisplayObject};
|
use crate::display_object::{DisplayObjectBase, TDisplayObject};
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::types::{Degrees, Percent};
|
use crate::types::{Degrees, Percent};
|
||||||
|
use crate::vminterface::{AvmType, Instantiator};
|
||||||
use gc_arena::{Collect, Gc, GcCell};
|
use gc_arena::{Collect, Gc, GcCell};
|
||||||
|
|
||||||
/// A Bitmap display object is a raw bitamp on the stage.
|
/// A Bitmap display object is a raw bitamp on the stage.
|
||||||
|
@ -97,6 +99,25 @@ impl<'gc> TDisplayObject<'gc> for Bitmap<'gc> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn post_instantiation(
|
||||||
|
&self,
|
||||||
|
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||||
|
_display_object: DisplayObject<'gc>,
|
||||||
|
_init_object: Option<avm1::Object<'gc>>,
|
||||||
|
_instantiated_by: Instantiator,
|
||||||
|
run_frame: bool,
|
||||||
|
) {
|
||||||
|
if self.avm_type() == AvmType::Avm1 {
|
||||||
|
context
|
||||||
|
.avm1
|
||||||
|
.add_to_exec_list(context.gc_context, (*self).into());
|
||||||
|
}
|
||||||
|
|
||||||
|
if run_frame {
|
||||||
|
self.run_frame(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn run_frame(&self, context: &mut UpdateContext<'_, 'gc, '_>) {
|
fn run_frame(&self, context: &mut UpdateContext<'_, 'gc, '_>) {
|
||||||
if let Some(bitmap_data) = &self.0.read().bitmap_data {
|
if let Some(bitmap_data) = &self.0.read().bitmap_data {
|
||||||
let bd = bitmap_data.read();
|
let bd = bitmap_data.read();
|
||||||
|
|
Loading…
Reference in New Issue