Skip to content

Commit f5074ff

Browse files
committed
core: Remove now-unused (gc_)context args in TDisplayObject
1 parent e919e57 commit f5074ff

29 files changed

+268
-329
lines changed

core/src/avm1/globals/button.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ fn blend_mode<'gc>(
7070

7171
fn set_blend_mode<'gc>(
7272
this: Avm1Button<'gc>,
73-
activation: &mut Activation<'_, 'gc>,
73+
_activation: &mut Activation<'_, 'gc>,
7474
value: Value<'gc>,
7575
) -> Result<(), Error<'gc>> {
7676
// No-op if value is not a valid blend mode.
7777
if let Some(mode) = value.as_blend_mode() {
78-
this.set_blend_mode(activation.gc(), mode.into());
78+
this.set_blend_mode(mode.into());
7979
} else {
8080
tracing::error!("Unknown blend mode {value:?}");
8181
}
@@ -109,7 +109,7 @@ fn set_filters<'gc>(
109109
}
110110
}
111111
}
112-
this.set_filters(activation.gc(), filters);
112+
this.set_filters(filters);
113113
Ok(())
114114
}
115115

@@ -127,7 +127,7 @@ fn set_cache_as_bitmap<'gc>(
127127
value: Value<'gc>,
128128
) -> Result<(), Error<'gc>> {
129129
// Note that the *getter* returns actual, and *setter* is preference
130-
this.set_bitmap_cached_preference(activation.gc(), value.as_bool(activation.swf_version()));
130+
this.set_bitmap_cached_preference(value.as_bool(activation.swf_version()));
131131
Ok(())
132132
}
133133

core/src/avm1/globals/color.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn set_rgb<'gc>(
133133
if let Some(target) = target(activation, this)? {
134134
target.set_transformed_by_script(true);
135135
if let Some(parent) = target.parent() {
136-
parent.invalidate_cached_bitmap(activation.gc());
136+
parent.invalidate_cached_bitmap();
137137
}
138138

139139
let rgb = args
@@ -196,7 +196,7 @@ fn set_transform<'gc>(
196196
if let Some(target) = target(activation, this)? {
197197
target.set_transformed_by_script(true);
198198
if let Some(parent) = target.parent() {
199-
parent.invalidate_cached_bitmap(activation.gc());
199+
parent.invalidate_cached_bitmap();
200200
}
201201

202202
let base = target.base();

core/src/avm1/globals/movie_clip.rs

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ fn set_scroll_rect<'gc>(
177177
if let Value::Object(object) = value {
178178
this.set_has_scroll_rect(true);
179179
if let Some(rectangle) = object_to_rectangle(activation, object)? {
180-
this.set_next_scroll_rect(activation.gc(), rectangle);
180+
this.set_next_scroll_rect(rectangle);
181181
}
182182
} else {
183183
this.set_has_scroll_rect(false);
@@ -391,11 +391,9 @@ fn line_style<'gc>(
391391
.with_allow_scale_y(allow_scale_y)
392392
.with_is_pixel_hinted(is_pixel_hinted)
393393
.with_allow_close(false);
394-
movie_clip
395-
.drawing_mut(activation.gc())
396-
.set_line_style(Some(line_style));
394+
movie_clip.drawing_mut().set_line_style(Some(line_style));
397395
} else {
398-
movie_clip.drawing_mut(activation.gc()).set_line_style(None);
396+
movie_clip.drawing_mut().set_line_style(None);
399397
}
400398
Ok(Value::Undefined)
401399
}
@@ -475,9 +473,7 @@ fn line_gradient_style<'gc>(
475473
focal_point: Fixed8::from_f64(focal_point),
476474
},
477475
};
478-
movie_clip
479-
.drawing_mut(activation.gc())
480-
.set_line_fill_style(style);
476+
movie_clip.drawing_mut().set_line_fill_style(style);
481477
}
482478
Ok(Value::Undefined)
483479
}
@@ -569,10 +565,10 @@ fn begin_fill<'gc>(
569565
/ 100.0
570566
* 255.0;
571567
movie_clip
572-
.drawing_mut(activation.gc())
568+
.drawing_mut()
573569
.set_fill_style(Some(FillStyle::Color(Color::from_rgb(rgb, alpha as u8))));
574570
} else {
575-
movie_clip.drawing_mut(activation.gc()).set_fill_style(None);
571+
movie_clip.drawing_mut().set_fill_style(None);
576572
}
577573
Ok(Value::Undefined)
578574
}
@@ -591,7 +587,7 @@ fn begin_bitmap_fill<'gc>(
591587
width: bitmap_data.width() as u16,
592588
height: bitmap_data.height() as u16,
593589
};
594-
let id = movie_clip.drawing_mut(activation.gc()).add_bitmap(bitmap);
590+
let id = movie_clip.drawing_mut().add_bitmap(bitmap);
595591

596592
let mut matrix = avm1::globals::matrix::object_to_matrix_or_default(
597593
args.get(1)
@@ -624,9 +620,7 @@ fn begin_bitmap_fill<'gc>(
624620
} else {
625621
None
626622
};
627-
movie_clip
628-
.drawing_mut(activation.gc())
629-
.set_fill_style(fill_style);
623+
movie_clip.drawing_mut().set_fill_style(fill_style);
630624
Ok(Value::Undefined)
631625
}
632626

@@ -637,7 +631,7 @@ fn begin_gradient_fill<'gc>(
637631
) -> Result<Value<'gc>, Error<'gc>> {
638632
if Value::Undefined == *args.get(0).unwrap_or(&Value::Undefined) {
639633
// The path has no fill if the first parameter is `undefined`, or if no parameters are passed.
640-
movie_clip.drawing_mut(activation.gc()).set_fill_style(None);
634+
movie_clip.drawing_mut().set_fill_style(None);
641635
} else if let (Some(gradient_type), Some(colors), Some(alphas), Some(ratios), Some(matrix)) = (
642636
args.get(0),
643637
args.get(1),
@@ -700,9 +694,7 @@ fn begin_gradient_fill<'gc>(
700694
focal_point: Fixed8::from_f64(focal_point),
701695
},
702696
};
703-
movie_clip
704-
.drawing_mut(activation.gc())
705-
.set_fill_style(Some(style));
697+
movie_clip.drawing_mut().set_fill_style(Some(style));
706698
}
707699
Ok(Value::Undefined)
708700
}
@@ -716,7 +708,7 @@ fn move_to<'gc>(
716708
let x = x.coerce_to_f64(activation)?;
717709
let y = y.coerce_to_f64(activation)?;
718710
movie_clip
719-
.drawing_mut(activation.gc())
711+
.drawing_mut()
720712
.draw_command(DrawCommand::MoveTo(Point::from_pixels(x, y)));
721713
}
722714
Ok(Value::Undefined)
@@ -731,7 +723,7 @@ fn line_to<'gc>(
731723
let x = x.coerce_to_f64(activation)?;
732724
let y = y.coerce_to_f64(activation)?;
733725
movie_clip
734-
.drawing_mut(activation.gc())
726+
.drawing_mut()
735727
.draw_command(DrawCommand::LineTo(Point::from_pixels(x, y)));
736728
}
737729
Ok(Value::Undefined)
@@ -748,7 +740,7 @@ fn curve_to<'gc>(
748740
let anchor_x = anchor_x.coerce_to_f64(activation)?;
749741
let anchor_y = anchor_y.coerce_to_f64(activation)?;
750742
movie_clip
751-
.drawing_mut(activation.gc())
743+
.drawing_mut()
752744
.draw_command(DrawCommand::QuadraticCurveTo {
753745
control: Point::from_pixels(control_x, control_y),
754746
anchor: Point::from_pixels(anchor_x, anchor_y),
@@ -759,19 +751,19 @@ fn curve_to<'gc>(
759751

760752
fn end_fill<'gc>(
761753
movie_clip: MovieClip<'gc>,
762-
activation: &mut Activation<'_, 'gc>,
754+
_activation: &mut Activation<'_, 'gc>,
763755
_args: &[Value<'gc>],
764756
) -> Result<Value<'gc>, Error<'gc>> {
765-
movie_clip.drawing_mut(activation.gc()).set_fill_style(None);
757+
movie_clip.drawing_mut().set_fill_style(None);
766758
Ok(Value::Undefined)
767759
}
768760

769761
fn clear<'gc>(
770762
movie_clip: MovieClip<'gc>,
771-
activation: &mut Activation<'_, 'gc>,
763+
_activation: &mut Activation<'_, 'gc>,
772764
_args: &[Value<'gc>],
773765
) -> Result<Value<'gc>, Error<'gc>> {
774-
movie_clip.drawing_mut(activation.gc()).clear();
766+
movie_clip.drawing_mut().clear();
775767
Ok(Value::Undefined)
776768
}
777769

@@ -983,13 +975,13 @@ pub fn clone_sprite<'gc>(
983975
parent.replace_at_depth(context, new_clip.into(), depth);
984976

985977
// Copy display properties from previous clip to new clip.
986-
new_clip.set_matrix(context.gc(), movie_clip.base().matrix());
987-
new_clip.set_color_transform(context.gc(), movie_clip.base().color_transform());
978+
new_clip.set_matrix(movie_clip.base().matrix());
979+
new_clip.set_color_transform(movie_clip.base().color_transform());
988980

989981
new_clip.init_clip_event_handlers(movie_clip.clip_actions().into());
990982

991983
if let Some(drawing) = movie_clip.drawing().as_deref().cloned() {
992-
*new_clip.drawing_mut(context.gc()) = drawing;
984+
*new_clip.drawing_mut() = drawing;
993985
}
994986
// TODO: Any other properties we should copy...?
995987
// Definitely not Object properties.
@@ -1666,15 +1658,15 @@ fn set_transform<'gc>(
16661658
if let NativeObject::Transform(transform) = object.native() {
16671659
if let Some(clip) = transform.clip(activation) {
16681660
let matrix = clip.base().matrix();
1669-
this.set_matrix(activation.gc(), matrix);
1661+
this.set_matrix(matrix);
16701662

16711663
let color_transform = clip.base().color_transform();
1672-
this.set_color_transform(activation.gc(), color_transform);
1664+
this.set_color_transform(color_transform);
16731665

16741666
if let Some(parent) = this.parent() {
16751667
// Self-transform changes are automatically handled,
16761668
// we only want to inform ancestors to avoid unnecessary invalidations for tx/ty
1677-
parent.invalidate_cached_bitmap(activation.gc());
1669+
parent.invalidate_cached_bitmap();
16781670
}
16791671

16801672
this.set_transformed_by_script(true);
@@ -1712,12 +1704,12 @@ fn blend_mode<'gc>(
17121704

17131705
fn set_blend_mode<'gc>(
17141706
this: MovieClip<'gc>,
1715-
activation: &mut Activation<'_, 'gc>,
1707+
_activation: &mut Activation<'_, 'gc>,
17161708
value: Value<'gc>,
17171709
) -> Result<(), Error<'gc>> {
17181710
// No-op if value is not a valid blend mode.
17191711
if let Some(mode) = value.as_blend_mode() {
1720-
this.set_blend_mode(activation.gc(), mode.into());
1712+
this.set_blend_mode(mode.into());
17211713
} else {
17221714
tracing::error!("Unknown blend mode {value:?}");
17231715
}
@@ -1738,7 +1730,7 @@ fn set_cache_as_bitmap<'gc>(
17381730
value: Value<'gc>,
17391731
) -> Result<(), Error<'gc>> {
17401732
// Note that the *getter* returns actual, and *setter* is preference
1741-
this.set_bitmap_cached_preference(activation.gc(), value.as_bool(activation.swf_version()));
1733+
this.set_bitmap_cached_preference(value.as_bool(activation.swf_version()));
17421734
Ok(())
17431735
}
17441736

@@ -1759,12 +1751,9 @@ fn set_opaque_background<'gc>(
17591751
value: Value<'gc>,
17601752
) -> Result<(), Error<'gc>> {
17611753
if matches!(value, Value::Undefined | Value::Null) {
1762-
this.set_opaque_background(activation.gc(), None);
1754+
this.set_opaque_background(None);
17631755
} else {
1764-
this.set_opaque_background(
1765-
activation.gc(),
1766-
Some(Color::from_rgb(value.coerce_to_u32(activation)?, 255)),
1767-
);
1756+
this.set_opaque_background(Some(Color::from_rgb(value.coerce_to_u32(activation)?, 255)));
17681757
}
17691758
Ok(())
17701759
}
@@ -1796,7 +1785,7 @@ fn set_filters<'gc>(
17961785
}
17971786
}
17981787
}
1799-
this.set_filters(activation.gc(), filters);
1788+
this.set_filters(filters);
18001789
Ok(())
18011790
}
18021791

core/src/avm1/globals/selection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn set_selection<'gc>(
9191
.unwrap_or(i32::MAX)
9292
.max(0);
9393
let selection = TextSelection::for_range(start as usize, end as usize);
94-
edit_box.set_selection(Some(selection), activation.gc());
94+
edit_box.set_selection(Some(selection));
9595
}
9696
Ok(Value::Undefined)
9797
}

core/src/avm1/globals/text_field.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,9 @@ fn replace_sel<'gc>(
249249
&text,
250250
activation.context,
251251
);
252-
text_field.set_selection(
253-
Some(TextSelection::for_position(selection.start() + text.len())),
254-
activation.gc(),
255-
);
252+
text_field.set_selection(Some(TextSelection::for_position(
253+
selection.start() + text.len(),
254+
)));
256255

257256
text_field.propagate_text_binding(activation);
258257

@@ -390,7 +389,7 @@ pub fn set_background<'gc>(
390389
value: Value<'gc>,
391390
) -> Result<(), Error<'gc>> {
392391
let has_background = value.as_bool(activation.swf_version());
393-
this.set_has_background(activation.gc(), has_background);
392+
this.set_has_background(has_background);
394393
Ok(())
395394
}
396395

@@ -408,7 +407,7 @@ pub fn set_background_color<'gc>(
408407
) -> Result<(), Error<'gc>> {
409408
let rgb = value.coerce_to_u32(activation)?;
410409
let color = Color::from_rgb(rgb, 255);
411-
this.set_background_color(activation.gc(), color);
410+
this.set_background_color(color);
412411
Ok(())
413412
}
414413

@@ -425,7 +424,7 @@ pub fn set_border<'gc>(
425424
value: Value<'gc>,
426425
) -> Result<(), Error<'gc>> {
427426
let has_border = value.as_bool(activation.swf_version());
428-
this.set_has_border(activation.gc(), has_border);
427+
this.set_has_border(has_border);
429428
Ok(())
430429
}
431430

@@ -443,7 +442,7 @@ pub fn set_border_color<'gc>(
443442
) -> Result<(), Error<'gc>> {
444443
let rgb = value.coerce_to_u32(activation)?;
445444
let color = Color::from_rgb(rgb, 255);
446-
this.set_border_color(activation.gc(), color);
445+
this.set_border_color(color);
447446
Ok(())
448447
}
449448

@@ -651,7 +650,7 @@ pub fn set_hscroll<'gc>(
651650
// SWF v8 and earlier has the simple clamping behaviour below. SWF v9+ is much more complicated. See #4634.
652651
let hscroll_pixels = value.coerce_to_i32(activation)? as f64;
653652
let clamped = hscroll_pixels.clamp(0.0, this.maxhscroll());
654-
this.set_hscroll(clamped, activation.context);
653+
this.set_hscroll(clamped);
655654
Ok(())
656655
}
657656

@@ -675,7 +674,7 @@ pub fn set_scroll<'gc>(
675674
value: Value<'gc>,
676675
) -> Result<(), Error<'gc>> {
677676
let input = value.coerce_to_f64(activation)?;
678-
this.set_scroll(input, activation.context);
677+
this.set_scroll(input);
679678
Ok(())
680679
}
681680

@@ -842,7 +841,7 @@ fn set_filters<'gc>(
842841
}
843842
}
844843
}
845-
this.set_filters(activation.gc(), filters);
844+
this.set_filters(filters);
846845
Ok(())
847846
}
848847

core/src/avm1/globals/transform.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ fn method<'gc>(
100100
.all(|p| object.has_own_property(activation, *p));
101101
if is_matrix {
102102
let matrix = object_to_matrix(object, activation)?;
103-
clip.set_matrix(activation.gc(), matrix);
103+
clip.set_matrix(matrix);
104104
clip.set_transformed_by_script(true);
105105
if let Some(parent) = clip.parent() {
106106
// Self-transform changes are automatically handled,
107107
// we only want to inform ancestors to avoid unnecessary invalidations for tx/ty
108-
parent.invalidate_cached_bitmap(activation.gc());
108+
parent.invalidate_cached_bitmap();
109109
}
110110
}
111111
}
@@ -126,8 +126,8 @@ fn method<'gc>(
126126
if let [value] = args {
127127
// Set only occurs for an object with actual ColorTransform data.
128128
if let Some(color_transform) = ColorTransformObject::cast(*value) {
129-
clip.set_color_transform(activation.gc(), (*color_transform).clone().into());
130-
clip.invalidate_cached_bitmap(activation.gc());
129+
clip.set_color_transform((*color_transform).clone().into());
130+
clip.invalidate_cached_bitmap();
131131
clip.set_transformed_by_script(true);
132132
}
133133
}

0 commit comments

Comments
 (0)