summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-12-02 15:53:02 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-12-02 15:56:28 +0100
commitb526ce4958b28208395276dd4078ffe0d780e1d7 (patch)
tree802fef9f0b54b6f9cbbeedff14d7f57169db7d6b
parent43a7cc2222750b1cada1663b29278b29d3ea232c (diff)
downloadiced-b526ce4958b28208395276dd4078ffe0d780e1d7.tar.gz
iced-b526ce4958b28208395276dd4078ffe0d780e1d7.tar.bz2
iced-b526ce4958b28208395276dd4078ffe0d780e1d7.zip
Rename `viewport` to `clip_bounds`
-rw-r--r--core/src/renderer/null.rs6
-rw-r--r--core/src/text.rs6
-rw-r--r--graphics/src/primitive.rs12
-rw-r--r--graphics/src/renderer.rs12
-rw-r--r--renderer/src/lib.rs12
-rw-r--r--tiny_skia/src/backend.rs15
-rw-r--r--tiny_skia/src/geometry.rs2
-rw-r--r--wgpu/src/geometry.rs2
-rw-r--r--wgpu/src/layer.rs14
-rw-r--r--wgpu/src/layer/text.rs8
-rw-r--r--wgpu/src/text.rs14
11 files changed, 53 insertions, 50 deletions
diff --git a/core/src/renderer/null.rs b/core/src/renderer/null.rs
index 3ce6a4f5..7accd34e 100644
--- a/core/src/renderer/null.rs
+++ b/core/src/renderer/null.rs
@@ -64,7 +64,7 @@ impl text::Renderer for Null {
_paragraph: &Self::Paragraph,
_position: Point,
_color: Color,
- _viewport: Rectangle,
+ _clip_bounds: Rectangle,
) {
}
@@ -73,7 +73,7 @@ impl text::Renderer for Null {
_editor: &Self::Editor,
_position: Point,
_color: Color,
- _viewport: Rectangle,
+ _clip_bounds: Rectangle,
) {
}
@@ -82,7 +82,7 @@ impl text::Renderer for Null {
_paragraph: Text<'_, Self::Font>,
_position: Point,
_color: Color,
- _viewport: Rectangle,
+ _clip_bounds: Rectangle,
) {
}
}
diff --git a/core/src/text.rs b/core/src/text.rs
index 697fa628..edef79c2 100644
--- a/core/src/text.rs
+++ b/core/src/text.rs
@@ -202,7 +202,7 @@ pub trait Renderer: crate::Renderer {
text: &Self::Paragraph,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
);
/// Draws the given [`Editor`] at the given position and with the given
@@ -212,7 +212,7 @@ pub trait Renderer: crate::Renderer {
editor: &Self::Editor,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
);
/// Draws the given [`Text`] at the given position and with the given
@@ -222,6 +222,6 @@ pub trait Renderer: crate::Renderer {
text: Text<'_, Self::Font>,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
);
}
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs
index 837eb77a..ed75776c 100644
--- a/graphics/src/primitive.rs
+++ b/graphics/src/primitive.rs
@@ -32,8 +32,8 @@ pub enum Primitive<T> {
vertical_alignment: alignment::Vertical,
/// The shaping strategy of the text.
shaping: text::Shaping,
- /// The viewport of the text.
- viewport: Rectangle,
+ /// The clip bounds of the text.
+ clip_bounds: Rectangle,
},
/// A paragraph primitive
Paragraph {
@@ -43,8 +43,8 @@ pub enum Primitive<T> {
position: Point,
/// The color of the paragraph.
color: Color,
- /// The viewport of the paragraph.
- viewport: Rectangle,
+ /// The clip bounds of the paragraph.
+ clip_bounds: Rectangle,
},
/// An editor primitive
Editor {
@@ -54,8 +54,8 @@ pub enum Primitive<T> {
position: Point,
/// The color of the editor.
color: Color,
- /// The viewport of the editor.
- viewport: Rectangle,
+ /// The clip bounds of the editor.
+ clip_bounds: Rectangle,
},
/// A quad primitive
Quad {
diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs
index 0d3b11a7..1b0f5c5b 100644
--- a/graphics/src/renderer.rs
+++ b/graphics/src/renderer.rs
@@ -164,13 +164,13 @@ where
paragraph: &Self::Paragraph,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
) {
self.primitives.push(Primitive::Paragraph {
paragraph: paragraph.downgrade(),
position,
color,
- viewport,
+ clip_bounds,
});
}
@@ -179,13 +179,13 @@ where
editor: &Self::Editor,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
) {
self.primitives.push(Primitive::Editor {
editor: editor.downgrade(),
position,
color,
- viewport,
+ clip_bounds,
});
}
@@ -194,7 +194,7 @@ where
text: Text<'_, Self::Font>,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
) {
self.primitives.push(Primitive::Text {
content: text.content.to_string(),
@@ -206,7 +206,7 @@ where
horizontal_alignment: text.horizontal_alignment,
vertical_alignment: text.vertical_alignment,
shaping: text.shaping,
- viewport,
+ clip_bounds,
});
}
}
diff --git a/renderer/src/lib.rs b/renderer/src/lib.rs
index 90a7262b..f2acfa00 100644
--- a/renderer/src/lib.rs
+++ b/renderer/src/lib.rs
@@ -175,12 +175,12 @@ impl<T> text::Renderer for Renderer<T> {
paragraph: &Self::Paragraph,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
) {
delegate!(
self,
renderer,
- renderer.fill_paragraph(paragraph, position, color, viewport)
+ renderer.fill_paragraph(paragraph, position, color, clip_bounds)
);
}
@@ -189,12 +189,12 @@ impl<T> text::Renderer for Renderer<T> {
editor: &Self::Editor,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
) {
delegate!(
self,
renderer,
- renderer.fill_editor(editor, position, color, viewport)
+ renderer.fill_editor(editor, position, color, clip_bounds)
);
}
@@ -203,12 +203,12 @@ impl<T> text::Renderer for Renderer<T> {
text: Text<'_, Self::Font>,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
) {
delegate!(
self,
renderer,
- renderer.fill_text(text, position, color, viewport)
+ renderer.fill_text(text, position, color, clip_bounds)
);
}
}
diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs
index cc0f72d1..3e9bd2a5 100644
--- a/tiny_skia/src/backend.rs
+++ b/tiny_skia/src/backend.rs
@@ -361,9 +361,10 @@ impl Backend {
paragraph,
position,
color,
- viewport,
+ clip_bounds: text_clip_bounds,
} => {
- let physical_bounds = (*viewport + translation) * scale_factor;
+ let physical_bounds =
+ (*text_clip_bounds + translation) * scale_factor;
if !clip_bounds.intersects(&physical_bounds) {
return;
@@ -385,9 +386,10 @@ impl Backend {
editor,
position,
color,
- viewport,
+ clip_bounds: text_clip_bounds,
} => {
- let physical_bounds = (*viewport + translation) * scale_factor;
+ let physical_bounds =
+ (*text_clip_bounds + translation) * scale_factor;
if !clip_bounds.intersects(&physical_bounds) {
return;
@@ -415,9 +417,10 @@ impl Backend {
horizontal_alignment,
vertical_alignment,
shaping,
- viewport,
+ clip_bounds: text_clip_bounds,
} => {
- let physical_bounds = (*viewport + translation) * scale_factor;
+ let physical_bounds =
+ (*text_clip_bounds + translation) * scale_factor;
if !clip_bounds.intersects(&physical_bounds) {
return;
diff --git a/tiny_skia/src/geometry.rs b/tiny_skia/src/geometry.rs
index b73f84a9..5f28b737 100644
--- a/tiny_skia/src/geometry.rs
+++ b/tiny_skia/src/geometry.rs
@@ -127,7 +127,7 @@ impl Frame {
horizontal_alignment: text.horizontal_alignment,
vertical_alignment: text.vertical_alignment,
shaping: text.shaping,
- viewport: bounds,
+ clip_bounds: Rectangle::with_size(Size::INFINITY),
});
}
diff --git a/wgpu/src/geometry.rs b/wgpu/src/geometry.rs
index c82b9ffb..e0bff67e 100644
--- a/wgpu/src/geometry.rs
+++ b/wgpu/src/geometry.rs
@@ -346,7 +346,7 @@ impl Frame {
horizontal_alignment: text.horizontal_alignment,
vertical_alignment: text.vertical_alignment,
shaping: text.shaping,
- viewport: bounds,
+ clip_bounds: Rectangle::with_size(Size::INFINITY),
});
}
diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs
index 60da3543..557a7633 100644
--- a/wgpu/src/layer.rs
+++ b/wgpu/src/layer.rs
@@ -75,7 +75,7 @@ impl<'a> Layer<'a> {
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top,
shaping: core::text::Shaping::Basic,
- viewport: Rectangle::with_size(Size::INFINITY),
+ clip_bounds: Rectangle::with_size(Size::INFINITY),
};
overlay.text.push(Text::Cached(text.clone()));
@@ -124,7 +124,7 @@ impl<'a> Layer<'a> {
paragraph,
position,
color,
- viewport,
+ clip_bounds,
} => {
let layer = &mut layers[current_layer];
@@ -132,14 +132,14 @@ impl<'a> Layer<'a> {
paragraph: paragraph.clone(),
position: *position + translation,
color: *color,
- viewport: *viewport + translation,
+ clip_bounds: *clip_bounds + translation,
});
}
Primitive::Editor {
editor,
position,
color,
- viewport,
+ clip_bounds,
} => {
let layer = &mut layers[current_layer];
@@ -147,7 +147,7 @@ impl<'a> Layer<'a> {
editor: editor.clone(),
position: *position + translation,
color: *color,
- viewport: *viewport + translation,
+ clip_bounds: *clip_bounds + translation,
});
}
Primitive::Text {
@@ -160,7 +160,7 @@ impl<'a> Layer<'a> {
horizontal_alignment,
vertical_alignment,
shaping,
- viewport,
+ clip_bounds,
} => {
let layer = &mut layers[current_layer];
@@ -174,7 +174,7 @@ impl<'a> Layer<'a> {
horizontal_alignment: *horizontal_alignment,
vertical_alignment: *vertical_alignment,
shaping: *shaping,
- viewport: *viewport + translation,
+ clip_bounds: *clip_bounds + translation,
}));
}
Primitive::Quad {
diff --git a/wgpu/src/layer/text.rs b/wgpu/src/layer/text.rs
index c4ea9185..df2f2875 100644
--- a/wgpu/src/layer/text.rs
+++ b/wgpu/src/layer/text.rs
@@ -13,7 +13,7 @@ pub enum Text<'a> {
paragraph: paragraph::Weak,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
},
/// An editor.
#[allow(missing_docs)]
@@ -21,7 +21,7 @@ pub enum Text<'a> {
editor: editor::Weak,
position: Point,
color: Color,
- viewport: Rectangle,
+ clip_bounds: Rectangle,
},
/// A cached text.
Cached(Cached<'a>),
@@ -56,6 +56,6 @@ pub struct Cached<'a> {
/// The shaping strategy of the text.
pub shaping: text::Shaping,
- /// The viewport of the text.
- pub viewport: Rectangle,
+ /// The clip bounds of the text.
+ pub clip_bounds: Rectangle,
}
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs
index 7d73c87b..888b1924 100644
--- a/wgpu/src/text.rs
+++ b/wgpu/src/text.rs
@@ -120,12 +120,12 @@ impl Pipeline {
horizontal_alignment,
vertical_alignment,
color,
- viewport,
+ clip_bounds,
) = match section {
Text::Paragraph {
position,
color,
- viewport,
+ clip_bounds,
..
} => {
use crate::core::text::Paragraph as _;
@@ -141,13 +141,13 @@ impl Pipeline {
paragraph.horizontal_alignment(),
paragraph.vertical_alignment(),
*color,
- *viewport,
+ *clip_bounds,
)
}
Text::Editor {
position,
color,
- viewport,
+ clip_bounds,
..
} => {
use crate::core::text::Editor as _;
@@ -163,7 +163,7 @@ impl Pipeline {
alignment::Horizontal::Left,
alignment::Vertical::Top,
*color,
- *viewport,
+ *clip_bounds,
)
}
Text::Cached(text) => {
@@ -182,7 +182,7 @@ impl Pipeline {
text.horizontal_alignment,
text.vertical_alignment,
text.color,
- text.viewport,
+ text.clip_bounds,
)
}
};
@@ -206,7 +206,7 @@ impl Pipeline {
};
let clip_bounds =
- layer_bounds.intersection(&(viewport * scale_factor))?;
+ layer_bounds.intersection(&(clip_bounds * scale_factor))?;
Some(glyphon::TextArea {
buffer,