Merge branch 'master' into feature/test-recorder
This commit is contained in:
commit
9e81c2b9e8
88 changed files with 1225 additions and 1158 deletions
|
|
@ -64,21 +64,14 @@ pub struct Frame {
|
|||
}
|
||||
|
||||
impl Frame {
|
||||
pub fn new(size: Size) -> Self {
|
||||
Self::with_clip(Rectangle::with_size(size))
|
||||
}
|
||||
|
||||
pub fn with_clip(clip_bounds: Rectangle) -> Self {
|
||||
pub fn new(bounds: Rectangle) -> Self {
|
||||
Self {
|
||||
clip_bounds,
|
||||
clip_bounds: bounds,
|
||||
stack: Vec::new(),
|
||||
primitives: Vec::new(),
|
||||
images: Vec::new(),
|
||||
text: Vec::new(),
|
||||
transform: tiny_skia::Transform::from_translate(
|
||||
clip_bounds.x,
|
||||
clip_bounds.y,
|
||||
),
|
||||
transform: tiny_skia::Transform::identity(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -238,7 +231,7 @@ impl geometry::frame::Backend for Frame {
|
|||
align_x: text.align_x,
|
||||
align_y: text.align_y,
|
||||
shaping: text.shaping,
|
||||
clip_bounds: Rectangle::with_size(Size::INFINITY),
|
||||
clip_bounds: Rectangle::with_size(Size::INFINITE),
|
||||
});
|
||||
} else {
|
||||
text.draw_with(|path, color| self.fill(&path, color));
|
||||
|
|
@ -265,7 +258,7 @@ impl geometry::frame::Backend for Frame {
|
|||
}
|
||||
|
||||
fn draft(&mut self, clip_bounds: Rectangle) -> Self {
|
||||
Self::with_clip(clip_bounds)
|
||||
Self::new(clip_bounds)
|
||||
}
|
||||
|
||||
fn paste(&mut self, frame: Self) {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ pub struct Layer {
|
|||
pub bounds: Rectangle,
|
||||
pub quads: Vec<(Quad, Background)>,
|
||||
pub primitives: Vec<Item<Primitive>>,
|
||||
pub text: Vec<Item<Text>>,
|
||||
pub images: Vec<Image>,
|
||||
pub text: Vec<Item<Text>>,
|
||||
}
|
||||
|
||||
impl Layer {
|
||||
|
|
@ -284,6 +284,10 @@ impl graphics::Layer for Layer {
|
|||
}
|
||||
}
|
||||
|
||||
fn bounds(&self) -> Rectangle {
|
||||
self.bounds
|
||||
}
|
||||
|
||||
fn flush(&mut self) {}
|
||||
|
||||
fn resize(&mut self, bounds: Rectangle) {
|
||||
|
|
@ -298,6 +302,53 @@ impl graphics::Layer for Layer {
|
|||
self.text.clear();
|
||||
self.images.clear();
|
||||
}
|
||||
|
||||
fn start(&self) -> usize {
|
||||
if !self.quads.is_empty() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if !self.primitives.is_empty() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if !self.images.is_empty() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if !self.text.is_empty() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
usize::MAX
|
||||
}
|
||||
|
||||
fn end(&self) -> usize {
|
||||
if !self.text.is_empty() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
if !self.images.is_empty() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if !self.primitives.is_empty() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if !self.quads.is_empty() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
0
|
||||
}
|
||||
|
||||
fn merge(&mut self, layer: &mut Self) {
|
||||
self.quads.append(&mut layer.quads);
|
||||
self.primitives.append(&mut layer.primitives);
|
||||
self.text.append(&mut layer.text);
|
||||
self.images.append(&mut layer.images);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
|
|
@ -225,8 +225,8 @@ impl core::Renderer for Renderer {
|
|||
layer.draw_quad(quad, background.into(), transformation);
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
self.layers.clear();
|
||||
fn reset(&mut self, new_bounds: Rectangle) {
|
||||
self.layers.reset(new_bounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -293,8 +293,8 @@ impl graphics::geometry::Renderer for Renderer {
|
|||
type Geometry = Geometry;
|
||||
type Frame = geometry::Frame;
|
||||
|
||||
fn new_frame(&self, size: core::Size) -> Self::Frame {
|
||||
geometry::Frame::new(size)
|
||||
fn new_frame(&self, bounds: Rectangle) -> Self::Frame {
|
||||
geometry::Frame::new(bounds)
|
||||
}
|
||||
|
||||
fn draw_geometry(&mut self, geometry: Self::Geometry) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue