Skip to content

Commit f03863f

Browse files
authored
feat(ext/canvas): transform matrix (#157)
1 parent e592cad commit f03863f

File tree

9 files changed

+441
-147
lines changed

9 files changed

+441
-147
lines changed

Cargo.lock

Lines changed: 104 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = ["the Andromeda team"]
77
edition = "2024"
88
license = "Mozilla Public License 2.0"
99
repository = "https://github.com/tryandromeda/andromeda"
10-
version = "0.1.0-draft44"
10+
version = "0.1.0-draft45"
1111

1212
[workspace.dependencies]
1313
andromeda-core = { path = "core" }
@@ -40,24 +40,24 @@ libffi = "4.1.2"
4040
libsui = "0.10.0"
4141
log = "0.4.28"
4242
lsp-types = "0.97.0"
43-
nova_vm = { git = "https://github.com/trynova/nova", rev = "d0fdb7e364cba56d09e09ec1d1d7242caece7bd9", features = [
43+
nova_vm = { git = "https://github.com/trynova/nova", rev = "81774d30bd814d8b7ea050e252557890f76c9b69", features = [
4444
"typescript",
4545
"annex-b",
4646
"proposals"
4747
] }
4848
nu-ansi-term = "0.50.1"
49-
owo-colors = "4.2.2"
50-
oxc_codegen = "0.90.0"
51-
oxc_ast = "0.90.0"
52-
oxc_minifier = "0.90.0"
53-
oxc_mangler = "0.90.0"
54-
oxc_allocator = "0.90.0"
55-
oxc_diagnostics = "0.90.0"
56-
oxc-miette = { version = "2.5.0", features = ["fancy"] }
57-
oxc_parser = "0.90.0"
58-
oxc_semantic = "0.90.0"
59-
oxc_span = "0.90.0"
60-
oxc_transformer = "0.90.0"
49+
owo-colors = "4.2.3"
50+
oxc_codegen = "0.93.0"
51+
oxc_ast = "0.93.0"
52+
oxc_minifier = "0.93.0"
53+
oxc_mangler = "0.93.0"
54+
oxc_allocator = "0.93.0"
55+
oxc_diagnostics = "0.93.0"
56+
oxc-miette = { version = "2.5.1", features = ["fancy"] }
57+
oxc_parser = "0.93.0"
58+
oxc_semantic = "0.93.0"
59+
oxc_span = "0.93.0"
60+
oxc_transformer = "0.93.0"
6161
rand = "0.9.2"
6262
reedline = "0.42.0"
6363
regex = "1.11.3"
@@ -71,14 +71,14 @@ rusqlite = { version = "0.37.0", features = [
7171
"load_extension"
7272
] }
7373
saffron = "0.1.0"
74-
serde = { version = "1.0.227", features = ["derive"] }
74+
serde = { version = "1.0.228", features = ["derive"] }
7575
serde_json = "1.0.145"
7676
serde_yaml = "0.9.34-deprecated"
7777
socket2 = "0.6.0"
7878
toml = "0.9.7"
7979
trust-dns-resolver = "0.23.2"
8080
signal-hook = "0.3.18"
81-
thiserror = "2.0.16"
81+
thiserror = "2.0.17"
8282
tempfile = "3.23.0"
8383
tokio = { version = "1.47.1", features = ["rt", "sync", "time", "fs"] }
8484
tokio-rustls = "0.26.4"

cli/src/check.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ pub fn check_file_content_with_config(
314314

315315
let semantic_ret = SemanticBuilder::new()
316316
.with_check_syntax_error(true)
317-
.with_build_jsdoc(true)
318317
.with_cfg(true)
319318
.build(program);
320319

runtime/src/ext/canvas/context2d.rs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use super::FillStyle;
77
use super::Rid;
88
use super::renderer::{Point, Rect};
99
use crate::RuntimeMacroTask;
10-
use crate::ext::canvas::renderer::RenderState;
10+
use crate::ext::canvas::renderer::{LineCap, LineJoin, RenderState};
1111
use andromeda_core::HostData;
1212
use nova_vm::ecmascript::types::Number;
1313
use nova_vm::{
@@ -459,6 +459,10 @@ pub fn internal_canvas_clear_rect<'gc>(
459459
a: 0.0,
460460
},
461461
global_alpha: 1.0,
462+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
463+
line_cap: LineCap::default(),
464+
line_join: LineJoin::default(),
465+
miter_limit: 10.0,
462466
},
463467
);
464468
} else {
@@ -560,6 +564,10 @@ pub fn internal_canvas_fill_rect<'gc>(
560564
&RenderState {
561565
fill_style: data.fill_style,
562566
global_alpha: data.global_alpha,
567+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
568+
line_cap: LineCap::default(),
569+
line_join: LineJoin::default(),
570+
miter_limit: 10.0,
563571
},
564572
);
565573
} else {
@@ -692,6 +700,10 @@ pub fn internal_canvas_fill<'gc>(
692700
&RenderState {
693701
fill_style: data.fill_style,
694702
global_alpha: data.global_alpha,
703+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
704+
line_cap: LineCap::default(),
705+
line_join: LineJoin::default(),
706+
miter_limit: 10.0,
695707
},
696708
);
697709
}
@@ -735,6 +747,10 @@ pub fn internal_canvas_stroke<'gc>(
735747
&RenderState {
736748
fill_style: data.stroke_style,
737749
global_alpha: data.global_alpha,
750+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
751+
line_cap: LineCap::default(),
752+
line_join: LineJoin::default(),
753+
miter_limit: 10.0,
738754
},
739755
);
740756
}
@@ -1150,6 +1166,9 @@ pub fn internal_canvas_save<'gc>(
11501166
transform: data.transform,
11511167
line_dash: data.line_dash.clone(),
11521168
line_dash_offset: data.line_dash_offset,
1169+
line_cap: LineCap::default(),
1170+
line_join: LineJoin::default(),
1171+
miter_limit: 10.0,
11531172
};
11541173
data.state_stack.push(current_state);
11551174

@@ -1336,6 +1355,10 @@ pub fn process_all_commands<'gc>(
13361355
&RenderState {
13371356
fill_style: fill_style.clone(),
13381357
global_alpha,
1358+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
1359+
line_cap: LineCap::default(),
1360+
line_join: LineJoin::default(),
1361+
miter_limit: 10.0,
13391362
},
13401363
);
13411364
}
@@ -1347,6 +1370,10 @@ pub fn process_all_commands<'gc>(
13471370
&RenderState {
13481371
fill_style: stroke_style.clone(),
13491372
global_alpha,
1373+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
1374+
line_cap: LineCap::default(),
1375+
line_join: LineJoin::default(),
1376+
miter_limit: 10.0,
13501377
},
13511378
line_width,
13521379
);
@@ -1375,6 +1402,10 @@ pub fn process_all_commands<'gc>(
13751402
&RenderState {
13761403
fill_style: fill_style.clone(),
13771404
global_alpha,
1405+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
1406+
line_cap: LineCap::default(),
1407+
line_join: LineJoin::default(),
1408+
miter_limit: 10.0,
13781409
},
13791410
);
13801411
}
@@ -1411,6 +1442,10 @@ pub fn process_all_commands<'gc>(
14111442
&RenderState {
14121443
fill_style: stroke_style.clone(),
14131444
global_alpha,
1445+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
1446+
line_cap: LineCap::default(),
1447+
line_join: LineJoin::default(),
1448+
miter_limit: 10.0,
14141449
},
14151450
line_width,
14161451
);
@@ -1444,6 +1479,10 @@ pub fn process_all_commands<'gc>(
14441479
a: 1.0,
14451480
},
14461481
global_alpha: 1.0,
1482+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
1483+
line_cap: LineCap::default(),
1484+
line_join: LineJoin::default(),
1485+
miter_limit: 10.0,
14471486
},
14481487
); // White background
14491488
}

runtime/src/ext/canvas/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::ext::canvas::context2d::{
1515
};
1616
use crate::ext::canvas::fill_style::{ConicGradient, LinearGradient, RadialGradient};
1717
use crate::ext::canvas::path2d::{FillRule, Path2D};
18-
use crate::ext::canvas::renderer::{ColorStop, Point, Rect, RenderState};
18+
use crate::ext::canvas::renderer::{ColorStop, LineCap, LineJoin, Point, Rect, RenderState};
1919
pub use fill_style::FillStyle;
2020

2121
use crate::ext::canvas::context2d::{
@@ -1895,6 +1895,10 @@ impl CanvasExt {
18951895
let render_state = RenderState {
18961896
fill_style: stroke_style,
18971897
global_alpha: canvas.global_alpha,
1898+
transform: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
1899+
line_cap: LineCap::default(),
1900+
line_join: LineJoin::default(),
1901+
miter_limit: 10.0,
18981902
};
18991903

19001904
renderer.render_stroke_rect(rect, &render_state, stroke_color, line_width as f32);

0 commit comments

Comments
 (0)