[librsvg: 1/2] Revert the subclass branch temporarily
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/2] Revert the subclass branch temporarily
- Date: Sat, 26 Jan 2019 01:40:20 +0000 (UTC)
commit 21efded1ac00f8adb39e3bd2e239acc20ce2e0a5
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Jan 25 19:31:54 2019 -0600
Revert the subclass branch temporarily
BuildStream's vendoring doesn't deal with arbitrarily referenced
repositories; because of "cargo vendor" it depends on crates that come
from crates.io. Since the subclass branch depends on glib-rs master,
we'll revert this whole branch temporarily until glib-rs makes a
release.
(I can't force-push to master a clean revert, hence this revert-changes commit)
Reverts merge a8f9996e
Cargo.lock | 161 +++++++++---------
Makefile.am | 1 -
librsvg/rsvg-handle.c | 248 ++++++++++++++++++++++++++-
rsvg_internals/Cargo.toml | 25 ++-
rsvg_internals/src/c_api.rs | 302 ---------------------------------
rsvg_internals/src/error.rs | 5 +-
rsvg_internals/src/gradient.rs | 12 +-
rsvg_internals/src/handle.rs | 334 ++++++++++++++++++-------------------
rsvg_internals/src/io.rs | 2 +-
rsvg_internals/src/lib.rs | 8 +-
rsvg_internals/src/pixbuf_utils.rs | 5 +-
rsvg_internals/src/svg.rs | 7 +-
rsvg_internals/src/text.rs | 4 +-
tests/api.c | 128 --------------
14 files changed, 516 insertions(+), 726 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index eab89b29..734d79d9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -85,21 +85,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cairo-rs"
version = "0.5.0"
-source = "git+https://github.com/gtk-rs/cairo#a6ea55b42f41220ec84f8a4842e987aa67baf66c"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "cairo-sys-rs 0.7.0 (git+https://github.com/gtk-rs/cairo)",
- "glib 0.6.0 (git+https://github.com/gtk-rs/glib)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cairo-sys-rs"
version = "0.7.0"
-source = "git+https://github.com/gtk-rs/cairo#a6ea55b42f41220ec84f8a4842e987aa67baf66c"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -412,25 +414,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "gdk-pixbuf"
version = "0.5.0"
-source = "git+https://github.com/gtk-rs/gdk-pixbuf#f854b3beefbd441acfb52ebcc924aebe9f0aca77"
-dependencies = [
- "gdk-pixbuf-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gio 0.5.1 (git+https://github.com/gtk-rs/gio)",
- "gio-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "glib 0.6.0 (git+https://github.com/gtk-rs/glib)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gdk-pixbuf-sys"
version = "0.7.0"
-source = "git+https://github.com/gtk-rs/sys#508d9264d6f82f63fdb7c4b87cc9834ce2e80404"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "gio-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -446,14 +448,14 @@ dependencies = [
[[package]]
name = "gio"
version = "0.5.1"
-source = "git+https://github.com/gtk-rs/gio#4f7ada91d383fca56e6cd4d9541db7c791d1674b"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gio-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "glib 0.6.0 (git+https://github.com/gtk-rs/glib)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -461,10 +463,10 @@ dependencies = [
[[package]]
name = "gio-sys"
version = "0.7.0"
-source = "git+https://github.com/gtk-rs/sys#508d9264d6f82f63fdb7c4b87cc9834ce2e80404"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -472,11 +474,11 @@ dependencies = [
[[package]]
name = "glib"
version = "0.6.0"
-source = "git+https://github.com/gtk-rs/glib#ee61c14860268c847454bca88fd44481dea9e795"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -484,7 +486,7 @@ dependencies = [
[[package]]
name = "glib-sys"
version = "0.7.0"
-source = "git+https://github.com/gtk-rs/sys#508d9264d6f82f63fdb7c4b87cc9834ce2e80404"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -493,9 +495,9 @@ dependencies = [
[[package]]
name = "gobject-sys"
version = "0.7.0"
-source = "git+https://github.com/gtk-rs/sys#508d9264d6f82f63fdb7c4b87cc9834ce2e80404"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -687,24 +689,24 @@ dependencies = [
[[package]]
name = "pango"
version = "0.5.0"
-source = "git+https://github.com/gtk-rs/pango#b4f05a8899631eb7564f2fa6d1be24724269064b"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib 0.6.0 (git+https://github.com/gtk-rs/glib)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
- "pango-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pango-sys"
version = "0.7.0"
-source = "git+https://github.com/gtk-rs/sys#508d9264d6f82f63fdb7c4b87cc9834ce2e80404"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -712,29 +714,29 @@ dependencies = [
[[package]]
name = "pangocairo"
version = "0.6.0"
-source = "git+https://github.com/gtk-rs/pangocairo#d0d4c9072890f2e9d3728ab92fa1fca2eb939717"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "cairo-rs 0.5.0 (git+https://github.com/gtk-rs/cairo)",
- "cairo-sys-rs 0.7.0 (git+https://github.com/gtk-rs/cairo)",
- "glib 0.6.0 (git+https://github.com/gtk-rs/glib)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
- "pango 0.5.0 (git+https://github.com/gtk-rs/pango)",
- "pango-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "pangocairo-sys 0.8.0 (git+https://github.com/gtk-rs/sys)",
+ "pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pangocairo-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pangocairo-sys"
version = "0.8.0"
-source = "git+https://github.com/gtk-rs/sys#508d9264d6f82f63fdb7c4b87cc9834ce2e80404"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "cairo-sys-rs 0.7.0 (git+https://github.com/gtk-rs/cairo)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
- "pango-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -946,22 +948,21 @@ dependencies = [
name = "rsvg_internals"
version = "0.0.1"
dependencies = [
- "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "cairo-rs 0.5.0 (git+https://github.com/gtk-rs/cairo)",
- "cairo-sys-rs 0.7.0 (git+https://github.com/gtk-rs/cairo)",
+ "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)",
"data-url 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"downcast-rs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"float-cmp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gdk-pixbuf 0.5.0 (git+https://github.com/gtk-rs/gdk-pixbuf)",
- "gdk-pixbuf-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gio 0.5.1 (git+https://github.com/gtk-rs/gio)",
- "gio-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "glib 0.6.0 (git+https://github.com/gtk-rs/glib)",
- "glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
+ "gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
"language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -970,9 +971,9 @@ dependencies = [
"nalgebra 0.16.10 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "pango 0.5.0 (git+https://github.com/gtk-rs/pango)",
- "pango-sys 0.7.0 (git+https://github.com/gtk-rs/sys)",
- "pangocairo 0.6.0 (git+https://github.com/gtk-rs/pangocairo)",
+ "pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pangocairo 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1290,8 +1291,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" =
"c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" =
"228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" =
"94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d"
-"checksum cairo-rs 0.5.0 (git+https://github.com/gtk-rs/cairo)" = "<none>"
-"checksum cairo-sys-rs 0.7.0 (git+https://github.com/gtk-rs/cairo)" = "<none>"
+"checksum cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"dd940f0d609699e343ef71c4af5f66423afbf30d666f796dabd8fd15229cf5b6"
+"checksum cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"d25596627380be4381247dba06c69ad05ca21b3b065bd9827e416882ac41dcd2"
"checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" =
"926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" =
"f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" =
"082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
@@ -1326,14 +1327,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" =
"2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" =
"3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
-"checksum gdk-pixbuf 0.5.0 (git+https://github.com/gtk-rs/gdk-pixbuf)" = "<none>"
-"checksum gdk-pixbuf-sys 0.7.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
+"checksum gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"bc3aa730cb4df3de5d9fed59f43afdf9e5fb2d3d10bfcbd04cec031435ce87f5"
+"checksum gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"08284f16ce4d909b10d785a763ba190e222d2c1557b29908bf0a661e27a8ac3b"
"checksum generic-array 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" =
"8107dafa78c80c848b71b60133954b4a58609a3a1a5f9af037ecc7f67280f369"
-"checksum gio 0.5.1 (git+https://github.com/gtk-rs/gio)" = "<none>"
-"checksum gio-sys 0.7.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
-"checksum glib 0.6.0 (git+https://github.com/gtk-rs/glib)" = "<none>"
-"checksum glib-sys 0.7.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
-"checksum gobject-sys 0.7.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
+"checksum gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" =
"29a44b051990573448edc80b1995237f8b97b5734d2aec05105b9242aa10af11"
+"checksum gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"6975ada29f7924dc1c90b30ed3b32d777805a275556c05e420da4fbdc22eb250"
+"checksum glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"740f7fda8dde5f5e3944dabdb4a73ac6094a8a7fdf0af377468e98ca93733e61"
+"checksum glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"3573351e846caed9f11207b275cd67bc07f0c2c94fb628e5d7c92ca056c7882d"
+"checksum gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"08475e4a08f27e6e2287005950114735ed61cec2cb8c1187682a5aec8c69b715"
"checksum handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)" =
"d89ec99d1594f285d4590fc32bac5f75cdab383f1123d504d27862c644a807dd"
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" =
"38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" =
"f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450"
@@ -1358,10 +1359,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" =
"0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
-"checksum pango 0.5.0 (git+https://github.com/gtk-rs/pango)" = "<none>"
-"checksum pango-sys 0.7.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
-"checksum pangocairo 0.6.0 (git+https://github.com/gtk-rs/pangocairo)" = "<none>"
-"checksum pangocairo-sys 0.8.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
+"checksum pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"4c2cb169402a3eb1ba034a7cc7d95b8b1c106e9be5ba4be79a5a93dc1a2795f4"
+"checksum pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"d6eb49268e69dd0c1da5d3001a61aac08e2e9d2bfbe4ae4b19b9963c998f6453"
+"checksum pangocairo 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"4325b65f44487564a18d6402bed48c1bc4642167bfe972a753d039d1ac938c21"
+"checksum pangocairo-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"9e79ffb01eae5bc130b44fde529fa493ad6308c340da1358eaa2435ed3580e4f"
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" =
"31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
"checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" =
"0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc"
"checksum pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" =
"ca3294f437119209b084c797604295f40227cffa35c57220b1e99a6ff3bf8ee4"
diff --git a/Makefile.am b/Makefile.am
index 1d3ca9e0..da9745fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,7 +41,6 @@ RUST_SRC = \
rsvg_internals/src/aspect_ratio.rs \
rsvg_internals/src/attributes.rs \
rsvg_internals/src/bbox.rs \
- rsvg_internals/src/c_api.rs \
rsvg_internals/src/clip_path.rs \
rsvg_internals/src/color.rs \
rsvg_internals/src/cond.rs \
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index c6c6d8eb..d1d785ff 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -269,13 +269,21 @@
#include "rsvg.h"
+/* Defined in rsvg_internals/src/handle.rs */
+typedef struct RsvgHandleRust RsvgHandleRust;
+
/* Implemented in rsvg_internals/src/xml.rs */
typedef struct RsvgXmlState RsvgXmlState;
/* Implemented in rsvg_internals/src/xml.rs */
extern void rsvg_xml_state_error(RsvgXmlState *xml, const char *msg);
+G_GNUC_INTERNAL
+RsvgHandleRust *rsvg_handle_get_rust (RsvgHandle *handle);
+
/* Implemented in rsvg_internals/src/handle.rs */
+extern RsvgHandleRust *rsvg_handle_rust_new (void);
+extern void rsvg_handle_rust_free (RsvgHandleRust *raw_handle);
extern double rsvg_handle_rust_get_dpi_x (RsvgHandle *raw_handle);
extern double rsvg_handle_rust_get_dpi_y (RsvgHandle *raw_handle);
extern void rsvg_handle_rust_set_dpi_x (RsvgHandle *raw_handle, double dpi_x);
@@ -330,13 +338,236 @@ extern RsvgHandle *rsvg_handle_rust_new_from_data (const guint8 *data,
gsize data_len,
GError **error);
-/* Implemented in rsvg_internals/src/c_api.rs */
-extern GType rsvg_handle_rust_get_type (void);
+typedef struct {
+ RsvgHandleRust *rust_handle;
+} RsvgHandlePrivate;
+
+enum {
+ PROP_0,
+ PROP_FLAGS,
+ PROP_DPI_X,
+ PROP_DPI_Y,
+ PROP_BASE_URI,
+ PROP_WIDTH,
+ PROP_HEIGHT,
+ PROP_EM,
+ PROP_EX,
+ PROP_TITLE,
+ PROP_DESC,
+ PROP_METADATA,
+ NUM_PROPS
+};
+
+G_DEFINE_TYPE_WITH_CODE (RsvgHandle, rsvg_handle, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (RsvgHandle))
+
+static void
+rsvg_handle_init (RsvgHandle *self)
+{
+ RsvgHandlePrivate *priv = rsvg_handle_get_instance_private (self);
+ priv->rust_handle = rsvg_handle_rust_new();
+}
+
+static void
+rsvg_handle_dispose (GObject *instance)
+{
+ RsvgHandle *self = (RsvgHandle *) instance;
+ RsvgHandlePrivate *priv = rsvg_handle_get_instance_private (self);
+
+ g_clear_pointer (&priv->rust_handle, rsvg_handle_rust_free);
+
+ G_OBJECT_CLASS (rsvg_handle_parent_class)->dispose (instance);
+}
+
+static void
+rsvg_handle_set_property (GObject * instance, guint prop_id, GValue const *value, GParamSpec * pspec)
+{
+ RsvgHandle *self = RSVG_HANDLE (instance);
+
+ switch (prop_id) {
+ case PROP_FLAGS:
+ rsvg_handle_rust_set_flags (self, g_value_get_flags (value));
+ break;
+ case PROP_DPI_X:
+ rsvg_handle_rust_set_dpi_x (self, g_value_get_double (value));
+ break;
+ case PROP_DPI_Y:
+ rsvg_handle_rust_set_dpi_y (self, g_value_get_double (value));
+ break;
+ case PROP_BASE_URI: {
+ const char *str = g_value_get_string (value);
+
+ if (str) {
+ rsvg_handle_set_base_uri (self, str);
+ }
+
+ break;
+ }
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (instance, prop_id, pspec);
+ }
+}
-GType
-rsvg_handle_get_type (void)
+static void
+rsvg_handle_get_property (GObject * instance, guint prop_id, GValue * value, GParamSpec * pspec)
{
- return rsvg_handle_rust_get_type ();
+ RsvgHandle *self = RSVG_HANDLE (instance);
+ RsvgDimensionData dim;
+
+ switch (prop_id) {
+ case PROP_FLAGS:
+ g_value_set_flags (value, rsvg_handle_rust_get_flags (self));
+ break;
+ case PROP_DPI_X:
+ g_value_set_double (value, rsvg_handle_rust_get_dpi_x (self));
+ break;
+ case PROP_DPI_Y:
+ g_value_set_double (value, rsvg_handle_rust_get_dpi_y (self));
+ break;
+ case PROP_BASE_URI:
+ g_value_set_string (value, rsvg_handle_get_base_uri (self));
+ break;
+ case PROP_WIDTH:
+ rsvg_handle_get_dimensions (self, &dim);
+ g_value_set_int (value, dim.width);
+ break;
+ case PROP_HEIGHT:
+ rsvg_handle_get_dimensions (self, &dim);
+ g_value_set_int (value, dim.height);
+ break;
+ case PROP_EM:
+ rsvg_handle_get_dimensions (self, &dim);
+ g_value_set_double (value, dim.em);
+ break;
+ case PROP_EX:
+ rsvg_handle_get_dimensions (self, &dim);
+ g_value_set_double (value, dim.ex);
+ break;
+ case PROP_TITLE:
+ /* deprecated */
+ break;
+ case PROP_DESC:
+ /* deprecated */
+ break;
+ case PROP_METADATA:
+ g_value_set_string (value, rsvg_handle_get_metadata (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (instance, prop_id, pspec);
+ }
+}
+
+static void
+rsvg_handle_class_init (RsvgHandleClass * klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = rsvg_handle_dispose;
+ gobject_class->set_property = rsvg_handle_set_property;
+ gobject_class->get_property = rsvg_handle_get_property;
+
+ /**
+ * RsvgHandle:flags:
+ *
+ * Flags from #RsvgHandleFlags.
+ *
+ * Since: 2.36
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_FLAGS,
+ g_param_spec_flags ("flags", NULL, NULL,
+ RSVG_TYPE_HANDLE_FLAGS,
+ RSVG_HANDLE_FLAGS_NONE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * dpi-x:
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_DPI_X,
+ g_param_spec_double ("dpi-x", _("Horizontal resolution"),
+ _("Horizontal resolution"),
+ 0., G_MAXDOUBLE, 0.,
+ (GParamFlags) (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT)));
+
+ g_object_class_install_property (gobject_class,
+ PROP_DPI_Y,
+ g_param_spec_double ("dpi-y", _("Vertical resolution"),
+ _("Vertical resolution"),
+ 0., G_MAXDOUBLE, 0.,
+ (GParamFlags) (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT)));
+
+ g_object_class_install_property (gobject_class,
+ PROP_BASE_URI,
+ g_param_spec_string ("base-uri", _("Base URI"),
+ _("Base URI"), NULL,
+ (GParamFlags) (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT)));
+
+ g_object_class_install_property (gobject_class,
+ PROP_WIDTH,
+ g_param_spec_int ("width", _("Image width"),
+ _("Image width"), 0, G_MAXINT, 0,
+ (GParamFlags) (G_PARAM_READABLE)));
+
+ g_object_class_install_property (gobject_class,
+ PROP_HEIGHT,
+ g_param_spec_int ("height", _("Image height"),
+ _("Image height"), 0, G_MAXINT, 0,
+ (GParamFlags) (G_PARAM_READABLE)));
+
+ g_object_class_install_property (gobject_class,
+ PROP_EM,
+ g_param_spec_double ("em", _("em"),
+ _("em"), 0, G_MAXDOUBLE, 0,
+ (GParamFlags) (G_PARAM_READABLE)));
+
+ g_object_class_install_property (gobject_class,
+ PROP_EX,
+ g_param_spec_double ("ex", _("ex"),
+ _("ex"), 0, G_MAXDOUBLE, 0,
+ (GParamFlags) (G_PARAM_READABLE)));
+
+ /**
+ * RsvgHandle:title:
+ *
+ * SVG's description
+ *
+ * Deprecated: 2.36
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TITLE,
+ g_param_spec_string ("title", _("Title"),
+ _("SVG file title"), NULL,
+ (GParamFlags) (G_PARAM_READABLE)));
+
+ /**
+ * RsvgHandle:desc:
+ *
+ * SVG's description
+ *
+ * Deprecated: 2.36
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_DESC,
+ g_param_spec_string ("desc", _("Description"),
+ _("SVG file description"), NULL,
+ (GParamFlags) (G_PARAM_READABLE)));
+
+ /**
+ * RsvgHandle:metadata:
+ *
+ * SVG's description
+ *
+ * Deprecated: 2.36
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_METADATA,
+ g_param_spec_string ("metadata", _("Metadata"),
+ _("SVG file metadata"), NULL,
+ (GParamFlags) (G_PARAM_READABLE)));
}
/**
@@ -713,6 +944,13 @@ rsvg_handle_get_desc (RsvgHandle *handle)
return NULL;
}
+RsvgHandleRust *
+rsvg_handle_get_rust (RsvgHandle *handle)
+{
+ RsvgHandlePrivate *priv = rsvg_handle_get_instance_private (handle);
+ return priv->rust_handle;
+}
+
/**
* rsvg_handle_render_cairo_sub:
* @handle: A #RsvgHandle
diff --git a/rsvg_internals/Cargo.toml b/rsvg_internals/Cargo.toml
index 5d0435d9..268498b9 100644
--- a/rsvg_internals/Cargo.toml
+++ b/rsvg_internals/Cargo.toml
@@ -20,21 +20,20 @@ build = "build.rs"
phf_codegen = "0.7.21"
[dependencies]
-bitflags = "1.0"
-cairo-rs = { git="https://github.com/gtk-rs/cairo", branch="master" }
-cairo-sys-rs = { git="https://github.com/gtk-rs/cairo", branch="master" }
+cairo-rs = "0.5.0"
+cairo-sys-rs = "0.7.0"
cssparser = "0.25.1"
data-url = "0.1"
downcast-rs = "^1.0.0"
encoding = "0.2.33"
float-cmp = "0.4.0"
-gdk-pixbuf = { git="https://github.com/gtk-rs/gdk-pixbuf", branch="master" }
-gdk-pixbuf-sys = { git="https://github.com/gtk-rs/sys", branch="master" }
-gio = { git="https://github.com/gtk-rs/gio", branch="master", features=["v2_48"] } # per configure.ac
-gio-sys = { git="https://github.com/gtk-rs/sys", branch="master" }
-glib = { git="https://github.com/gtk-rs/glib", branch="master", features=["subclassing"] }
-glib-sys = { git="https://github.com/gtk-rs/sys", branch="master" }
-gobject-sys = { git="https://github.com/gtk-rs/sys", branch="master" }
+gdk-pixbuf = "0.5.0"
+gdk-pixbuf-sys = "0.7.0"
+gio = { version="0.5.1", features=["v2_48"] } # per configure.ac
+gio-sys = "0.7.0"
+glib = "0.6.0"
+glib-sys = "0.7.0"
+gobject-sys = "0.7.0"
itertools = "0.7.4"
language-tags = "0.2.2"
lazy_static = "1.0.0"
@@ -43,9 +42,9 @@ locale_config = "*" # recommended explicitly by locale_config's README.md
nalgebra = "0.16"
num-traits = "0.2"
owning_ref = "0.4.0"
-pango = { git="https://github.com/gtk-rs/pango", branch="master" }
-pango-sys = { git="https://github.com/gtk-rs/sys", branch="master" }
-pangocairo = { git="https://github.com/gtk-rs/pangocairo", branch="master" }
+pango = "0.5.0"
+pango-sys = "0.7.0"
+pangocairo = "0.6.0"
phf = "0.7.21"
rayon = "1"
regex = "1"
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index da444f79..b763d1d2 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -106,7 +106,6 @@ pub enum RenderingError {
InvalidHref,
SvgHasNoSize,
OutOfMemory,
- HandleIsNotLoaded,
}
impl From<cairo::Status> for RenderingError {
@@ -246,7 +245,6 @@ impl error::Error for RenderingError {
RenderingError::InvalidHref => "invalid href",
RenderingError::SvgHasNoSize => "svg has no size",
RenderingError::OutOfMemory => "out of memory",
- RenderingError::HandleIsNotLoaded => "SVG data is not loaded into handle",
}
}
}
@@ -260,8 +258,7 @@ impl fmt::Display for RenderingError {
| RenderingError::InstancingLimit
| RenderingError::InvalidHref
| RenderingError::SvgHasNoSize
- | RenderingError::OutOfMemory
- | RenderingError::HandleIsNotLoaded => write!(f, "{}", self.description()),
+ | RenderingError::OutOfMemory => write!(f, "{}", self.description()),
}
}
}
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 800fc6b5..df27afc9 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -65,12 +65,12 @@ impl Default for SpreadMethod {
}
}
-impl From<SpreadMethod> for cairo::Extend {
- fn from(s: SpreadMethod) -> cairo::Extend {
+impl From<SpreadMethod> for cairo::enums::Extend {
+ fn from(s: SpreadMethod) -> cairo::enums::Extend {
match s {
- SpreadMethod::Pad => cairo::Extend::Pad,
- SpreadMethod::Reflect => cairo::Extend::Reflect,
- SpreadMethod::Repeat => cairo::Extend::Repeat,
+ SpreadMethod::Pad => cairo::enums::Extend::Pad,
+ SpreadMethod::Reflect => cairo::enums::Extend::Reflect,
+ SpreadMethod::Repeat => cairo::enums::Extend::Repeat,
}
}
}
@@ -483,7 +483,7 @@ fn set_common_on_pattern<P: cairo::PatternTrait + cairo::Gradient>(
affine.invert();
pattern.set_matrix(affine);
- pattern.set_extend(cairo::Extend::from(
+ pattern.set_extend(cairo::enums::Extend::from(
gradient.common.spread.unwrap_or_default(),
));
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 3492c366..b179cf56 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -13,7 +13,6 @@ use gdk_pixbuf::Pixbuf;
use gdk_pixbuf_sys;
use gio::{self, FileExt};
use gio_sys;
-use glib::subclass::types::ObjectSubclass;
use glib::translate::*;
use glib::{self, Bytes, Cast};
use glib_sys;
@@ -22,7 +21,6 @@ use libc;
use url::Url;
use allowed_url::{AllowedUrl, Href};
-use c_api::{get_rust_handle, HandleFlags, RsvgHandle, RsvgHandleFlags};
use dpi::Dpi;
use drawing_ctx::{DrawingCtx, RsvgRectangle};
use error::{set_gerror, DefsLookupErrorKind, LoadingError, RenderingError};
@@ -36,10 +34,10 @@ use xml::XmlState;
use xml2_load::xml_state_load_from_possibly_compressed_stream;
// A *const RsvgHandle is just an opaque pointer we get from C
-// #[repr(C)]
-// pub struct RsvgHandle {
-// _private: [u8; 0],
-// }
+#[repr(C)]
+pub struct RsvgHandle {
+ _private: [u8; 0],
+}
// Keep in sync with rsvg.h:RsvgDimensionData
#[repr(C)]
@@ -59,7 +57,7 @@ pub struct RsvgPositionData {
/// Flags used during loading
///
-/// We communicate these to/from the C code with a HandleFlags
+/// We communicate these to/from the C code with a guint <-> u32,
/// and this struct provides to_flags() and from_flags() methods.
#[derive(Default, Copy, Clone)]
pub struct LoadFlags {
@@ -146,20 +144,20 @@ impl Drop for SizeCallback {
}
pub struct Handle {
- pub dpi: Cell<Dpi>,
- pub base_url: RefCell<Option<Url>>,
+ dpi: Cell<Dpi>,
+ base_url: RefCell<Option<Url>>,
base_url_cstring: RefCell<Option<CString>>, // needed because the C api returns *const char
svg: RefCell<Option<Rc<Svg>>>,
- pub load_flags: Cell<LoadFlags>,
+ load_flags: Cell<LoadFlags>,
load_state: Cell<LoadState>,
- buffer: RefCell<Vec<u8>>, // used by the legacy write() api
+ buffer: Vec<u8>, // used by the legacy write() api
size_callback: RefCell<SizeCallback>,
in_loop: Cell<bool>,
is_testing: Cell<bool>,
}
impl Handle {
- pub fn new() -> Handle {
+ fn new() -> Handle {
Handle {
dpi: Cell::new(Dpi::default()),
base_url: RefCell::new(None),
@@ -167,15 +165,14 @@ impl Handle {
svg: RefCell::new(None),
load_flags: Cell::new(LoadFlags::default()),
load_state: Cell::new(LoadState::Start),
- buffer: RefCell::new(Vec::new()),
+ buffer: Vec::new(),
size_callback: RefCell::new(SizeCallback::new()),
in_loop: Cell::new(false),
is_testing: Cell::new(false),
}
}
- // from the public API
- pub fn set_base_url(&self, url: &str) {
+ fn set_base_url(&self, url: &str) {
if self.load_state.get() != LoadState::Start {
rsvg_g_warning(
"Please set the base file or URI before loading any data into RsvgHandle",
@@ -211,7 +208,7 @@ impl Handle {
}
pub fn read_stream_sync(
- &self,
+ &mut self,
stream: &gio::InputStream,
cancellable: Option<&gio::Cancellable>,
) -> Result<(), LoadingError> {
@@ -228,45 +225,21 @@ impl Handle {
Ok(())
}
- fn check_is_loaded(self: &Handle) -> Result<(), RenderingError> {
- match self.load_state.get() {
- LoadState::Start => {
- rsvg_g_warning("RsvgHandle has not been loaded");
- Err(RenderingError::HandleIsNotLoaded)
- }
-
- LoadState::Loading => {
- rsvg_g_warning("RsvgHandle is still loading; call rsvg_handle_close() first");
- Err(RenderingError::HandleIsNotLoaded)
- }
-
- LoadState::ClosedOk => Ok(()),
-
- LoadState::ClosedError => {
- rsvg_g_warning(
- "RsvgHandle could not read or parse the SVG; did you check for errors during \
- the loading stage?",
- );
- Err(RenderingError::HandleIsNotLoaded)
- }
- }
- }
-
fn load_options(&self) -> LoadOptions {
LoadOptions::new(self.load_flags.get(), self.base_url.borrow().clone())
}
- pub fn write(&self, buf: &[u8]) {
+ pub fn write(&mut self, buf: &[u8]) {
match self.load_state.get() {
LoadState::Start => self.load_state.set(LoadState::Loading),
LoadState::Loading => (),
_ => unreachable!(),
};
- self.buffer.borrow_mut().extend_from_slice(buf);
+ self.buffer.extend_from_slice(buf);
}
- pub fn close(&self) -> Result<(), LoadingError> {
+ pub fn close(&mut self) -> Result<(), LoadingError> {
let res = match self.load_state.get() {
LoadState::Start => {
self.load_state.set(LoadState::ClosedError);
@@ -274,8 +247,7 @@ impl Handle {
}
LoadState::Loading => {
- let buffer = self.buffer.borrow();
- let bytes = Bytes::from(&*buffer);
+ let bytes = Bytes::from(&self.buffer);
let stream = gio::MemoryInputStream::new_from_bytes(&bytes);
let mut xml = XmlState::new(&self.load_options());
@@ -315,7 +287,7 @@ impl Handle {
}
fn create_drawing_ctx_for_node(
- &self,
+ &mut self,
cr: &cairo::Context,
dimensions: &RsvgDimensionData,
node: Option<&RsvgNode>,
@@ -338,21 +310,7 @@ impl Handle {
draw_ctx
}
- pub fn has_sub(&self, id: &str) -> Result<bool, RenderingError> {
- self.check_is_loaded()?;
-
- match self.lookup_node(id) {
- Ok(_) => Ok(true),
-
- Err(DefsLookupErrorKind::NotFound) => Ok(false),
-
- Err(e) => Err(RenderingError::InvalidId(e)),
- }
- }
-
- pub fn get_dimensions(&self) -> Result<RsvgDimensionData, RenderingError> {
- self.check_is_loaded()?;
-
+ pub fn get_dimensions(&mut self) -> Result<RsvgDimensionData, RenderingError> {
// This function is probably called from the cairo_render functions,
// or is being erroneously called within the size_func.
// To prevent an infinite loop we are saving the state, and
@@ -381,26 +339,10 @@ impl Handle {
})
}
- pub fn get_dimensions_no_error(&self) -> RsvgDimensionData {
- match self.get_dimensions() {
- Ok(dimensions) => dimensions,
-
- Err(_) => {
- RsvgDimensionData {
- width: 0,
- height: 0,
- em: 0.0,
- ex: 0.0,
- }
-
- // This old API doesn't even let us return an error, sigh.
- }
- }
- }
-
- fn get_dimensions_sub(&self, id: Option<&str>) -> Result<RsvgDimensionData, RenderingError> {
- self.check_is_loaded()?;
-
+ fn get_dimensions_sub(
+ &mut self,
+ id: Option<&str>,
+ ) -> Result<RsvgDimensionData, RenderingError> {
let (ink_r, _) = self.get_geometry_sub(id)?;
let (w, h) = self
@@ -416,9 +358,7 @@ impl Handle {
})
}
- fn get_position_sub(&self, id: Option<&str>) -> Result<RsvgPositionData, RenderingError> {
- self.check_is_loaded()?;
-
+ fn get_position_sub(&mut self, id: Option<&str>) -> Result<RsvgPositionData, RenderingError> {
if let None = id {
return Ok(RsvgPositionData { x: 0, y: 0 });
}
@@ -444,7 +384,7 @@ impl Handle {
/// Returns (ink_rect, logical_rect)
fn get_node_geometry(
- &self,
+ &mut self,
node: &RsvgNode,
) -> Result<(RsvgRectangle, RsvgRectangle), RenderingError> {
let dimensions = self.get_dimensions()?;
@@ -471,11 +411,9 @@ impl Handle {
/// Returns (ink_rect, logical_rect)
fn get_geometry_sub(
- &self,
+ &mut self,
id: Option<&str>,
) -> Result<(RsvgRectangle, RsvgRectangle), RenderingError> {
- self.check_is_loaded()?;
-
let root = self.get_root();
let (node, is_root) = if let Some(id) = id {
@@ -506,7 +444,7 @@ impl Handle {
self.get_node_geometry(&node)
}
- fn lookup_node(&self, id: &str) -> Result<RsvgNode, DefsLookupErrorKind> {
+ fn lookup_node(&mut self, id: &str) -> Result<RsvgNode, DefsLookupErrorKind> {
let svg_ref = self.svg.borrow();
let svg = svg_ref.as_ref().unwrap();
@@ -544,12 +482,10 @@ impl Handle {
}
pub fn render_cairo_sub(
- &self,
+ &mut self,
cr: &cairo::Context,
id: Option<&str>,
) -> Result<(), RenderingError> {
- self.check_is_loaded()?;
-
let status = cr.status();
if status != Status::Success {
let msg = format!(
@@ -578,26 +514,8 @@ impl Handle {
res
}
- fn get_pixbuf_sub(&self, id: Option<&str>) -> Result<Pixbuf, RenderingError> {
- self.check_is_loaded()?;
-
- let dimensions = self.get_dimensions()?;
-
- let surface =
- ImageSurface::create(cairo::Format::ARgb32, dimensions.width, dimensions.height)?;
-
- {
- let cr = cairo::Context::new(&surface);
- self.render_cairo_sub(&cr, id)?;
- }
-
- let surface = SharedImageSurface::new(surface, SurfaceType::SRgb)?;
-
- pixbuf_from_surface(&surface)
- }
-
fn construct_new_from_gfile_sync(
- &self,
+ &mut self,
file: &gio::File,
cancellable: Option<&gio::Cancellable>,
) -> Result<(), LoadingError> {
@@ -606,7 +524,7 @@ impl Handle {
}
fn construct_read_stream_sync(
- &self,
+ &mut self,
stream: &gio::InputStream,
base_file: Option<&gio::File>,
cancellable: Option<&gio::Cancellable>,
@@ -617,46 +535,42 @@ impl Handle {
self.read_stream_sync(stream, cancellable)
}
-
- // from the public API
- pub fn set_load_flags(&self, flags: HandleFlags) {
- self.load_flags.set(LoadFlags::from_flags(flags));
- }
-
- // from the public API
- pub fn set_dpi_x(&self, dpi_x: f64) {
- self.dpi.set(Dpi::new(dpi_x, self.dpi.get().y()));
- }
-
- // from the public API
- pub fn set_dpi_y(&self, dpi_y: f64) {
- self.dpi.set(Dpi::new(self.dpi.get().x(), dpi_y));
- }
}
+// Keep these in sync with rsvg.h:RsvgHandleFlags
+const RSVG_HANDLE_FLAG_UNLIMITED: u32 = 1 << 0;
+const RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA: u32 = 1 << 1;
+
impl LoadFlags {
- pub fn from_flags(flags: HandleFlags) -> Self {
+ pub fn from_flags(flags: u32) -> Self {
LoadFlags {
- unlimited_size: flags.contains(HandleFlags::UNLIMITED),
- keep_image_data: flags.contains(HandleFlags::KEEP_IMAGE_DATA),
+ unlimited_size: (flags & RSVG_HANDLE_FLAG_UNLIMITED) != 0,
+ keep_image_data: (flags & RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA) != 0,
}
}
- pub fn to_flags(&self) -> HandleFlags {
- let mut flags = HandleFlags::empty();
+ fn to_flags(&self) -> u32 {
+ let mut flags = 0;
if self.unlimited_size {
- flags.insert(HandleFlags::UNLIMITED);
+ flags |= RSVG_HANDLE_FLAG_UNLIMITED;
}
if self.keep_image_data {
- flags.insert(HandleFlags::KEEP_IMAGE_DATA);
+ flags |= RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA;
}
flags
}
}
+#[allow(improper_ctypes)]
+extern "C" {
+ fn rsvg_handle_get_type() -> glib_sys::GType;
+
+ fn rsvg_handle_get_rust(handle: *const RsvgHandle) -> *mut Handle;
+}
+
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_new() -> *mut Handle {
Box::into_raw(Box::new(Handle::new()))
@@ -668,9 +582,13 @@ pub unsafe extern "C" fn rsvg_handle_rust_free(raw_handle: *mut Handle) {
Box::from_raw(raw_handle);
}
+pub fn get_rust_handle<'a>(handle: *const RsvgHandle) -> &'a mut Handle {
+ unsafe { &mut *(rsvg_handle_get_rust(handle) as *mut Handle) }
+}
+
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_set_base_url(
- raw_handle: *const RsvgHandle,
+ raw_handle: *mut RsvgHandle,
uri: *const libc::c_char,
) {
let rhandle = get_rust_handle(raw_handle);
@@ -695,7 +613,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_base_gfile(
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_set_base_gfile(
- raw_handle: *const RsvgHandle,
+ raw_handle: *mut RsvgHandle,
raw_gfile: *mut gio_sys::GFile,
) {
let rhandle = get_rust_handle(raw_handle);
@@ -720,7 +638,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_base_url(
}
#[no_mangle]
-pub unsafe extern "C" fn rsvg_handle_rust_set_dpi_x(raw_handle: *const RsvgHandle, dpi_x: f64) {
+pub unsafe extern "C" fn rsvg_handle_rust_set_dpi_x(raw_handle: *mut RsvgHandle, dpi_x: f64) {
let rhandle = get_rust_handle(raw_handle);
rhandle.dpi.set(Dpi::new(dpi_x, rhandle.dpi.get().y()));
@@ -734,7 +652,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_dpi_x(raw_handle: *const RsvgHandl
}
#[no_mangle]
-pub unsafe extern "C" fn rsvg_handle_rust_set_dpi_y(raw_handle: *const RsvgHandle, dpi_y: f64) {
+pub unsafe extern "C" fn rsvg_handle_rust_set_dpi_y(raw_handle: *mut RsvgHandle, dpi_y: f64) {
let rhandle = get_rust_handle(raw_handle);
rhandle.dpi.set(Dpi::new(rhandle.dpi.get().x(), dpi_y));
@@ -748,29 +666,22 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_dpi_y(raw_handle: *const RsvgHandl
}
#[no_mangle]
-pub unsafe extern "C" fn rsvg_handle_rust_get_flags(
- raw_handle: *const RsvgHandle,
-) -> RsvgHandleFlags {
+pub unsafe extern "C" fn rsvg_handle_rust_get_flags(raw_handle: *const RsvgHandle) -> u32 {
let rhandle = get_rust_handle(raw_handle);
- rhandle.load_flags.get().to_flags().to_glib()
+ rhandle.load_flags.get().to_flags()
}
#[no_mangle]
-pub unsafe extern "C" fn rsvg_handle_rust_set_flags(
- raw_handle: *const RsvgHandle,
- flags: RsvgHandleFlags,
-) {
+pub unsafe extern "C" fn rsvg_handle_rust_set_flags(raw_handle: *const RsvgHandle, flags: u32) {
let rhandle = get_rust_handle(raw_handle);
- rhandle
- .load_flags
- .set(LoadFlags::from_flags(from_glib(flags)));
+ rhandle.load_flags.set(LoadFlags::from_flags(flags));
}
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_set_size_callback(
- raw_handle: *const RsvgHandle,
+ raw_handle: *mut RsvgHandle,
size_func: RsvgSizeFunc,
user_data: glib_sys::gpointer,
destroy_notify: glib_sys::GDestroyNotify,
@@ -786,7 +697,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_set_size_callback(
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_set_testing(
- raw_handle: *const RsvgHandle,
+ raw_handle: *mut RsvgHandle,
testing: glib_sys::gboolean,
) {
let rhandle = get_rust_handle(raw_handle);
@@ -794,9 +705,33 @@ pub unsafe extern "C" fn rsvg_handle_rust_set_testing(
rhandle.is_testing.set(from_glib(testing));
}
+fn is_loaded(handle: &Handle) -> bool {
+ match handle.load_state.get() {
+ LoadState::Start => {
+ rsvg_g_warning("RsvgHandle has not been loaded");
+ false
+ }
+
+ LoadState::Loading => {
+ rsvg_g_warning("RsvgHandle is still loading; call rsvg_handle_close() first");
+ false
+ }
+
+ LoadState::ClosedOk => true,
+
+ LoadState::ClosedError => {
+ rsvg_g_warning(
+ "RsvgHandle could not read or parse the SVG; did you check for errors during the \
+ loading stage?",
+ );
+ false
+ }
+ }
+}
+
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_read_stream_sync(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
stream: *mut gio_sys::GInputStream,
cancellable: *mut gio_sys::GCancellable,
error: *mut *mut glib_sys::GError,
@@ -825,7 +760,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_read_stream_sync(
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_write(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
buf: *const u8,
count: usize,
) {
@@ -845,7 +780,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_write(
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_close(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
let rhandle = get_rust_handle(handle);
@@ -862,13 +797,17 @@ pub unsafe extern "C" fn rsvg_handle_rust_close(
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_get_geometry_sub(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
out_ink_rect: *mut RsvgRectangle,
out_logical_rect: *mut RsvgRectangle,
id: *const libc::c_char,
) -> glib_sys::gboolean {
let rhandle = get_rust_handle(handle);
+ if !is_loaded(rhandle) {
+ return false.to_glib();
+ }
+
let id: Option<String> = from_glib_none(id);
match rhandle.get_geometry_sub(id.as_ref().map(String::as_str)) {
@@ -901,23 +840,26 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_geometry_sub(
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_has_sub(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
id: *const libc::c_char,
) -> glib_sys::gboolean {
let rhandle = get_rust_handle(handle);
+ if !is_loaded(rhandle) {
+ return false.to_glib();
+ }
+
if id.is_null() {
return false.to_glib();
}
let id: String = from_glib_none(id);
- // FIXME: return a proper error code to the public API
- rhandle.has_sub(&id).unwrap_or(false).to_glib()
+ rhandle.lookup_node(&id).is_ok().to_glib()
}
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_render_cairo_sub(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
cr: *mut cairo_sys::cairo_t,
id: *const libc::c_char,
) -> glib_sys::gboolean {
@@ -925,6 +867,10 @@ pub unsafe extern "C" fn rsvg_handle_rust_render_cairo_sub(
let cr = from_glib_none(cr);
let id: Option<String> = from_glib_none(id);
+ if !is_loaded(rhandle) {
+ return false.to_glib();
+ }
+
match rhandle.render_cairo_sub(&cr, id.as_ref().map(String::as_str)) {
Ok(()) => true.to_glib(),
@@ -935,15 +881,34 @@ pub unsafe extern "C" fn rsvg_handle_rust_render_cairo_sub(
}
}
+fn get_pixbuf_sub(handle: &mut Handle, id: Option<&str>) -> Result<Pixbuf, RenderingError> {
+ let dimensions = handle.get_dimensions()?;
+
+ let surface = ImageSurface::create(cairo::Format::ARgb32, dimensions.width, dimensions.height)?;
+
+ {
+ let cr = cairo::Context::new(&surface);
+ handle.render_cairo_sub(&cr, id)?;
+ }
+
+ let surface = SharedImageSurface::new(surface, SurfaceType::SRgb)?;
+
+ pixbuf_from_surface(&surface)
+}
+
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_get_pixbuf_sub(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
id: *const libc::c_char,
) -> *mut gdk_pixbuf_sys::GdkPixbuf {
let rhandle = get_rust_handle(handle);
let id: Option<String> = from_glib_none(id);
- match rhandle.get_pixbuf_sub(id.as_ref().map(String::as_str)) {
+ if !is_loaded(rhandle) {
+ return ptr::null_mut();
+ }
+
+ match get_pixbuf_sub(rhandle, id.as_ref().map(String::as_str)) {
Ok(pixbuf) => pixbuf.to_glib_full(),
Err(_) => ptr::null_mut(),
}
@@ -951,22 +916,45 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_pixbuf_sub(
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_get_dimensions(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
dimension_data: *mut RsvgDimensionData,
) {
let rhandle = get_rust_handle(handle);
- *dimension_data = rhandle.get_dimensions_no_error();
+ if !is_loaded(rhandle) {
+ return;
+ }
+
+ match rhandle.get_dimensions() {
+ Ok(dimensions) => {
+ *dimension_data = dimensions;
+ }
+
+ Err(_) => {
+ let d = &mut *dimension_data;
+
+ d.width = 0;
+ d.height = 0;
+ d.em = 0.0;
+ d.ex = 0.0;
+
+ // This old API doesn't even let us return an error, sigh.
+ }
+ }
}
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_get_dimensions_sub(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
dimension_data: *mut RsvgDimensionData,
id: *const libc::c_char,
) -> glib_sys::gboolean {
let rhandle = get_rust_handle(handle);
+ if !is_loaded(rhandle) {
+ return false.to_glib();
+ }
+
let id: Option<String> = from_glib_none(id);
match rhandle.get_dimensions_sub(id.as_ref().map(String::as_str)) {
@@ -991,12 +979,16 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_dimensions_sub(
#[no_mangle]
pub unsafe extern "C" fn rsvg_handle_rust_get_position_sub(
- handle: *const RsvgHandle,
+ handle: *mut RsvgHandle,
position_data: *mut RsvgPositionData,
id: *const libc::c_char,
) -> glib_sys::gboolean {
let rhandle = get_rust_handle(handle);
+ if !is_loaded(rhandle) {
+ return false.to_glib();
+ }
+
let id: Option<String> = from_glib_none(id);
match rhandle.get_position_sub(id.as_ref().map(String::as_str)) {
@@ -1018,9 +1010,9 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_position_sub(
}
#[no_mangle]
-pub unsafe extern "C" fn rsvg_handle_rust_new_with_flags(flags: u32) -> *const RsvgHandle {
+pub unsafe extern "C" fn rsvg_handle_rust_new_with_flags(flags: u32) -> *mut RsvgHandle {
let obj: *mut gobject_sys::GObject =
- glib::Object::new(Handle::get_type(), &[("flags", &flags)])
+ glib::Object::new(from_glib(rsvg_handle_get_type()), &[("flags", &flags)])
.unwrap()
.to_glib_full();
@@ -1031,7 +1023,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_new_with_flags(flags: u32) -> *const R
pub unsafe extern "C" fn rsvg_handle_rust_new_from_file(
filename: *const libc::c_char,
error: *mut *mut glib_sys::GError,
-) -> *const RsvgHandle {
+) -> *mut RsvgHandle {
// This API lets the caller pass a URI, or a file name in the operating system's
// encoding. So, first we'll see if it's UTF-8, and in that case, try the URL version.
// Otherwise, we'll try building a path name.
@@ -1054,7 +1046,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_new_from_gfile_sync(
flags: u32,
cancellable: *mut gio_sys::GCancellable,
error: *mut *mut glib_sys::GError,
-) -> *const RsvgHandle {
+) -> *mut RsvgHandle {
let raw_handle = rsvg_handle_rust_new_with_flags(flags);
let rhandle = get_rust_handle(raw_handle);
@@ -1080,7 +1072,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_new_from_stream_sync(
flags: u32,
cancellable: *mut gio_sys::GCancellable,
error: *mut *mut glib_sys::GError,
-) -> *const RsvgHandle {
+) -> *mut RsvgHandle {
let raw_handle = rsvg_handle_rust_new_with_flags(flags);
let rhandle = get_rust_handle(raw_handle);
@@ -1105,7 +1097,7 @@ pub unsafe extern "C" fn rsvg_handle_rust_new_from_data(
data: *mut u8,
len: usize,
error: *mut *mut glib_sys::GError,
-) -> *const RsvgHandle {
+) -> *mut RsvgHandle {
// We create the MemoryInputStream without the gtk-rs binding because of this:
//
// - The binding doesn't provide _new_from_data(). All of the binding's ways to
diff --git a/rsvg_internals/src/io.rs b/rsvg_internals/src/io.rs
index 2307a5c0..48efb4ef 100644
--- a/rsvg_internals/src/io.rs
+++ b/rsvg_internals/src/io.rs
@@ -109,7 +109,7 @@ pub fn acquire_data(
let (contents, _etag) = file.load_contents(cancellable)?;
let (content_type, _uncertain) = gio::content_type_guess(uri, &contents);
- let mime_type = gio::content_type_get_mime_type(&content_type).map(String::from);
+ let mime_type = gio::content_type_get_mime_type(&content_type);
Ok(BinaryData {
data: contents,
diff --git a/rsvg_internals/src/lib.rs b/rsvg_internals/src/lib.rs
index 7212d06a..e979c7ed 100644
--- a/rsvg_internals/src/lib.rs
+++ b/rsvg_internals/src/lib.rs
@@ -14,6 +14,7 @@ extern crate gdk_pixbuf;
extern crate gdk_pixbuf_sys;
extern crate gio;
extern crate gio_sys;
+extern crate glib;
extern crate glib_sys;
extern crate gobject_sys;
extern crate itertools;
@@ -34,12 +35,6 @@ extern crate xml as xml_rs;
#[macro_use]
extern crate lazy_static;
-#[macro_use]
-extern crate bitflags;
-
-#[macro_use]
-extern crate glib;
-
pub use color::{rsvg_css_parse_color, ColorKind, ColorSpec};
pub use dpi::rsvg_rust_set_default_dpi_x_y;
@@ -102,7 +97,6 @@ mod angle;
mod aspect_ratio;
mod attributes;
mod bbox;
-mod c_api;
mod clip_path;
mod color;
mod cond;
diff --git a/rsvg_internals/src/pixbuf_utils.rs b/rsvg_internals/src/pixbuf_utils.rs
index 1bea47c9..bfdd6dbf 100644
--- a/rsvg_internals/src/pixbuf_utils.rs
+++ b/rsvg_internals/src/pixbuf_utils.rs
@@ -7,9 +7,8 @@ use glib::translate::*;
use glib_sys;
use libc;
-use c_api::get_rust_handle;
use error::{set_gerror, RenderingError};
-use handle::{rsvg_handle_rust_new_from_gfile_sync, Handle, RsvgDimensionData};
+use handle::{get_rust_handle, rsvg_handle_rust_new_from_gfile_sync, Handle, RsvgDimensionData};
use rect::IRect;
use surface_utils::{
iterators::Pixels,
@@ -135,7 +134,7 @@ fn get_final_size(dimensions: &RsvgDimensionData, size_mode: &SizeMode) -> (i32,
}
fn render_to_pixbuf_at_size(
- handle: &Handle,
+ handle: &mut Handle,
dimensions: &RsvgDimensionData,
width: i32,
height: i32,
diff --git a/rsvg_internals/src/svg.rs b/rsvg_internals/src/svg.rs
index 48284c0d..dc75d9d5 100644
--- a/rsvg_internals/src/svg.rs
+++ b/rsvg_internals/src/svg.rs
@@ -1,3 +1,4 @@
+use cairo::Status;
use gdk_pixbuf::{PixbufLoader, PixbufLoaderExt};
use gio;
use glib::translate::*;
@@ -201,7 +202,7 @@ fn load_image(
length: libc::c_ulong,
destroy: cairo_sys::cairo_destroy_func_t,
closure: *mut libc::c_void,
- ) -> cairo_sys::cairo_status_t;
+ ) -> Status;
}
let data_ptr = ToGlibContainerFromSlice::to_glib_full_from_slice(&data.data);
@@ -216,8 +217,8 @@ fn load_image(
data_ptr as *mut _,
);
- if status != cairo_sys::STATUS_SUCCESS {
- return Err(LoadingError::Cairo(status.into()));
+ if status != Status::Success {
+ return Err(LoadingError::Cairo(status));
}
}
}
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index aa654e69..a34be604 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -927,8 +927,8 @@ fn get_pango_context(cr: &cairo::Context, is_testing: bool) -> pango::Context {
let mut options = cairo::FontOptions::new();
options.set_antialias(cairo::Antialias::Gray);
- options.set_hint_style(cairo::HintStyle::Full);
- options.set_hint_metrics(cairo::HintMetrics::On);
+ options.set_hint_style(cairo::enums::HintStyle::Full);
+ options.set_hint_metrics(cairo::enums::HintMetrics::On);
pangocairo::functions::context_set_font_options(&context, &options);
}
diff --git a/tests/api.c b/tests/api.c
index 54545a57..1f075a6c 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -809,129 +809,6 @@ cannot_request_external_elements (void)
g_test_trap_assert_stderr ("*WARNING*the public API is not allowed to look up external references*");
}
-static void
-test_flags (RsvgHandleFlags flags)
-{
- guint read_flags;
-
- RsvgHandle *handle = g_object_new (RSVG_TYPE_HANDLE,
- "flags", flags,
- NULL);
- g_object_get (handle, "flags", &read_flags, NULL);
- g_assert (read_flags == flags);
-
- g_object_unref (handle);
-}
-
-static void
-property_flags (void)
-{
- test_flags (RSVG_HANDLE_FLAGS_NONE);
- test_flags (RSVG_HANDLE_FLAG_UNLIMITED);
- test_flags (RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA);
- test_flags (RSVG_HANDLE_FLAG_UNLIMITED | RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA);
-}
-
-static void
-property_dpi (void)
-{
- RsvgHandle *handle = g_object_new (RSVG_TYPE_HANDLE,
- "dpi-x", 42.0,
- "dpi-y", 43.0,
- NULL);
- double x, y;
-
- g_object_get (handle,
- "dpi-x", &x,
- "dpi-y", &y,
- NULL);
-
- g_assert (x == 42.0);
- g_assert (y == 43.0);
-
- g_object_unref (handle);
-}
-
-static void
-property_base_uri (void)
-{
- RsvgHandle *handle = g_object_new (RSVG_TYPE_HANDLE,
- "base-uri", "file:///foo/bar.svg",
- NULL);
- char *uri;
-
- g_object_get (handle,
- "base-uri", &uri,
- NULL);
-
- g_assert (strcmp (uri, "file:///foo/bar.svg") == 0);
- g_free (uri);
-
- g_object_unref (handle);
-}
-
-static void
-property_dimensions (void)
-{
- char *filename = get_test_filename ("example.svg");
- GError *error = NULL;
-
- RsvgHandle *handle = rsvg_handle_new_from_file (filename, &error);
- g_free (filename);
-
- g_assert (handle != NULL);
- g_assert (error == NULL);
-
- int width;
- int height;
- double em;
- double ex;
-
- g_object_get (handle,
- "width", &width,
- "height", &height,
- "em", &em,
- "ex", &ex,
- NULL);
-
- g_assert_cmpint (width, ==, EXAMPLE_WIDTH);
- g_assert_cmpint (height, ==, EXAMPLE_HEIGHT);
-
- g_assert_cmpfloat (em, ==, (double) EXAMPLE_WIDTH);
- g_assert_cmpfloat (ex, ==, (double) EXAMPLE_HEIGHT);
-
- g_object_unref (handle);
-}
-
-static void
-property_deprecated (void)
-{
- char *filename = get_test_filename ("example.svg");
- GError *error = NULL;
-
- RsvgHandle *handle = rsvg_handle_new_from_file (filename, &error);
- g_free (filename);
-
- g_assert (handle != NULL);
- g_assert (error == NULL);
-
- char *title;
- char *desc;
- char *metadata;
-
- g_object_get (handle,
- "title", &title,
- "desc", &desc,
- "metadata", &metadata,
- NULL);
-
- g_assert (title == NULL);
- g_assert (desc == NULL);
- g_assert (metadata == NULL);
-
- g_object_unref (handle);
-}
-
int
main (int argc, char **argv)
{
@@ -968,11 +845,6 @@ main (int argc, char **argv)
g_test_add_func ("/api/no_write_before_close", no_write_before_close);
g_test_add_func ("/api/empty_write_close", empty_write_close);
g_test_add_func ("/api/cannot_request_external_elements", cannot_request_external_elements);
- g_test_add_func ("/api/property_flags", property_flags);
- g_test_add_func ("/api/property_dpi", property_dpi);
- g_test_add_func ("/api/property_base_uri", property_base_uri);
- g_test_add_func ("/api/property_dimensions", property_dimensions);
- g_test_add_func ("/api/property_deprecated", property_deprecated);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]