Skip to content

Commit 1b760f5

Browse files
committed
chore: clean up
(cherry picked from commit 0aa878b)
1 parent d48b272 commit 1b760f5

165 files changed

Lines changed: 10738 additions & 7667 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.toml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,53 @@ members = [
2020
panic = "abort"
2121
codegen-units = 1
2222
lto = true
23-
opt-level = 3
23+
opt-level = "s" # size-optimized default; hot rendering crates overridden below
2424
debug = false
2525
incremental = false
2626
strip = true
2727

28+
# Keep rendering-critical crates at full speed
29+
[profile.release.package.canvas-2d]
30+
opt-level = 3
31+
32+
[profile.release.package.canvas-core]
33+
opt-level = 3
34+
35+
[profile.release.package.canvas-webgl]
36+
opt-level = 3
37+
38+
[profile.release.package.skia-safe]
39+
opt-level = 3
40+
41+
[profile.release.package.skia-bindings]
42+
opt-level = 3
43+
44+
# Aggressively size-optimize heavy utility crates
45+
[profile.release.package.regex]
46+
opt-level = "z"
47+
48+
[profile.release.package.regex-lite]
49+
opt-level = "z"
50+
51+
[profile.release.package.ureq]
52+
opt-level = "z"
53+
54+
[profile.release.package.image]
55+
opt-level = "z"
56+
2857

2958
[workspace.dependencies.wgt]
3059
package = "wgpu-types"
3160
git = "https://github.com/triniwiz/wgpu"
32-
rev = "9616414f16e5688192f6127f8104d8a07a3b1de6"
61+
rev = "4fb84f5a325d73d21416a2244d1cc062925350ef"
3362

3463

3564

3665

3766
[workspace.dependencies]
3867
env_logger = "0.11.5"
39-
log = "0.4.22"
40-
parking_lot = { version = "0.12.3", features = ["deadlock_detection"] }
68+
log = "0.4.29"
69+
parking_lot = { version = "0.12.3" }
4170
raw-window-handle = "0.6.2"
4271
canvas-2d = { path = "./crates/canvas-2d" }
4372
canvas-core = { path = "./crates/canvas-core" }
@@ -47,7 +76,7 @@ gl-bindings = { path = "./crates/gl-bindings" }
4776
canvas-c = { path = "./crates/canvas-c" }
4877
skia-safe = { version = "0.93.1", features = ["textlayout"] }
4978
itertools = "0.14.0"
50-
wgpu-core = { git = "https://github.com/triniwiz/wgpu", rev = "9616414f16e5688192f6127f8104d8a07a3b1de6", features = ["wgsl", "vulkan", "metal"] }
51-
wgpu-hal = { git = "https://github.com/triniwiz/wgpu", rev = "9616414f16e5688192f6127f8104d8a07a3b1de6", features = ["metal", "vulkan"] }
79+
wgpu-core = { git = "https://github.com/triniwiz/wgpu", rev = "4fb84f5a325d73d21416a2244d1cc062925350ef", features = ["wgsl"] }
80+
wgpu-hal = { git = "https://github.com/triniwiz/wgpu", rev = "4fb84f5a325d73d21416a2244d1cc062925350ef" }
5281
ureq = "2.10.1"
5382
jni = "0.21.1"

apps/demo/src/app-root.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
<Frame defaultPage="main-page">
22
</Frame>
3+
<!-- <Frame defaultPage="plugin-demos/canvas-three">
4+
</Frame> -->

apps/demo/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Application.on('uncaughtError', (args) => {
111111

112112
Application.on('launch', (args) => {
113113
//require('@nativescript/canvas-polyfill');
114-
if (global.isAndroid) {
114+
if (__ANDROID__) {
115115
jp.wasabeef.takt.Takt.stock(Utils.android.getApplicationContext()).seat(jp.wasabeef.takt.Seat.TOP_CENTER).color(-65536);
116116
} else {
117117
monitor = GDPerformanceMonitor.new();

apps/demo/src/plugin-demos/canvas-three.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</ActionBar>
66
</Page.actionBar>
77
<GridLayout class="bg-black w-full h-full" iosOverflowSafeArea="true">
8-
<canvas:Canvas style="width:100%;height:100%;" id="canvas" ready="{{ canvasLoaded }}" loaded="{{ loaded }}"
8+
<canvas:Canvas id="canvas" ready="{{ canvasLoaded }}" loaded="{{ loaded }}"
99
unloaded="{{unloaded}}"/>
1010
</GridLayout>
1111
</Page>

apps/demo/src/plugin-demos/canvas.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class DemoModel extends DemoSharedCanvas {
168168
const maxHeight = view.parent.getMeasuredHeight() / Screen.mainScreen.scale;
169169
const maxX = maxWidth - width;
170170
const maxY = maxHeight - height;
171-
if (global.isAndroid) {
171+
if (__ANDROID__) {
172172
const animator = android.animation.ValueAnimator.ofFloat([0, 1] as any);
173173
animator.setDuration(3000);
174174

@@ -179,7 +179,7 @@ export class DemoModel extends DemoSharedCanvas {
179179
view.x = maxX * progress;
180180
view.y = maxY * progress;
181181
},
182-
})
182+
}),
183183
);
184184

185185
animator.setInterpolator(new android.view.animation.AccelerateDecelerateInterpolator());

apps/demo/src/plugin-demos/canvas.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ loaded="{{ rectLoaded }}"
170170
<!-- <WebView rowSpan="2" colSpan="2" height="100%" width="100%" loaded="loaded"/>" -->
171171

172172
<GridLayout verticalAlignment="top" rowSpan="2" colSpan="2" height="100%" width="100%">
173-
<canvas:Canvas ready="{{ canvasLoaded }}" style="width: 100%;height:100%;"/>
173+
<canvas:Canvas isUserInteractionEnabled="true" ready="{{ canvasLoaded }}" style="width: 100%;height:100%;"/>
174174
</GridLayout>
175175

176176
<!-- <Button height="40" text="Draw" tap="{{ draw }}"/> -->

apps/demo/webpack.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ module.exports = (env) => {
1212
// config.resolve.alias.set('three/tsl', 'three/tsl');
1313

1414
config.resolve.alias.set('three/examples', resolve(__dirname, '..', '..', 'node_modules', 'three', 'examples'));
15+
config.resolve.alias.set('three/addons', resolve(__dirname, '..', '..', 'node_modules', 'three', 'examples', 'jsm'));
16+
config.resolve.alias.set('three/src', resolve(__dirname, '..', '..', 'node_modules', 'three', 'src'));
17+
//config.resolve.alias.set('three', resolve(__dirname, '..', '..', 'node_modules', 'three', 'src', 'Three.js'));
18+
// config.resolve.alias.set('three', resolve(__dirname, '..', '..', 'node_modules', 'three', 'build', 'three.module.js'));
1519
config.resolve.alias.set('three', resolve(__dirname, '..', '..', 'node_modules', 'three', 'build', 'three.webgpu.js'));
16-
config.resolve.alias.set('three/tsl', resolve(__dirname, '..', '..', 'node_modules', 'three', 'build', 'three.webgpu.js'));
20+
config.resolve.alias.set('three/tsl', resolve(__dirname, '..', '..', 'node_modules', 'three', 'build', 'three.tsl.js'));
1721
});
1822

1923
webpack.Utils.addCopyRule('**/*.svg');

crates/canvas-2d/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ default = ["gl"]
1212
[dependencies]
1313
canvas-core = { workspace = true, features = ["2d"] }
1414
parking_lot.workspace = true
15-
regex = "1.11.1"
15+
regex-lite = "0.1.6"
1616
base64 = "0.22.1"
1717
encoding_rs = "0.8.35"
1818
gl-bindings = { workspace = true }

crates/canvas-2d/src/context/drawing_text/typography.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::str::FromStr;
22

3-
use regex::Regex;
3+
use regex_lite::Regex;
44
use skia_safe::font_style::Width;
55
use std::sync::OnceLock;
66

crates/canvas-2d/src/context/fill_and_stroke_styles/paint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::context::Context;
88
use crate::utils::color::{to_parsed_color, to_parsed_color_4f};
99
use canvas_core::context_attributes::ColorSpace;
1010
use csscolorparser::parse;
11-
use regex::Regex;
11+
use regex_lite::Regex;
1212
use skia_safe::paint::{Cap, Style};
1313
pub use skia_safe::Color;
1414
use skia_safe::{BlendMode, Color4f, Point};

0 commit comments

Comments
 (0)