[librsvg: 4/5] impl ToPixel for CairoARGB
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/5] impl ToPixel for CairoARGB
- Date: Wed, 22 Sep 2021 01:11:18 +0000 (UTC)
commit f2dc3265a3a021e55002a13a6dc81b945fd32b91
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 21 12:54:12 2021 -0500
impl ToPixel for CairoARGB
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/592>
src/surface_utils/mod.rs | 12 ++++++++++++
src/surface_utils/shared_surface.rs | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/surface_utils/mod.rs b/src/surface_utils/mod.rs
index 3f915cd0..4f751ece 100644
--- a/src/surface_utils/mod.rs
+++ b/src/surface_utils/mod.rs
@@ -93,6 +93,18 @@ impl ToGdkPixbufRGBA for Pixel {
}
}
+impl ToPixel for CairoARGB {
+ #[inline]
+ fn to_pixel(&self) -> Pixel {
+ Pixel {
+ r: self.r,
+ g: self.g,
+ b: self.b,
+ a: self.a,
+ }
+ }
+}
+
impl ToPixel for GdkPixbufRGBA {
#[inline]
fn to_pixel(&self) -> Pixel {
diff --git a/src/surface_utils/shared_surface.rs b/src/surface_utils/shared_surface.rs
index 34dfc992..20cd0f40 100644
--- a/src/surface_utils/shared_surface.rs
+++ b/src/surface_utils/shared_surface.rs
@@ -343,7 +343,7 @@ impl ImageSurface<Shared> {
.map(|row| row.as_rgba_mut())
.zip(self.rows())
.flat_map(|(dest_row, src_row)| src_row.iter().zip(dest_row.iter_mut()))
- .for_each(|(src, dest)| *dest = Pixel::from(*src).unpremultiply().to_pixbuf_rgba());
+ .for_each(|(src, dest)| *dest = src.to_pixel().unpremultiply().to_pixbuf_rgba());
Some(pixbuf)
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]