Commit a332ca2d authored by RazrFalcon's avatar RazrFalcon

resvg-qt updated.

parent 3b64a2ac
...@@ -42,7 +42,7 @@ pangocairo = { version = "0.6", optional = true } ...@@ -42,7 +42,7 @@ pangocairo = { version = "0.6", optional = true }
# qt backend # qt backend
#resvg-qt = { version = "0.3", optional = true } #resvg-qt = { version = "0.3", optional = true }
resvg-qt = { git = "https://github.com/RazrFalcon/resvg-qt", rev = "0f80423", optional = true } resvg-qt = { git = "https://github.com/RazrFalcon/resvg-qt", rev = "2629e0b", optional = true }
#resvg-qt = { path = "../resvg-qt", optional = true } #resvg-qt = { path = "../resvg-qt", optional = true }
[features] [features]
......
...@@ -299,14 +299,14 @@ pub extern fn resvg_qt_render_to_canvas( ...@@ -299,14 +299,14 @@ pub extern fn resvg_qt_render_to_canvas(
&*tree &*tree
}; };
let painter = unsafe { qt::Painter::from_raw(painter) }; let mut painter = unsafe { qt::Painter::from_raw(painter) };
let size = resvg::ScreenSize::new(size.width, size.height); let size = resvg::ScreenSize::new(size.width, size.height);
let opt = to_native_opt(unsafe { let opt = to_native_opt(unsafe {
assert!(!opt.is_null()); assert!(!opt.is_null());
&*opt &*opt
}); });
resvg::backend_qt::render_to_canvas(&tree.0, &opt, size, &painter); resvg::backend_qt::render_to_canvas(&tree.0, &opt, size, &mut painter);
} }
#[cfg(feature = "cairo-backend")] #[cfg(feature = "cairo-backend")]
...@@ -349,7 +349,7 @@ pub extern fn resvg_qt_render_to_canvas_by_id( ...@@ -349,7 +349,7 @@ pub extern fn resvg_qt_render_to_canvas_by_id(
&*tree &*tree
}; };
let painter = unsafe { qt::Painter::from_raw(painter) }; let mut painter = unsafe { qt::Painter::from_raw(painter) };
let size = resvg::ScreenSize::new(size.width, size.height); let size = resvg::ScreenSize::new(size.width, size.height);
let opt = to_native_opt(unsafe { let opt = to_native_opt(unsafe {
assert!(!opt.is_null()); assert!(!opt.is_null());
...@@ -373,7 +373,7 @@ pub extern fn resvg_qt_render_to_canvas_by_id( ...@@ -373,7 +373,7 @@ pub extern fn resvg_qt_render_to_canvas_by_id(
aspect: usvg::AspectRatio::default(), aspect: usvg::AspectRatio::default(),
}; };
resvg::backend_qt::render_node_to_canvas(&node, &opt, vbox, size, &painter); resvg::backend_qt::render_node_to_canvas(&node, &opt, vbox, size, &mut painter);
} else { } else {
warn!("A node with '{}' ID doesn't have a valid bounding box.", id); warn!("A node with '{}' ID doesn't have a valid bounding box.", id);
} }
......
...@@ -35,7 +35,7 @@ pub fn apply( ...@@ -35,7 +35,7 @@ pub fn apply(
clip_p.apply_transform(&qt::Transform::from_bbox(bbox)); clip_p.apply_transform(&qt::Transform::from_bbox(bbox));
} }
clip_p.set_composition_mode(qt::CompositionMode::CompositionMode_Clear); clip_p.set_composition_mode(qt::CompositionMode::Clear);
let ts = clip_p.get_transform(); let ts = clip_p.get_transform();
for node in node.children() { for node in node.children() {
...@@ -68,7 +68,7 @@ pub fn apply( ...@@ -68,7 +68,7 @@ pub fn apply(
} }
p.set_transform(&qt::Transform::default()); p.set_transform(&qt::Transform::default());
p.set_composition_mode(qt::CompositionMode::CompositionMode_DestinationOut); p.set_composition_mode(qt::CompositionMode::DestinationOut);
p.draw_image(0.0, 0.0, &clip_img); p.draw_image(0.0, 0.0, &clip_img);
} }
...@@ -99,7 +99,7 @@ fn clip_group( ...@@ -99,7 +99,7 @@ fn clip_group(
clip_p.end(); clip_p.end();
p.set_transform(&qt::Transform::default()); p.set_transform(&qt::Transform::default());
p.set_composition_mode(qt::CompositionMode::CompositionMode_Xor); p.set_composition_mode(qt::CompositionMode::Xor);
p.draw_image(0.0, 0.0, &clip_img); p.draw_image(0.0, 0.0, &clip_img);
} }
} }
......
...@@ -42,9 +42,9 @@ fn prepare_base( ...@@ -42,9 +42,9 @@ fn prepare_base(
grad: &mut qt::Gradient, grad: &mut qt::Gradient,
) { ) {
let spread_method = match g.spread_method { let spread_method = match g.spread_method {
usvg::SpreadMethod::Pad => qt::Spread::PadSpread, usvg::SpreadMethod::Pad => qt::Spread::Pad,
usvg::SpreadMethod::Reflect => qt::Spread::ReflectSpread, usvg::SpreadMethod::Reflect => qt::Spread::Reflect,
usvg::SpreadMethod::Repeat => qt::Spread::RepeatSpread, usvg::SpreadMethod::Repeat => qt::Spread::Repeat,
}; };
grad.set_spread(spread_method); grad.set_spread(spread_method);
......
...@@ -54,7 +54,7 @@ fn draw_raster( ...@@ -54,7 +54,7 @@ fn draw_raster(
let new_size = utils::apply_view_box(&view_box, img_size); let new_size = utils::apply_view_box(&view_box, img_size);
let img = try_opt_warn!( let img = try_opt_warn!(
img.resize(new_size.width, new_size.height, qt::AspectRatioMode::IgnoreAspectRatio), (), img.resize(new_size.width, new_size.height, qt::AspectRatioMode::Ignore), (),
"Failed to scale an image.", "Failed to scale an image.",
); );
......
...@@ -45,6 +45,6 @@ pub fn apply( ...@@ -45,6 +45,6 @@ pub fn apply(
mask::image_to_mask(&mut mask_img.data_mut(), layers.image_size(), None); mask::image_to_mask(&mut mask_img.data_mut(), layers.image_size(), None);
sub_p.set_transform(&qt::Transform::default()); sub_p.set_transform(&qt::Transform::default());
sub_p.set_composition_mode(qt::CompositionMode::CompositionMode_DestinationIn); sub_p.set_composition_mode(qt::CompositionMode::DestinationIn);
sub_p.draw_image(0.0, 0.0, &mask_img); sub_p.draw_image(0.0, 0.0, &mask_img);
} }
...@@ -389,13 +389,13 @@ fn from_qt_path(p_path: &qt::PainterPath) -> Vec<usvg::PathSegment> { ...@@ -389,13 +389,13 @@ fn from_qt_path(p_path: &qt::PainterPath) -> Vec<usvg::PathSegment> {
while i < p_path_len { while i < p_path_len {
let (kind, x, y) = p_path.get(i); let (kind, x, y) = p_path.get(i);
match kind { match kind {
qt::PathSegmentType::MoveToSegment => { qt::PathSegmentType::MoveTo => {
segments.push(usvg::PathSegment::MoveTo { x, y }); segments.push(usvg::PathSegment::MoveTo { x, y });
} }
qt::PathSegmentType::LineToSegment => { qt::PathSegmentType::LineTo => {
segments.push(usvg::PathSegment::LineTo { x, y }); segments.push(usvg::PathSegment::LineTo { x, y });
} }
qt::PathSegmentType::CurveToSegment => { qt::PathSegmentType::CurveTo => {
let (_, x1, y1) = p_path.get(i + 1); let (_, x1, y1) = p_path.get(i + 1);
let (_, x2, y2) = p_path.get(i + 2); let (_, x2, y2) = p_path.get(i + 2);
......
...@@ -114,7 +114,7 @@ fn convert_path( ...@@ -114,7 +114,7 @@ fn convert_path(
} }
match rule { match rule {
usvg::FillRule::NonZero => p_path.set_fill_rule(qt::FillRule::WindingFill), usvg::FillRule::NonZero => p_path.set_fill_rule(qt::FillRule::Winding),
usvg::FillRule::EvenOdd => p_path.set_fill_rule(qt::FillRule::OddEvenFill), usvg::FillRule::EvenOdd => p_path.set_fill_rule(qt::FillRule::OddEven),
} }
} }
...@@ -55,16 +55,16 @@ pub fn apply( ...@@ -55,16 +55,16 @@ pub fn apply(
} }
let linecap = match stroke.linecap { let linecap = match stroke.linecap {
usvg::LineCap::Butt => qt::LineCap::FlatCap, usvg::LineCap::Butt => qt::LineCap::Flat,
usvg::LineCap::Round => qt::LineCap::RoundCap, usvg::LineCap::Round => qt::LineCap::Round,
usvg::LineCap::Square => qt::LineCap::SquareCap, usvg::LineCap::Square => qt::LineCap::Square,
}; };
pen.set_line_cap(linecap); pen.set_line_cap(linecap);
let linejoin = match stroke.linejoin { let linejoin = match stroke.linejoin {
usvg::LineJoin::Miter => qt::LineJoin::MiterJoin, usvg::LineJoin::Miter => qt::LineJoin::Miter,
usvg::LineJoin::Round => qt::LineJoin::RoundJoin, usvg::LineJoin::Round => qt::LineJoin::Round,
usvg::LineJoin::Bevel => qt::LineJoin::BevelJoin, usvg::LineJoin::Bevel => qt::LineJoin::Bevel,
}; };
pen.set_line_join(linejoin); pen.set_line_join(linejoin);
......
...@@ -122,9 +122,9 @@ fn init_font(dom_font: &usvg::Font) -> qt::Font { ...@@ -122,9 +122,9 @@ fn init_font(dom_font: &usvg::Font) -> qt::Font {
font.set_family(&dom_font.family); font.set_family(&dom_font.family);
let font_style = match dom_font.style { let font_style = match dom_font.style {
usvg::FontStyle::Normal => qt::FontStyle::StyleNormal, usvg::FontStyle::Normal => qt::FontStyle::Normal,
usvg::FontStyle::Italic => qt::FontStyle::StyleItalic, usvg::FontStyle::Italic => qt::FontStyle::Italic,
usvg::FontStyle::Oblique => qt::FontStyle::StyleOblique, usvg::FontStyle::Oblique => qt::FontStyle::Oblique,
}; };
font.set_style(font_style); font.set_style(font_style);
......
...@@ -22,10 +22,10 @@ fn query_all() { ...@@ -22,10 +22,10 @@ fn query_all() {
rect4,7.182,242.5,133.868,55 rect4,7.182,242.5,133.868,55
rect5,9.584,329.203,70.711,70.711 rect5,9.584,329.203,70.711,70.711
long_text,10.281,441.953,550.594,10.047 long_text,10.281,441.953,550.594,10.047
text1,200.703,23,55.406,22 text1,200.703,23,53.406,22
text2,200.875,102,32.172,28 text2,200.875,102,32.172,28
text3,202.311,178,57.692,22 text3,202.311,178,55.692,22
text4,195.703,243,65.406,32 text4,195.703,243,63.406,32
text5,206.739,306.299,58.393,26.092 text5,206.739,306.299,58.393,26.092
g1,350,20,100,50 g1,350,20,100,50
g2,350,95,120,70 g2,350,95,120,70
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment