Merged svg pipeline into image
This commit is contained in:
parent
f737c6da24
commit
895eaef99b
8 changed files with 92 additions and 656 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{quad, text, Image, Primitive, Quad, Svg, Transformation};
|
||||
use crate::{quad, text, Image, Primitive, Quad, Transformation};
|
||||
use iced_native::{
|
||||
renderer::{Debugger, Windowed},
|
||||
Background, Color, Layout, MouseCursor, Point, Rectangle, Vector, Widget,
|
||||
|
|
@ -23,7 +23,6 @@ pub struct Renderer {
|
|||
queue: Queue,
|
||||
quad_pipeline: quad::Pipeline,
|
||||
image_pipeline: crate::image::Pipeline,
|
||||
svg_pipeline: crate::svg::Pipeline,
|
||||
text_pipeline: text::Pipeline,
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +31,6 @@ struct Layer<'a> {
|
|||
offset: Vector<u32>,
|
||||
quads: Vec<Quad>,
|
||||
images: Vec<Image>,
|
||||
svgs: Vec<Svg>,
|
||||
text: Vec<wgpu_glyph::Section<'a>>,
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +41,6 @@ impl<'a> Layer<'a> {
|
|||
offset,
|
||||
quads: Vec::new(),
|
||||
images: Vec::new(),
|
||||
svgs: Vec::new(),
|
||||
text: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
|
@ -67,14 +64,12 @@ impl Renderer {
|
|||
let text_pipeline = text::Pipeline::new(&mut device);
|
||||
let quad_pipeline = quad::Pipeline::new(&mut device);
|
||||
let image_pipeline = crate::image::Pipeline::new(&mut device);
|
||||
let svg_pipeline = crate::svg::Pipeline::new(&mut device);
|
||||
|
||||
Self {
|
||||
device,
|
||||
queue,
|
||||
quad_pipeline,
|
||||
image_pipeline,
|
||||
svg_pipeline,
|
||||
text_pipeline,
|
||||
}
|
||||
}
|
||||
|
|
@ -133,7 +128,6 @@ impl Renderer {
|
|||
|
||||
self.queue.submit(&[encoder.finish()]);
|
||||
self.image_pipeline.trim_cache();
|
||||
self.svg_pipeline.trim_cache();
|
||||
|
||||
*mouse_cursor
|
||||
}
|
||||
|
|
@ -243,11 +237,6 @@ impl Renderer {
|
|||
scale: [bounds.width, bounds.height],
|
||||
});
|
||||
}
|
||||
Primitive::Svg { handle, bounds } => layer.svgs.push(Svg {
|
||||
handle: handle.clone(),
|
||||
position: [bounds.x, bounds.y],
|
||||
scale: [bounds.width, bounds.height],
|
||||
}),
|
||||
Primitive::Clip {
|
||||
bounds,
|
||||
offset,
|
||||
|
|
@ -353,23 +342,6 @@ impl Renderer {
|
|||
translated_and_scaled,
|
||||
bounds,
|
||||
target,
|
||||
);
|
||||
}
|
||||
|
||||
if layer.svgs.len() > 0 {
|
||||
let translated = transformation
|
||||
* Transformation::translate(
|
||||
-(layer.offset.x as f32),
|
||||
-(layer.offset.y as f32),
|
||||
);
|
||||
|
||||
self.svg_pipeline.draw(
|
||||
&mut self.device,
|
||||
encoder,
|
||||
&layer.svgs,
|
||||
translated,
|
||||
bounds,
|
||||
target,
|
||||
dpi,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue