render: Remove `gc-arena` dependency

It was only used to make structs `#[derive(gc_arena::Collect)]`, and
generally it doesn't make much sense that `render` needs to be GC-aware.
So instead annotate `render` fields in `core` with `#[collect(require_static)]`.
This commit is contained in:
relrelb 2022-09-02 15:53:42 +03:00 committed by Mike Welsh
parent 696514862d
commit 0d6462cfab
10 changed files with 10 additions and 14 deletions

1
Cargo.lock generated
View File

@ -3125,7 +3125,6 @@ dependencies = [
"approx", "approx",
"downcast-rs", "downcast-rs",
"flate2", "flate2",
"gc-arena",
"gif", "gif",
"jpeg-decoder", "jpeg-decoder",
"log", "log",

View File

@ -148,6 +148,7 @@ pub struct BitmapData<'gc> {
/// ///
/// This is lazily initialized; a value of `None` indicates that /// This is lazily initialized; a value of `None` indicates that
/// initialization has not yet happened. /// initialization has not yet happened.
#[collect(require_static)]
bitmap_handle: Option<BitmapHandle>, bitmap_handle: Option<BitmapHandle>,
/// The AVM2 side of this `BitmapData`. /// The AVM2 side of this `BitmapData`.

View File

@ -58,6 +58,7 @@ pub struct DisplayObjectBase<'gc> {
parent: Option<DisplayObject<'gc>>, parent: Option<DisplayObject<'gc>>,
place_frame: u16, place_frame: u16,
depth: Depth, depth: Depth,
#[collect(require_static)]
transform: Transform, transform: Transform,
name: AvmString<'gc>, name: AvmString<'gc>,
clip_depth: Depth, clip_depth: Depth,

View File

@ -39,6 +39,7 @@ pub struct BitmapData<'gc> {
/// that it can be accessed without a mutation context. /// that it can be accessed without a mutation context.
/// ///
/// If this is `None`, then the bitmap does not render anything. /// If this is `None`, then the bitmap does not render anything.
#[collect(require_static)]
bitmap_handle: Option<BitmapHandle>, bitmap_handle: Option<BitmapHandle>,
/// Whether or not bitmap smoothing is enabled. /// Whether or not bitmap smoothing is enabled.

View File

@ -120,6 +120,7 @@ pub struct EditTextData<'gc> {
intrinsic_bounds: BoxBounds<Twips>, intrinsic_bounds: BoxBounds<Twips>,
/// The current intrinsic bounds of the text field. /// The current intrinsic bounds of the text field.
#[collect(require_static)]
bounds: BoundingBox, bounds: BoundingBox,
/// The AVM1 object handle /// The AVM1 object handle

View File

@ -86,6 +86,7 @@ pub struct StageData<'gc> {
use_bitmap_downsampling: bool, use_bitmap_downsampling: bool,
/// The bounds of the current viewport in twips, used for culling. /// The bounds of the current viewport in twips, used for culling.
#[collect(require_static)]
view_bounds: BoundingBox, view_bounds: BoundingBox,
/// The window mode of the viewport. /// The window mode of the viewport.

View File

@ -6,8 +6,7 @@ edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
[dependencies] [dependencies]
swf = {path = "../swf"} swf = { path = "../swf"}
gc-arena = { git = "https://github.com/ruffle-rs/gc-arena" }
log = "0.4" log = "0.4"
gif = "0.11.4" gif = "0.11.4"
png = { version = "0.17.5" } png = { version = "0.17.5" }

View File

@ -1,7 +1,4 @@
use gc_arena::Collect; #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Collect)]
#[collect(no_drop)]
pub struct BitmapHandle(pub usize); pub struct BitmapHandle(pub usize);
/// Info returned by the `register_bitmap` methods. /// Info returned by the `register_bitmap` methods.

View File

@ -1,9 +1,7 @@
use crate::matrix::Matrix; use crate::matrix::Matrix;
use gc_arena::Collect;
use swf::Twips; use swf::Twips;
#[derive(Clone, Collect, Debug, Default, Eq, PartialEq)] #[derive(Clone, Debug, Default, Eq, PartialEq)]
#[collect(require_static)]
pub struct BoundingBox { pub struct BoundingBox {
pub x_min: Twips, pub x_min: Twips,
pub y_min: Twips, pub y_min: Twips,

View File

@ -1,11 +1,9 @@
use crate::color_transform::ColorTransform; use crate::color_transform::ColorTransform;
use crate::matrix::Matrix; use crate::matrix::Matrix;
use gc_arena::Collect;
/// Represents the transform for a DisplayObject. /// Represents the transform for a DisplayObject.
/// This includes both the transformation matrix and the color transform. /// This includes both the transformation matrix and the color transform.
#[derive(Clone, Collect, Debug, Default)] #[derive(Clone, Debug, Default)]
#[collect(require_static)]
pub struct Transform { pub struct Transform {
pub matrix: Matrix, pub matrix: Matrix,
pub color_transform: ColorTransform, pub color_transform: ColorTransform,