[librsvg: 15/22] load_image_to_surface(): Take a LoadOptions, not a handle
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 15/22] load_image_to_surface(): Take a LoadOptions, not a handle
- Date: Tue, 8 Jan 2019 17:54:28 +0000 (UTC)
commit 9dc8e569a05b432fb31148dfd1dc0f451f842785
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Jan 7 21:31:17 2019 -0600
load_image_to_surface(): Take a LoadOptions, not a handle
rsvg_internals/src/filters/image.rs | 5 +++--
rsvg_internals/src/handle.rs | 8 +++-----
rsvg_internals/src/image.rs | 10 +++++++---
3 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index 771e7dc7..49cfded6 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -131,8 +131,9 @@ impl Image {
};
// FIXME: translate the error better here
- let surface = handle::load_image_to_surface(self.handle.get() as *mut _, &url)
- .map_err(|_| FilterError::InvalidInput)?;
+ let surface =
+ handle::load_image_to_surface(&handle::get_load_options(self.handle.get()), &url)
+ .map_err(|_| FilterError::InvalidInput)?;
let output_surface = ImageSurface::create(
cairo::Format::ARgb32,
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index f2936c87..c0c650fd 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -606,12 +606,10 @@ pub struct BinaryData {
}
pub fn load_image_to_surface(
- handle: *mut RsvgHandle,
+ load_options: &LoadOptions,
url: &str,
) -> Result<ImageSurface, LoadingError> {
- let rhandle = get_rust_handle(handle);
-
- let aurl = AllowedUrl::from_href(url, get_base_url(handle).as_ref())
+ let aurl = AllowedUrl::from_href(url, load_options.base_url.as_ref())
.map_err(|_| LoadingError::BadUrl)?;
let data = io::acquire_data(&aurl, None)?;
@@ -633,7 +631,7 @@ pub fn load_image_to_surface(
let surface = SharedImageSurface::from_pixbuf(&pixbuf)?.into_image_surface()?;
- if rhandle.load_flags.get().keep_image_data {
+ if load_options.flags.keep_image_data {
if let Some(mime_type) = data.content_type {
extern "C" {
fn cairo_surface_set_mime_data(
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 1da786e5..9db4f856 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -79,9 +79,13 @@ impl NodeTrait for NodeImage {
*self.surface.borrow_mut() = Some(
// FIXME: translate the error better here
- handle::load_image_to_surface(handle as *mut _, &url).map_err(|e| {
- NodeError::value_error(attr, &format!("could not load image: {}", e))
- })?,
+ handle::load_image_to_surface(&handle::get_load_options(handle), &url)
+ .map_err(|e| {
+ NodeError::value_error(
+ attr,
+ &format!("could not load image: {}", e),
+ )
+ })?,
);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]