-
Notifications
You must be signed in to change notification settings - Fork 86
[Grida Canvas] Core Graphics - Daily RC 246 #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[Grida Canvsa] Core Graphics - path hit testing & overlay
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Caution Review failedThe pull request is closed. WalkthroughThis update introduces a new WebAssembly (WASM) and WebGL application backend, modularizes platform-specific windowing code, and implements efficient caching for text paragraphs and vector paths in the rendering pipeline. It adds new hit testing methods with improved path-based precision, supports rectangle nodes in JSON scene import, and enhances developer tooling overlays. The build system and workspace structure are revised to support Emscripten and WASM targets, including new Dockerfiles, Makefiles, and example projects. Changes
Sequence Diagram(s)WebGL/WASM Application Initialization and RenderingsequenceDiagram
participant JS as main.js (Web)
participant WASM as GridaCanvas WASM Module
participant WebGL as WebGL2 Context
JS->>WASM: Load WASM module (GridaCanvas)
JS->>WebGL: Create WebGL2 context
JS->>WASM: Register WebGL context
JS->>WASM: init(width, height)
WASM->>WASM: Create WebGlApplication
JS->>WASM: load_scene_json(ptr, len)
WASM->>WASM: Parse JSON, load scene
JS->>WASM: set devtools overlays (tiles, FPS, etc.)
loop User Interaction
JS->>WASM: pointer_move(x, y) / command(id, a, b)
WASM->>WASM: Update input/camera state
JS->>WASM: redraw()
WASM->>WebGL: Render frame via Skia
end
JS->>WASM: resize_surface(new_width, new_height)
WASM->>WebGL: Resize rendering surface
Painter Caching FlowsequenceDiagram
participant Painter
participant ParagraphCache
participant VectorPathCache
Painter->>ParagraphCache: get_or_create(node_id, text, ...)
alt Cache hit
ParagraphCache-->>Painter: Return cached Paragraph
else Cache miss
ParagraphCache->>Painter: Build new Paragraph
ParagraphCache-->>Painter: Cache and return Paragraph
end
Painter->>VectorPathCache: get_or_create(node_id, path_data)
alt Cache hit
VectorPathCache-->>Painter: Return cached Path
else Cache miss
VectorPathCache->>Painter: Parse and cache Path
VectorPathCache-->>Painter: Return new Path
end
Platform-specific Application InitializationsequenceDiagram
participant Main
alt Native
Main->>application_native_demo: run_demo_window(scene)
application_native_demo->>application_native: init_native_window()
application_native->>state: Create GPU/Skia state
application_native->>Main: Event loop (window events)
else WASM/WebGL
Main->>application_webgl: init(width, height)
application_webgl->>WASM: Setup WebGL context, Skia
application_webgl->>Main: Expose extern "C" API
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (49)
✨ Finishing Touches
🧪 Generate Unit Tests8000
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
[Grida Canvas] wip - wasm32-unknown-emscripten target
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Refactor
Chores
Tests