core: Correctly apply blend modes and filters from button records

This commit is contained in:
Lord-McSweeney 2023-07-04 10:39:46 -07:00 committed by Nathan Adams
parent c943866745
commit 275c42b39c
2 changed files with 12 additions and 0 deletions

View File

@ -14,6 +14,7 @@ use crate::tag_utils::{SwfMovie, SwfSlice};
use crate::vminterface::Instantiator; use crate::vminterface::Instantiator;
use core::fmt; use core::fmt;
use gc_arena::{Collect, GcCell, MutationContext}; use gc_arena::{Collect, GcCell, MutationContext};
use ruffle_render::filters::Filter;
use std::cell::{Ref, RefMut}; use std::cell::{Ref, RefMut};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::sync::Arc; use std::sync::Arc;
@ -173,6 +174,11 @@ impl<'gc> Avm1Button<'gc> {
// Set transform of child (and modify previous child if it already existed) // Set transform of child (and modify previous child if it already existed)
child.set_matrix(context.gc_context, record.matrix.into()); child.set_matrix(context.gc_context, record.matrix.into());
child.set_color_transform(context.gc_context, record.color_transform); child.set_color_transform(context.gc_context, record.color_transform);
child.set_blend_mode(context.gc_context, record.blend_mode);
child.set_filters(
context.gc_context,
record.filters.iter().map(Filter::from).collect(),
);
} }
} }

View File

@ -18,6 +18,7 @@ use crate::tag_utils::{SwfMovie, SwfSlice};
use crate::vminterface::Instantiator; use crate::vminterface::Instantiator;
use core::fmt; use core::fmt;
use gc_arena::{Collect, GcCell, MutationContext}; use gc_arena::{Collect, GcCell, MutationContext};
use ruffle_render::filters::Filter;
use std::cell::{Ref, RefMut}; use std::cell::{Ref, RefMut};
use std::sync::Arc; use std::sync::Arc;
@ -211,6 +212,11 @@ impl<'gc> Avm2Button<'gc> {
if swf_state != swf::ButtonState::HIT_TEST { if swf_state != swf::ButtonState::HIT_TEST {
child.set_color_transform(context.gc_context, record.color_transform); child.set_color_transform(context.gc_context, record.color_transform);
child.set_blend_mode(context.gc_context, record.blend_mode);
child.set_filters(
context.gc_context,
record.filters.iter().map(Filter::from).collect(),
);
} }
children.push((child, record.depth)); children.push((child, record.depth));