mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Enforce valid image brightness in daemon and asusctl
This commit is contained in:
committed by
Luke Jones
parent
ef04549c8e
commit
c0e36295b7
@@ -83,8 +83,12 @@ impl AnimeImage {
|
||||
pixels: Vec<Pixel>,
|
||||
width: u32,
|
||||
anime_type: AnimeType,
|
||||
) -> Self {
|
||||
Self {
|
||||
) -> Result<Self, AnimeError> {
|
||||
if bright < 0.0 || bright > 1.0 {
|
||||
return Err(AnimeError::InvalidBrightness(bright));
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
scale,
|
||||
angle,
|
||||
translation,
|
||||
@@ -93,7 +97,7 @@ impl AnimeImage {
|
||||
img_pixels: pixels,
|
||||
width,
|
||||
anime_type,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: Convert functions back to const after todo completed
|
||||
@@ -435,7 +439,7 @@ impl AnimeImage {
|
||||
pixels,
|
||||
width,
|
||||
anime_type,
|
||||
);
|
||||
)?;
|
||||
|
||||
matrix.update();
|
||||
Ok(matrix)
|
||||
|
||||
Reference in New Issue
Block a user