summaryrefslogtreecommitdiffstats
path: root/graphics/src/damage.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-11 15:25:58 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-11 15:25:58 +0200
commit8622e998f2701e7f4ca8d2f71c85150f436a9945 (patch)
treede62eead3db44002997b83849711533b214aae31 /graphics/src/damage.rs
parentdd04c0b070b60b15293892e2a7c284787d3d63b1 (diff)
downloadiced-8622e998f2701e7f4ca8d2f71c85150f436a9945.tar.gz
iced-8622e998f2701e7f4ca8d2f71c85150f436a9945.tar.bz2
iced-8622e998f2701e7f4ca8d2f71c85150f436a9945.zip
Write missing documentation in `iced_graphics`
Diffstat (limited to 'graphics/src/damage.rs')
-rw-r--r--graphics/src/damage.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/graphics/src/damage.rs b/graphics/src/damage.rs
index 5aab06b1..c6b0f759 100644
--- a/graphics/src/damage.rs
+++ b/graphics/src/damage.rs
@@ -1,8 +1,10 @@
+//! Track and compute the damage of graphical primitives.
use crate::core::{Rectangle, Size};
use crate::Primitive;
use std::sync::Arc;
+/// Computes the damage regions between the two given primitives.
pub fn regions(a: &Primitive, b: &Primitive) -> Vec<Rectangle> {
match (a, b) {
(
@@ -73,6 +75,7 @@ pub fn regions(a: &Primitive, b: &Primitive) -> Vec<Rectangle> {
}
}
+/// Computes the damage regions between the two given lists of primitives.
pub fn list(previous: &[Primitive], current: &[Primitive]) -> Vec<Rectangle> {
let damage = previous
.iter()
@@ -95,6 +98,8 @@ pub fn list(previous: &[Primitive], current: &[Primitive]) -> Vec<Rectangle> {
}
}
+/// Groups the given damage regions that are close together inside the given
+/// bounds.
pub fn group(
mut damage: Vec<Rectangle>,
scale_factor: f32,