[librsvg] Tidy up cairo imports
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Tidy up cairo imports
- Date: Mon, 6 Jan 2020 09:47:44 +0000 (UTC)
commit 9561d60a9daa74bef222928f007f92421b26b233
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Jan 6 10:09:08 2020 +0100
Tidy up cairo imports
We do not need anymore to `use cairo;` or other crates when we
use the full namespace.
librsvg/c_api.rs | 21 ++++++++---------
librsvg/pixbuf_utils.rs | 11 +++------
librsvg_crate/src/lib.rs | 27 ++++------------------
rsvg_internals/benches/box_blur.rs | 3 ---
rsvg_internals/benches/composite.rs | 3 ---
rsvg_internals/benches/lighting.rs | 5 ----
rsvg_internals/benches/pixel_iterators.rs | 3 ---
rsvg_internals/benches/srgb.rs | 3 ---
rsvg_internals/src/allowed_url.rs | 2 +-
rsvg_internals/src/aspect_ratio.rs | 2 --
rsvg_internals/src/bbox.rs | 2 --
rsvg_internals/src/color.rs | 2 +-
rsvg_internals/src/css.rs | 2 +-
rsvg_internals/src/document.rs | 1 -
rsvg_internals/src/drawing_ctx.rs | 1 -
rsvg_internals/src/error.rs | 4 +---
rsvg_internals/src/filter.rs | 1 -
rsvg_internals/src/filters/color_matrix.rs | 3 +--
rsvg_internals/src/filters/component_transfer.rs | 3 +--
rsvg_internals/src/filters/context.rs | 2 --
rsvg_internals/src/filters/convolve_matrix.rs | 3 +--
rsvg_internals/src/filters/displacement_map.rs | 3 +--
rsvg_internals/src/filters/error.rs | 2 --
rsvg_internals/src/filters/flood.rs | 5 +---
rsvg_internals/src/filters/image.rs | 11 ++++-----
rsvg_internals/src/filters/light/lighting.rs | 4 +---
rsvg_internals/src/filters/merge.rs | 3 +--
rsvg_internals/src/filters/mod.rs | 1 -
rsvg_internals/src/filters/morphology.rs | 3 +--
rsvg_internals/src/filters/offset.rs | 3 +--
rsvg_internals/src/filters/tile.rs | 8 +++----
rsvg_internals/src/filters/turbulence.rs | 3 +--
rsvg_internals/src/gradient.rs | 3 +--
rsvg_internals/src/handle.rs | 10 +++-----
rsvg_internals/src/image.rs | 1 -
rsvg_internals/src/io.rs | 3 +--
rsvg_internals/src/node.rs | 17 +++++++-------
rsvg_internals/src/paint_server.rs | 2 +-
rsvg_internals/src/path_builder.rs | 2 --
rsvg_internals/src/path_parser.rs | 9 ++++----
rsvg_internals/src/pattern.rs | 1 -
rsvg_internals/src/property_defs.rs | 2 +-
rsvg_internals/src/rect.rs | 2 --
rsvg_internals/src/shapes.rs | 1 -
rsvg_internals/src/srgb.rs | 1 -
rsvg_internals/src/surface_utils/iterators.rs | 5 ++--
rsvg_internals/src/surface_utils/mod.rs | 3 +--
rsvg_internals/src/surface_utils/shared_surface.rs | 4 +---
rsvg_internals/src/text.rs | 4 +---
rsvg_internals/src/transform.rs | 4 +---
rsvg_internals/src/xml.rs | 11 ++-------
51 files changed, 67 insertions(+), 168 deletions(-)
---
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index 276ec5ee..9c96e396 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -7,18 +7,13 @@ use std::slice;
use std::sync::Once;
use std::{f64, i32};
-use cairo::{self, ImageSurface};
-use cairo_sys;
use gdk_pixbuf::Pixbuf;
-use gdk_pixbuf_sys;
use glib::error::ErrorDomain;
-use libc;
use url::Url;
use bitflags::bitflags;
use gio::prelude::*;
-use gio_sys;
use glib::object::ObjectClass;
use glib::subclass;
@@ -31,13 +26,12 @@ use glib::{
ToValue, Type, Value,
};
-use glib_sys;
-use gobject_sys::{self, GEnumValue, GFlagsValue};
+use gobject_sys::{GEnumValue, GFlagsValue};
use rsvg_internals::{
- rsvg_log, DefsLookupErrorKind, Dpi, Handle, IntrinsicDimensions,
- LoadOptions, LoadingError, RenderingError, RsvgDimensionData, RsvgLength, RsvgPositionData,
- RsvgSizeFunc, SharedImageSurface, SizeCallback, SurfaceType, ViewBox,
+ rsvg_log, DefsLookupErrorKind, Dpi, Handle, IntrinsicDimensions, LoadOptions, LoadingError,
+ RenderingError, RsvgDimensionData, RsvgLength, RsvgPositionData, RsvgSizeFunc,
+ SharedImageSurface, SizeCallback, SurfaceType, ViewBox,
};
use crate::pixbuf_utils::{empty_pixbuf, pixbuf_from_surface};
@@ -723,8 +717,11 @@ impl CHandle {
return empty_pixbuf();
}
- let surface =
- ImageSurface::create(cairo::Format::ARgb32, dimensions.width, dimensions.height)?;
+ let surface = cairo::ImageSurface::create(
+ cairo::Format::ARgb32,
+ dimensions.width,
+ dimensions.height,
+ )?;
{
let cr = cairo::Context::new(&surface);
diff --git a/librsvg/pixbuf_utils.rs b/librsvg/pixbuf_utils.rs
index 463e103a..a2fae219 100644
--- a/librsvg/pixbuf_utils.rs
+++ b/librsvg/pixbuf_utils.rs
@@ -1,19 +1,14 @@
use std::path::PathBuf;
use std::ptr;
-use cairo::{self, ImageSurface};
use gdk_pixbuf::{Colorspace, Pixbuf};
-use gdk_pixbuf_sys;
-use gio;
use gio::prelude::*;
use glib::translate::*;
-use glib_sys;
-use libc;
use url::Url;
use rsvg_internals::{
- Dpi, Handle, IRect, LoadOptions, LoadingError, Pixels, RenderingError,
- RsvgDimensionData, SharedImageSurface, SizeCallback, SurfaceType,
+ Dpi, Handle, IRect, LoadOptions, LoadingError, Pixels, RenderingError, RsvgDimensionData,
+ SharedImageSurface, SizeCallback, SurfaceType,
};
use crate::c_api::set_gerror;
@@ -136,7 +131,7 @@ fn render_to_pixbuf_at_size(
return empty_pixbuf();
}
- let surface = ImageSurface::create(cairo::Format::ARgb32, width, height)?;
+ let surface = cairo::ImageSurface::create(cairo::Format::ARgb32, width, height)?;
{
let cr = cairo::Context::new(&surface);
diff --git a/librsvg_crate/src/lib.rs b/librsvg_crate/src/lib.rs
index 1514b884..d33cdef1 100644
--- a/librsvg_crate/src/lib.rs
+++ b/librsvg_crate/src/lib.rs
@@ -29,9 +29,6 @@
//! # Example
//!
//! ```
-//! use cairo;
-//! use gio;
-//! use glib;
//!
//! const WIDTH: i32 = 640;
//! const HEIGHT: i32 = 480;
@@ -145,10 +142,8 @@
//! [SVG 2]: https://www.w3.org/TR/SVG2/
#![warn(unused)]
-use cairo;
-use gio;
-use glib::{self, prelude::*};
-use rsvg_internals;
+
+use glib::prelude::*;
use url::Url;
use std::path::Path;
@@ -158,13 +153,8 @@ use gio::{Cancellable, FileExt};
use rsvg_internals::{Dpi, Handle, LoadOptions};
pub use rsvg_internals::{
- DefsLookupErrorKind,
- HrefError,
- Length as InternalLength,
- LengthUnit,
- LoadingError,
- RenderingError,
- RsvgLength as Length,
+ DefsLookupErrorKind, HrefError, Length as InternalLength, LengthUnit, LoadingError,
+ RenderingError, RsvgLength as Length,
};
/// Builder for loading an [`SvgHandle`][SvgHandle].
@@ -249,8 +239,6 @@ impl Loader {
/// ```ignore
/// # // Test is ignored because "make distcheck" breaks, as the output file
/// # // can't be written to the read-only srcdir.
- /// use cairo;
- /// use librsvg;
///
/// let svg_handle = librsvg::Loader::new()
/// .keep_image_data()
@@ -276,8 +264,6 @@ impl Loader {
/// # Example:
///
/// ```
- /// use librsvg;
- ///
/// let svg_handle = librsvg::Loader::new()
/// .read_path("example.svg")
/// .unwrap();
@@ -293,9 +279,6 @@ impl Loader {
///
/// # Example:
/// ```
- /// use gio;
- /// use librsvg;
- ///
/// let svg_handle = librsvg::Loader::new()
/// .read_file(&gio::File::new_for_path("example.svg"), None::<&gio::Cancellable>)
/// .unwrap();
@@ -326,8 +309,6 @@ impl Loader {
///
/// ```
/// use gio::prelude::*;
- /// use gio;
- /// use librsvg;
///
/// let file = gio::File::new_for_path("example.svg");
///
diff --git a/rsvg_internals/benches/box_blur.rs b/rsvg_internals/benches/box_blur.rs
index 2ffc3de5..eddc03fa 100644
--- a/rsvg_internals/benches/box_blur.rs
+++ b/rsvg_internals/benches/box_blur.rs
@@ -2,9 +2,6 @@
extern crate criterion;
use criterion::Criterion;
-use cairo;
-use rsvg_internals;
-
use rsvg_internals::rect::IRect;
use rsvg_internals::surface_utils::shared_surface::{
AlphaOnly,
diff --git a/rsvg_internals/benches/composite.rs b/rsvg_internals/benches/composite.rs
index bdcc581f..52639fc3 100644
--- a/rsvg_internals/benches/composite.rs
+++ b/rsvg_internals/benches/composite.rs
@@ -2,9 +2,6 @@
extern crate criterion;
use criterion::{black_box, Criterion};
-use cairo;
-use rsvg_internals;
-
use rsvg_internals::rect::IRect;
use rsvg_internals::surface_utils::shared_surface::{
composite_arithmetic, SharedImageSurface, SurfaceType,
diff --git a/rsvg_internals/benches/lighting.rs b/rsvg_internals/benches/lighting.rs
index df353a71..0acf4fa3 100644
--- a/rsvg_internals/benches/lighting.rs
+++ b/rsvg_internals/benches/lighting.rs
@@ -1,11 +1,6 @@
#[macro_use]
extern crate criterion;
use criterion::Criterion;
-
-use cairo;
-use nalgebra;
-use rsvg_internals;
-
use nalgebra::{Matrix3, Vector2};
use rsvg_internals::filters::light::{
diff --git a/rsvg_internals/benches/pixel_iterators.rs b/rsvg_internals/benches/pixel_iterators.rs
index b3708173..729e35b5 100644
--- a/rsvg_internals/benches/pixel_iterators.rs
+++ b/rsvg_internals/benches/pixel_iterators.rs
@@ -2,9 +2,6 @@
extern crate criterion;
use criterion::{black_box, Criterion};
-use cairo;
-use rsvg_internals;
-
use rsvg_internals::rect::IRect;
use rsvg_internals::surface_utils::{
iterators::Pixels,
diff --git a/rsvg_internals/benches/srgb.rs b/rsvg_internals/benches/srgb.rs
index ec54b073..326888c0 100644
--- a/rsvg_internals/benches/srgb.rs
+++ b/rsvg_internals/benches/srgb.rs
@@ -2,9 +2,6 @@
extern crate criterion;
use criterion::{black_box, Criterion};
-use cairo;
-use rsvg_internals;
-
use rsvg_internals::rect::IRect;
use rsvg_internals::srgb::{linearize, map_unpremultiplied_components_loop};
use rsvg_internals::surface_utils::{
diff --git a/rsvg_internals/src/allowed_url.rs b/rsvg_internals/src/allowed_url.rs
index 0cae6700..8be10a59 100644
--- a/rsvg_internals/src/allowed_url.rs
+++ b/rsvg_internals/src/allowed_url.rs
@@ -5,7 +5,7 @@ use std::fmt;
use std::io;
use std::ops::Deref;
use std::path::{Path, PathBuf};
-use url::{self, Url};
+use url::Url;
use crate::error::HrefError;
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index eb07d6ca..f51b7a23 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -22,8 +22,6 @@
use std::ops::Deref;
-use cairo;
-
use crate::error::*;
use crate::parsers::Parse;
use crate::rect::Rect;
diff --git a/rsvg_internals/src/bbox.rs b/rsvg_internals/src/bbox.rs
index c62e4011..bb89186c 100644
--- a/rsvg_internals/src/bbox.rs
+++ b/rsvg_internals/src/bbox.rs
@@ -1,7 +1,5 @@
//! Bounding boxes that know their coordinate space.
-use cairo;
-
use crate::rect::{Rect, TransformRect};
#[derive(Debug, Copy, Clone)]
diff --git a/rsvg_internals/src/color.rs b/rsvg_internals/src/color.rs
index b9c8e9f4..4bafbcb6 100644
--- a/rsvg_internals/src/color.rs
+++ b/rsvg_internals/src/color.rs
@@ -1,6 +1,6 @@
//! CSS color values.
-use cssparser::{self, Parser};
+use cssparser::Parser;
use libc;
use crate::error::*;
diff --git a/rsvg_internals/src/css.rs b/rsvg_internals/src/css.rs
index a04fb25d..9cc0bda1 100644
--- a/rsvg_internals/src/css.rs
+++ b/rsvg_internals/src/css.rs
@@ -76,7 +76,7 @@
use cssparser::*;
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use selectors::matching::{ElementSelectorFlags, MatchingContext, MatchingMode, QuirksMode};
-use selectors::{self, OpaqueElement, SelectorImpl, SelectorList};
+use selectors::{OpaqueElement, SelectorImpl, SelectorList};
use std::cmp::Ordering;
use std::fmt;
diff --git a/rsvg_internals/src/document.rs b/rsvg_internals/src/document.rs
index 97bf7d09..db188591 100644
--- a/rsvg_internals/src/document.rs
+++ b/rsvg_internals/src/document.rs
@@ -1,7 +1,6 @@
//! Main SVG document structure.
use gdk_pixbuf::{PixbufLoader, PixbufLoaderExt};
-use gio;
use markup5ever::{LocalName, Namespace, QualName};
use std::cell::RefCell;
use std::collections::hash_map::Entry;
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 377ca997..c3528646 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -1,6 +1,5 @@
//! The main context structure which drives the drawing process.
-use cairo;
use once_cell::sync::Lazy;
use regex::{Captures, Regex};
use std::borrow::Cow;
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 1f01ed5d..9fdf0bd0 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -3,9 +3,7 @@
use std::error::{self, Error};
use std::fmt;
-use cairo;
-use cssparser::{self, BasicParseError, BasicParseErrorKind, ParseErrorKind, ToCss};
-use glib;
+use cssparser::{BasicParseError, BasicParseErrorKind, ParseErrorKind, ToCss};
use markup5ever::QualName;
use crate::allowed_url::Fragment;
diff --git a/rsvg_internals/src/filter.rs b/rsvg_internals/src/filter.rs
index 0b18310b..db80f012 100644
--- a/rsvg_internals/src/filter.rs
+++ b/rsvg_internals/src/filter.rs
@@ -1,6 +1,5 @@
//! The `filter` element.
-use cairo;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::bbox::BoundingBox;
diff --git a/rsvg_internals/src/filters/color_matrix.rs b/rsvg_internals/src/filters/color_matrix.rs
index 8530f9f5..c029e4c1 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -1,4 +1,3 @@
-use cairo::{self, ImageSurface};
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use nalgebra::{Matrix3, Matrix4x5, Matrix5, Vector5};
@@ -170,7 +169,7 @@ impl FilterEffect for FeColorMatrix {
.add_input(&input)
.into_irect(draw_ctx);
- let mut output_surface = ImageSurface::create(
+ let mut output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/component_transfer.rs
b/rsvg_internals/src/filters/component_transfer.rs
index 94ff169f..82a88591 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -1,6 +1,5 @@
use std::cmp::min;
-use cairo::{self, ImageSurface};
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
@@ -285,7 +284,7 @@ impl FilterEffect for FeComponentTransfer {
.into_irect(draw_ctx);
// Create the output surface.
- let mut output_surface = ImageSurface::create(
+ let mut output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/context.rs b/rsvg_internals/src/filters/context.rs
index 0fb27319..2b47806f 100644
--- a/rsvg_internals/src/filters/context.rs
+++ b/rsvg_internals/src/filters/context.rs
@@ -2,8 +2,6 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::f64;
-use cairo;
-
use crate::bbox::BoundingBox;
use crate::coord_units::CoordUnits;
use crate::drawing_ctx::{DrawingCtx, ViewParams};
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index f49d00b6..dff07ec0 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -1,4 +1,3 @@
-use cairo::{self, ImageSurface};
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns, QualName};
use nalgebra::{DMatrix, Dynamic, VecStorage};
@@ -232,7 +231,7 @@ impl FilterEffect for FeConvolveMatrix {
let matrix = self.kernel_matrix.as_ref().unwrap();
- let mut output_surface = ImageSurface::create(
+ let mut output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
input_surface.width(),
input_surface.height(),
diff --git a/rsvg_internals/src/filters/displacement_map.rs b/rsvg_internals/src/filters/displacement_map.rs
index 0cf9725b..e9c734d4 100644
--- a/rsvg_internals/src/filters/displacement_map.rs
+++ b/rsvg_internals/src/filters/displacement_map.rs
@@ -1,4 +1,3 @@
-use cairo::{self, ImageSurface};
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
@@ -91,7 +90,7 @@ impl FilterEffect for FeDisplacementMap {
let (sx, sy) = ctx.paffine().transform_distance(self.scale, self.scale);
- let output_surface = ImageSurface::create(
+ let output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/error.rs b/rsvg_internals/src/filters/error.rs
index 3974b0b9..f70e96b3 100644
--- a/rsvg_internals/src/filters/error.rs
+++ b/rsvg_internals/src/filters/error.rs
@@ -1,8 +1,6 @@
use std::error::Error;
use std::fmt;
-use cairo;
-
/// An enumeration of errors that can occur during filter primitive rendering.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum FilterError {
diff --git a/rsvg_internals/src/filters/flood.rs b/rsvg_internals/src/filters/flood.rs
index 35373830..824c30d8 100644
--- a/rsvg_internals/src/filters/flood.rs
+++ b/rsvg_internals/src/filters/flood.rs
@@ -1,6 +1,3 @@
-use cairo::{self, ImageSurface};
-use cssparser;
-
use crate::drawing_ctx::DrawingCtx;
use crate::node::{CascadedValues, NodeResult, NodeTrait, RsvgNode};
use crate::property_bag::PropertyBag;
@@ -42,7 +39,7 @@ impl FilterEffect for FeFlood {
) -> Result<FilterResult, FilterError> {
let bounds = self.base.get_bounds(ctx).into_irect(draw_ctx);
- let output_surface = ImageSurface::create(
+ let output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index 4f871bca..d43a1694 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -1,4 +1,3 @@
-use cairo::{self, ImageSurface};
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::allowed_url::{Fragment, Href};
@@ -42,13 +41,13 @@ impl FeImage {
draw_ctx: &mut DrawingCtx,
bounds: Rect,
fragment: &Fragment,
- ) -> Result<ImageSurface, FilterError> {
+ ) -> Result<cairo::ImageSurface, FilterError> {
let acquired_drawable = draw_ctx
.acquire_node(fragment, &[])
.map_err(|_| FilterError::InvalidInput)?;
let drawable = acquired_drawable.get();
- let surface = ImageSurface::create(
+ let surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
@@ -78,7 +77,7 @@ impl FeImage {
})?;
// Clip the output to bounds.
- let output_surface = ImageSurface::create(
+ let output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
@@ -102,7 +101,7 @@ impl FeImage {
bounds: &Rect,
unclipped_bounds: &Rect,
href: &Href,
- ) -> Result<ImageSurface, FilterError> {
+ ) -> Result<cairo::ImageSurface, FilterError> {
let surface = if let Href::PlainUrl(ref url) = *href {
// FIXME: translate the error better here
draw_ctx
@@ -112,7 +111,7 @@ impl FeImage {
unreachable!();
};
- let output_surface = ImageSurface::create(
+ let output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/light/lighting.rs b/rsvg_internals/src/filters/light/lighting.rs
index 8dec0f32..82c225c6 100644
--- a/rsvg_internals/src/filters/light/lighting.rs
+++ b/rsvg_internals/src/filters/light/lighting.rs
@@ -1,7 +1,5 @@
use std::cmp::max;
-use cairo::{self, ImageSurface};
-use cssparser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use nalgebra::Vector3;
use num_traits::identities::Zero;
@@ -309,7 +307,7 @@ macro_rules! impl_lighting_filter {
let (ox, oy) = scale.unwrap_or((1.0, 1.0));
- let mut output_surface = ImageSurface::create(
+ let mut output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
input_surface.width(),
input_surface.height(),
diff --git a/rsvg_internals/src/filters/merge.rs b/rsvg_internals/src/filters/merge.rs
index 8b55adf4..82f68534 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -1,4 +1,3 @@
-use cairo::{self, ImageSurface};
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::drawing_ctx::DrawingCtx;
@@ -119,7 +118,7 @@ impl FilterEffect for FeMerge {
let output_surface = match output_surface {
Some(surface) => surface,
None => SharedImageSurface::new(
- ImageSurface::create(
+ cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index ce6b5538..48e34865 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -3,7 +3,6 @@
use std::ops::Deref;
use std::time::Instant;
-use cairo;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::bbox::BoundingBox;
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index df69af05..3fbebbb9 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -1,6 +1,5 @@
use std::cmp::{max, min};
-use cairo::{self, ImageSurface};
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
@@ -96,7 +95,7 @@ impl FilterEffect for FeMorphology {
let rx = rx.abs();
let ry = ry.abs();
- let mut output_surface = ImageSurface::create(
+ let mut output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/offset.rs b/rsvg_internals/src/filters/offset.rs
index 6ef31dc6..69647cf5 100644
--- a/rsvg_internals/src/filters/offset.rs
+++ b/rsvg_internals/src/filters/offset.rs
@@ -1,4 +1,3 @@
-use cairo::{self, ImageSurface};
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::drawing_ctx::DrawingCtx;
@@ -63,7 +62,7 @@ impl FilterEffect for FeOffset {
let (ox, oy) = ctx.paffine().transform_distance(self.dx, self.dy);
- let output_surface = ImageSurface::create(
+ let output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/tile.rs b/rsvg_internals/src/filters/tile.rs
index 41af64a4..11362f46 100644
--- a/rsvg_internals/src/filters/tile.rs
+++ b/rsvg_internals/src/filters/tile.rs
@@ -1,5 +1,3 @@
-use cairo::{self, ImageSurface, Matrix};
-
use crate::drawing_ctx::DrawingCtx;
use crate::node::{NodeResult, NodeTrait, RsvgNode};
use crate::property_bag::PropertyBag;
@@ -50,7 +48,7 @@ impl FilterEffect for FeTile {
bounds: input_bounds,
}) => {
// Create a surface containing just the region to tile.
- let bounded_input_surface = ImageSurface::create(
+ let bounded_input_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
input_bounds.width(),
input_bounds.height(),
@@ -69,11 +67,11 @@ impl FilterEffect for FeTile {
// Make a pattern out of the tile region.
let ptn = cairo::SurfacePattern::create(&bounded_input_surface);
ptn.set_extend(cairo::Extend::Repeat);
- let mut mat = Matrix::identity();
+ let mut mat = cairo::Matrix::identity();
mat.translate(f64::from(-input_bounds.x0), f64::from(-input_bounds.y0));
ptn.set_matrix(mat);
- let output_surface = ImageSurface::create(
+ let output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index c90d5d00..22951ea4 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -1,4 +1,3 @@
-use cairo::{self, ImageSurface};
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
@@ -354,7 +353,7 @@ impl FilterEffect for FeTurbulence {
f64::from(bounds.height()),
);
- let mut output_surface = ImageSurface::create(
+ let mut output_surface = cairo::ImageSurface::create(
cairo::Format::ARgb32,
ctx.source_graphic().width(),
ctx.source_graphic().height(),
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 5b2befcd..deb44195 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -1,7 +1,6 @@
//! Gradient paint servers; the `linearGradient` and `radialGradient` elements.
-use cairo;
-use cssparser::{self, Parser};
+use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use std::cell::RefCell;
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index b7737473..fef3ccdd 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -6,10 +6,6 @@ use std::cell::Cell;
use std::ptr;
use std::rc::Rc;
-use cairo::{self, ImageSurface, Status};
-use gio;
-use glib;
-use libc;
use locale_config::{LanguageRange, Locale};
use crate::allowed_url::{AllowedUrl, Href};
@@ -304,7 +300,7 @@ impl Handle {
dpi: Dpi,
is_testing: bool,
) -> Result<(cairo::Rectangle, cairo::Rectangle), RenderingError> {
- let target = ImageSurface::create(cairo::Format::Rgb24, 1, 1)?;
+ let target = cairo::ImageSurface::create(cairo::Format::Rgb24, 1, 1)?;
let cr = cairo::Context::new(&target);
let mut draw_ctx = DrawingCtx::new(
self.document.clone(),
@@ -489,7 +485,7 @@ impl Handle {
dpi: Dpi,
is_testing: bool,
) -> Result<BoundingBox, RenderingError> {
- let target = ImageSurface::create(cairo::Format::Rgb24, 1, 1)?;
+ let target = cairo::ImageSurface::create(cairo::Format::Rgb24, 1, 1)?;
let cr = cairo::Context::new(&target);
let mut draw_ctx = DrawingCtx::new(
@@ -590,7 +586,7 @@ impl Handle {
fn check_cairo_context(cr: &cairo::Context) -> Result<(), RenderingError> {
let status = cr.status();
- if status == Status::Success {
+ if status == cairo::Status::Success {
Ok(())
} else {
Err(RenderingError::Cairo(status))
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 1dbf3f6a..669a37a8 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -1,6 +1,5 @@
//! The `image` element.
-use cairo;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::allowed_url::Href;
diff --git a/rsvg_internals/src/io.rs b/rsvg_internals/src/io.rs
index a48074e2..c823db58 100644
--- a/rsvg_internals/src/io.rs
+++ b/rsvg_internals/src/io.rs
@@ -3,7 +3,6 @@
use data_url;
use gio::{
- self,
BufferedInputStream,
BufferedInputStreamExt,
Cancellable,
@@ -15,7 +14,7 @@ use gio::{
ZlibCompressorFormat,
ZlibDecompressor,
};
-use glib::{self, Bytes as GBytes, Cast};
+use glib::{Bytes as GBytes, Cast};
use crate::allowed_url::AllowedUrl;
use crate::error::LoadingError;
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index 702fa15a..6dbce7fe 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -12,7 +12,6 @@
//! [`NodeData`]: struct.NodeData.html
//! [`create_node`]: ../create_node/index.html
-use cairo::Matrix;
use downcast_rs::*;
use markup5ever::{expanded_name, local_name, namespace_url, ns, QualName};
use std::cell::Ref;
@@ -51,7 +50,7 @@ pub struct NodeData {
specified_values: SpecifiedValues,
important_styles: HashSet<QualName>,
result: NodeResult,
- transform: Matrix,
+ transform: cairo::Matrix,
values: ComputedValues,
cond: bool,
style_attr: String,
@@ -73,7 +72,7 @@ impl NodeData {
class: class.map(str::to_string),
specified_values: Default::default(),
important_styles: Default::default(),
- transform: Matrix::identity(),
+ transform: cairo::Matrix::identity(),
result: Ok(()),
values: ComputedValues::default(),
cond: true,
@@ -114,7 +113,7 @@ impl NodeData {
self.cond
}
- pub fn get_transform(&self) -> Matrix {
+ pub fn get_transform(&self) -> cairo::Matrix {
self.transform
}
@@ -155,10 +154,12 @@ impl NodeData {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!(svg "transform") => {
- return Matrix::parse_str(value).attribute(attr).and_then(|affine| {
- self.transform = affine;
- Ok(())
- });
+ return cairo::Matrix::parse_str(value)
+ .attribute(attr)
+ .and_then(|affine| {
+ self.transform = affine;
+ Ok(())
+ });
}
_ => (),
}
diff --git a/rsvg_internals/src/paint_server.rs b/rsvg_internals/src/paint_server.rs
index 254b1a77..3bd56946 100644
--- a/rsvg_internals/src/paint_server.rs
+++ b/rsvg_internals/src/paint_server.rs
@@ -1,6 +1,6 @@
//! SVG paint servers.
-use cssparser::{self, Parser};
+use cssparser::Parser;
use crate::allowed_url::Fragment;
use crate::bbox::BoundingBox;
diff --git a/rsvg_internals/src/path_builder.rs b/rsvg_internals/src/path_builder.rs
index ea53f2e4..7129aa87 100644
--- a/rsvg_internals/src/path_builder.rs
+++ b/rsvg_internals/src/path_builder.rs
@@ -1,7 +1,5 @@
//! Representation of Bézier paths.
-use cairo;
-
use std::f64;
use std::f64::consts::*;
diff --git a/rsvg_internals/src/path_parser.rs b/rsvg_internals/src/path_parser.rs
index 5627fdd7..061eb8d1 100644
--- a/rsvg_internals/src/path_parser.rs
+++ b/rsvg_internals/src/path_parser.rs
@@ -1,12 +1,13 @@
//! Parser for SVG path data.
-use crate::path_builder::*;
use std::error::Error;
-use std::fmt::{self, Display, Formatter};
+use std::fmt;
use std::iter::Enumerate;
use std::str;
use std::str::Chars;
+use crate::path_builder::*;
+
struct PathParser<'b> {
chars_enumerator: Enumerate<Chars<'b>>,
lookahead: Option<char>, // None if we are in EOF
@@ -920,8 +921,8 @@ impl Error for ParseError {
}
}
-impl Display for ParseError {
- fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+impl fmt::Display for ParseError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"error at position {}: {}",
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 49420866..a628cd07 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -1,6 +1,5 @@
//! The `pattern` element.
-use cairo;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use std::cell::RefCell;
use std::f64;
diff --git a/rsvg_internals/src/property_defs.rs b/rsvg_internals/src/property_defs.rs
index f72ce3c7..24fee846 100644
--- a/rsvg_internals/src/property_defs.rs
+++ b/rsvg_internals/src/property_defs.rs
@@ -1,6 +1,6 @@
//! Definitions for CSS property types.
-use cssparser::{self, Parser, Token};
+use cssparser::{Parser, Token};
use crate::dasharray::Dasharray;
use crate::error::*;
diff --git a/rsvg_internals/src/rect.rs b/rsvg_internals/src/rect.rs
index c26f77e9..ea6e7675 100644
--- a/rsvg_internals/src/rect.rs
+++ b/rsvg_internals/src/rect.rs
@@ -1,7 +1,5 @@
//! Types for rectangles.
-use cairo;
-
mod rect {
use crate::float_eq_cairo::ApproxEqCairo;
use core::ops::{Add, Range, Sub};
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index bb495696..9cdc0209 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -1,7 +1,6 @@
//! Basic SVG shapes: the `path`, `polygon`, `polyline`, `line`,
//! `rect`, `circle`, `ellipse` elements.
-use cairo;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use std::ops::Deref;
use std::rc::Rc;
diff --git a/rsvg_internals/src/srgb.rs b/rsvg_internals/src/srgb.rs
index 406f485b..8d843aae 100644
--- a/rsvg_internals/src/srgb.rs
+++ b/rsvg_internals/src/srgb.rs
@@ -1,7 +1,6 @@
//! Utility functions for dealing with sRGB colors.
//!
//! The constant values in this module are taken from http://www.color.org/chardata/rgb/srgb.xalter
-use cairo;
use crate::rect::IRect;
use crate::surface_utils::{
diff --git a/rsvg_internals/src/surface_utils/iterators.rs b/rsvg_internals/src/surface_utils/iterators.rs
index 373fe1cf..9cecae10 100644
--- a/rsvg_internals/src/surface_utils/iterators.rs
+++ b/rsvg_internals/src/surface_utils/iterators.rs
@@ -179,7 +179,6 @@ impl<'a> Iterator for PixelRectangle<'a> {
mod tests {
use super::*;
use crate::surface_utils::shared_surface::SurfaceType;
- use cairo::{self, ImageSurface};
#[test]
fn pixels_count() {
@@ -187,7 +186,7 @@ mod tests {
const HEIGHT: i32 = 64;
let surface = SharedImageSurface::new(
- ImageSurface::create(cairo::Format::ARgb32, WIDTH, HEIGHT).unwrap(),
+ cairo::ImageSurface::create(cairo::Format::ARgb32, WIDTH, HEIGHT).unwrap(),
SurfaceType::SRgb,
)
.unwrap();
@@ -230,7 +229,7 @@ mod tests {
const HEIGHT: i32 = 64;
let surface = SharedImageSurface::new(
- ImageSurface::create(cairo::Format::ARgb32, WIDTH, HEIGHT).unwrap(),
+ cairo::ImageSurface::create(cairo::Format::ARgb32, WIDTH, HEIGHT).unwrap(),
SurfaceType::SRgb,
)
.unwrap();
diff --git a/rsvg_internals/src/surface_utils/mod.rs b/rsvg_internals/src/surface_utils/mod.rs
index 69852fda..025fc40f 100644
--- a/rsvg_internals/src/surface_utils/mod.rs
+++ b/rsvg_internals/src/surface_utils/mod.rs
@@ -1,7 +1,6 @@
//! Various utilities for working with Cairo image surfaces.
-use std::ops::DerefMut;
-use cairo;
+use std::ops::DerefMut;
pub mod iterators;
pub mod shared_surface;
diff --git a/rsvg_internals/src/surface_utils/shared_surface.rs
b/rsvg_internals/src/surface_utils/shared_surface.rs
index 0e4aba1f..069b07df 100644
--- a/rsvg_internals/src/surface_utils/shared_surface.rs
+++ b/rsvg_internals/src/surface_utils/shared_surface.rs
@@ -3,12 +3,10 @@ use std::cmp::min;
use std::marker::PhantomData;
use std::ptr::NonNull;
-use cairo::{self, ImageSurface};
-use cairo_sys;
+use cairo::ImageSurface;
use gdk_pixbuf::{Colorspace, Pixbuf};
use glib::translate::{Stash, ToGlibPtr};
use nalgebra::{storage::Storage, Dim, Matrix};
-use rayon;
use crate::rect::IRect;
use crate::srgb;
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 3ad422ea..bf2295c4 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -2,9 +2,7 @@
use glib::translate::*;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
-use pango::{self, FontMapExt};
-use pango_sys;
-use pangocairo;
+use pango::FontMapExt;
use std::cell::RefCell;
use crate::allowed_url::Fragment;
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index e623adb4..ad9d6256 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -1,10 +1,8 @@
//! CSS transform values.
-use cairo;
-
use std::f64::consts::*;
-use cssparser::{self, Parser, Token};
+use cssparser::{Parser, Token};
use crate::error::*;
use crate::parsers::{optional_comma, Parse};
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index c73a47db..0dbc4305 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -1,18 +1,10 @@
//! The main XML parser.
-use crate::xml_rs::{reader::XmlEvent, ParserConfig};
use encoding::label::encoding_from_whatwg_label;
use encoding::DecoderTrap;
use libc;
use markup5ever::{
- expanded_name,
- local_name,
- namespace_url,
- ns,
- ExpandedName,
- LocalName,
- Namespace,
- QualName,
+ expanded_name, local_name, namespace_url, ns, ExpandedName, LocalName, Namespace, QualName,
};
use std::cell::RefCell;
use std::collections::HashMap;
@@ -29,6 +21,7 @@ use crate::property_bag::PropertyBag;
use crate::style::{Style, StyleType};
use crate::text::NodeChars;
use crate::xml2_load::Xml2Parser;
+use crate::xml_rs::{reader::XmlEvent, ParserConfig};
#[derive(Clone)]
enum Context {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]