[librsvg/librsvg-2.48] Use the rgb crate and define a CairoARGB pixel type
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.48] Use the rgb crate and define a CairoARGB pixel type
- Date: Fri, 29 May 2020 20:48:11 +0000 (UTC)
commit b7f96a39181314da64f2b338652427cea9b2a3c9
Author: Federico Mena Quintero <federico gnome org>
Date: Thu May 28 17:12:50 2020 -0500
Use the rgb crate and define a CairoARGB pixel type
This is endian-dependent, so we pick from rgb's types at compile-time.
Cargo.lock | 7 +++++++
rsvg_internals/Cargo.toml | 1 +
rsvg_internals/src/surface_utils/mod.rs | 12 ++++++++++++
3 files changed, 20 insertions(+)
---
diff --git a/Cargo.lock b/Cargo.lock
index 3b513d80..e91ae772 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1238,6 +1238,12 @@ version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index";
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
+[[package]]
+name = "rgb"
+version = "0.8.17"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "a85b83fd629b0ce765f45316774fa6aaa95947fd74c8e4bbf3c6d1e349701d95"
+
[[package]]
name = "rsvg_internals"
version = "0.0.1"
@@ -1271,6 +1277,7 @@ dependencies = [
"rayon",
"rctree",
"regex",
+ "rgb",
"selectors",
"url",
"xml5ever",
diff --git a/rsvg_internals/Cargo.toml b/rsvg_internals/Cargo.toml
index eb417374..3a3fe6bb 100644
--- a/rsvg_internals/Cargo.toml
+++ b/rsvg_internals/Cargo.toml
@@ -36,6 +36,7 @@ pango-sys = "0.9.0"
pangocairo = "0.9.0"
rayon = "1"
rctree = "0.3.3"
+rgb = "0.8.17"
regex = "1"
selectors = "0.22.0"
url = "2"
diff --git a/rsvg_internals/src/surface_utils/mod.rs b/rsvg_internals/src/surface_utils/mod.rs
index 59eb363f..206f82b0 100644
--- a/rsvg_internals/src/surface_utils/mod.rs
+++ b/rsvg_internals/src/surface_utils/mod.rs
@@ -6,6 +6,18 @@ pub mod iterators;
pub mod shared_surface;
pub mod srgb;
+// These two are for Cairo's platform-endian 0xaarrggbb pixels
+
+#[cfg(target_endian = "little")]
+use rgb::alt::BGRA8;
+#[cfg(target_endian = "little")]
+pub type CairoARGB = BGRA8;
+
+#[cfg(target_endian = "big")]
+use rgb::alt::ARGB8;
+#[cfg(target_endian = "big")]
+pub type CairoARGB = ARGB8;
+
/// A pixel consisting of R, G, B and A values.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
pub struct Pixel {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]