render: Bail on attempts on panicking recursive render, part 2.

This commit is contained in:
Adrian Wielgosik 2022-10-17 20:59:28 +02:00 committed by Aaron Hill
parent 8d6241c9c4
commit bdc041677a
1 changed files with 11 additions and 9 deletions

View File

@ -1022,8 +1022,9 @@ impl<'gc> BitmapData<'gc> {
render_context.commands.push_blend_mode(blend_mode); render_context.commands.push_blend_mode(blend_mode);
match &mut source { match &mut source {
IBitmapDrawable::BitmapData(data) => { IBitmapDrawable::BitmapData(data) => {
let mut bitmap_data = data.write(context.gc_context); // if try_write fails,
// this is caused by recursive render attempt. TODO: support this.
if let Ok(mut bitmap_data) = data.try_write(context.gc_context) {
bitmap_data.update_dirty_texture(&mut render_context); bitmap_data.update_dirty_texture(&mut render_context);
let bitmap_handle = bitmap_data.bitmap_handle(render_context.renderer).unwrap(); let bitmap_handle = bitmap_data.bitmap_handle(render_context.renderer).unwrap();
render_context.commands.render_bitmap( render_context.commands.render_bitmap(
@ -1032,6 +1033,7 @@ impl<'gc> BitmapData<'gc> {
smoothing, smoothing,
); );
} }
}
IBitmapDrawable::DisplayObject(object) => { IBitmapDrawable::DisplayObject(object) => {
// Note that we do *not* use `render_base`, // Note that we do *not* use `render_base`,
// as we want to ignore the object's mask and normal transform // as we want to ignore the object's mask and normal transform