Upgrade to Blitz v0.2.0 (#4731)
* Bump Rust CI version to 1.88 Signed-off-by: Nico Burns <nico@nicoburns.com> * Upgrade to Blitz v0.2.0 Signed-off-by: Nico Burns <nico@nicoburns.com> * Native: enable clipboard and file_dialog support by default * Fix clippy errors Signed-off-by: Nico Burns <nico@nicoburns.com> * See if cargo update magically fixes build Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix compile err Signed-off-by: Nico Burns <nico@nicoburns.com> * Remove unused wasm-opt dep * Fix wgpu_child_window example Signed-off-by: Nico Burns <nico@nicoburns.com> * Update blitz-shell Signed-off-by: Nico Burns <nico@nicoburns.com> * cargo fmt Signed-off-by: Nico Burns <nico@nicoburns.com> * Allow clippy lint Signed-off-by: Nico Burns <nico@nicoburns.com> * CI: Bump pinned nightly version Signed-off-by: Nico Burns <nico@nicoburns.com> * Allow clippy lint in whole module Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix more clippy lints Signed-off-by: Nico Burns <nico@nicoburns.com> * Use Rust 1.90 for clippy Signed-off-by: Nico Burns <nico@nicoburns.com> * cargo update --ignore-rust-version * revert cargo updates Signed-off-by: Nico Burns <nico@nicoburns.com> * Revert another silly clippy lint --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
1 parent
0b1f2fc8c2
commit
9359446017
26 files changed
+1029
-807
No files matched your search
@@ -12,11 +12,12 @@ tracing = ["dep:tracing-subscriber", "dioxus-native-dom/tracing"]
|
||||
dioxus = { workspace = true, features = ["html", "hooks", "signals"] }
|
||||
dioxus-native-dom = { workspace = true }
|
||||
anyrender_vello = { workspace = true }
|
||||
vello = "0.5"
|
||||
vello = { workspace = true }
|
||||
rustc-hash = "1"
|
||||
futures-util = { workspace = true }
|
||||
tracing-subscriber = { workspace = true, optional = true }
|
||||
wgpu = { workspace = true }
|
||||
wgpu_context = { workspace = true }
|
||||
pollster = "0.4"
|
||||
bytemuck = "1"
|
||||
blitz-paint = { workspace = true, default-features = true }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//!
|
||||
//! (this example is not really intended to be run as-is, and requires you to fill
|
||||
//! in the missing pieces)
|
||||
use anyrender_vello::{wgpu_context::WGPUContext, CustomPaintSource, VelloScenePainter};
|
||||
use anyrender_vello::VelloScenePainter;
|
||||
use blitz_dom::{Document as _, DocumentConfig};
|
||||
use blitz_paint::paint_scene;
|
||||
use blitz_traits::{
|
||||
@@ -13,13 +13,13 @@ use blitz_traits::{
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_native_dom::DioxusDocument;
|
||||
use pollster::FutureExt as _;
|
||||
use rustc_hash::FxHashMap;
|
||||
use std::sync::Arc;
|
||||
use std::task::Context;
|
||||
use vello::{
|
||||
peniko::color::AlphaColor, RenderParams, Renderer as VelloRenderer, RendererOptions, Scene,
|
||||
};
|
||||
use wgpu::TextureFormat;
|
||||
use wgpu_context::WGPUContext;
|
||||
|
||||
// Constant width, height, scale factor and color schemefor example purposes
|
||||
const SCALE_FACTOR: f32 = 1.0;
|
||||
@@ -102,14 +102,8 @@ fn main() {
|
||||
// Poll the vdom
|
||||
dioxus_doc.poll(Some(Context::from_waker(&waker)));
|
||||
|
||||
// Create a `VelloScenePainter` to paint into
|
||||
let mut custom_paint_sources =
|
||||
FxHashMap::<u64, Box<dyn CustomPaintSource + 'static>>::default();
|
||||
let mut scene_painter = VelloScenePainter {
|
||||
inner: Scene::new(),
|
||||
renderer: &mut vello_renderer,
|
||||
custom_paint_sources: &mut custom_paint_sources,
|
||||
};
|
||||
// Create a `vello::Scene` to paint into
|
||||
let mut scene = Scene::new();
|
||||
|
||||
// Paint the document using `blitz_paint::paint_scene`
|
||||
//
|
||||
@@ -117,16 +111,13 @@ fn main() {
|
||||
// so you could also write your own implementation if you want more control over rendering
|
||||
// (i.e. to render a custom renderer instead of Vello)
|
||||
paint_scene(
|
||||
&mut scene_painter,
|
||||
&mut VelloScenePainter::new(&mut scene),
|
||||
&dioxus_doc,
|
||||
SCALE_FACTOR as f64,
|
||||
WIDTH,
|
||||
HEIGHT,
|
||||
);
|
||||
|
||||
// Extract the `vello::Scene` from the `VelloScenePainter`
|
||||
let scene = scene_painter.finish();
|
||||
|
||||
// Render the `vello::Scene` to the Texture using the `VelloRenderer`
|
||||
vello_renderer
|
||||
.render_to_texture(
|
||||
|
||||
Reference in new issue
Block a user