Skip to content

Commit

Permalink
Bump to 0.42
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Jun 1, 2024
1 parent 2d26672 commit 388b452
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
20 changes: 14 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ oxipng = { version = "9", default-features = false, features = ["filetime", "par
pdf-writer = "0.10"
pdfium-render = "0.8.6"
termcolor = "1.2"
usvg = { git = "https://github.com/RazrFalcon/resvg", default-features = false }
usvg = { version = "0.42.0", default-features = false }
tiny-skia = "0.11.4"
unicode-properties = "0.1.1"
resvg = { git = "https://github.com/RazrFalcon/resvg", default-features = false }
resvg = { version = "0.42.0", default-features = false }
subsetter = "0.1.1"
ttf-parser = { version = "0.21.1" }
siphasher = { version = "1.0.1"}
Expand Down
4 changes: 2 additions & 2 deletions src/render/clip_path.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use pdf_writer::types::MaskType;
use pdf_writer::{Chunk, Content, Filter, Finish, Ref};
use usvg::tiny_skia_path::PathSegment;
use usvg::{ClipPath, FillRule, Group, Node, Transform, Visibility};
use usvg::{ClipPath, FillRule, Group, Node, Transform};

use super::group;
use super::path::draw_path;
Expand Down Expand Up @@ -127,7 +127,7 @@ fn extend_segments_from_group(
for child in group.children() {
match child {
Node::Path(ref path) => {
if path.visibility() != Visibility::Hidden {
if path.is_visible() {
path.data().segments().for_each(|segment| match segment {
PathSegment::MoveTo(mut p) => {
transform.map_point(&mut p);
Expand Down
4 changes: 2 additions & 2 deletions src/render/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::util::resources::ResourceContainer;
use pdf_writer::{Chunk, Content};
use std::sync::Arc;
use tiny_skia::{Size, Transform};
use usvg::{Group, ImageKind, Node, Visibility};
use usvg::{Group, ImageKind, Node};

/// Render a group with filters as an image.
pub fn render(
Expand Down Expand Up @@ -46,7 +46,7 @@ pub fn render(
let encoded_image = pixmap.encode_png().ok()?;

image::render(
Visibility::Visible,
true,
&ImageKind::PNG(Arc::new(encoded_image)),
Some(layer_bbox.to_rect()),
chunk,
Expand Down
6 changes: 3 additions & 3 deletions src/render/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::rc::Rc;
use image::{ColorType, DynamicImage, ImageFormat, Luma, Rgb, Rgba};
use miniz_oxide::deflate::{compress_to_vec_zlib, CompressionLevel};
use pdf_writer::{Chunk, Content, Filter, Finish};
use usvg::{ImageKind, Rect, Size, Transform, Tree, Visibility};
use usvg::{ImageKind, Rect, Size, Transform, Tree};

use crate::render::tree_to_xobject;
use crate::util::context::Context;
Expand All @@ -12,15 +12,15 @@ use crate::util::resources::ResourceContainer;

/// Render an image into a content stream.
pub fn render(
visibility: Visibility,
is_visible: bool,
kind: &ImageKind,
view_box: Option<Rect>,
chunk: &mut Chunk,
content: &mut Content,
ctx: &mut Context,
rc: &mut ResourceContainer,
) {
if visibility != Visibility::Visible {
if !is_visible {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl Render for Node {
}
#[cfg(feature = "image")]
Node::Image(ref image) => image::render(
image.visibility(),
image.is_visible(),
image.kind(),
None,
chunk,
Expand Down
4 changes: 2 additions & 2 deletions src/render/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use pdf_writer::types::ColorSpaceOperand::Pattern;
use pdf_writer::{Chunk, Content, Finish};
use usvg::tiny_skia_path::PathSegment;
use usvg::{Fill, FillRule, Opacity, Paint, PaintOrder, Rect};
use usvg::{Path, Visibility};
use usvg::Path;
use usvg::{Stroke, Transform};

use super::{gradient, pattern};
Expand All @@ -20,7 +20,7 @@ pub fn render(
rc: &mut ResourceContainer,
accumulated_transform: Transform,
) {
if path.visibility() != Visibility::Visible {
if !path.is_visible() {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/render/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::hash::Hash;
use std::sync::Arc;
use ttf_parser::{name_id, Face, GlyphId, PlatformId, Tag};
use unicode_properties::{GeneralCategory, UnicodeGeneralCategory};
use usvg::{Fill, Group, ImageKind, Node, PaintOrder, Stroke, Transform, Visibility};
use usvg::{Fill, Group, ImageKind, Node, PaintOrder, Stroke, Transform};

const CFF: Tag = Tag::from_bytes(b"CFF ");
const CFF2: Tag = Tag::from_bytes(b"CFF2");
Expand Down Expand Up @@ -233,7 +233,7 @@ pub fn render(
}

for span in text.layouted() {
if span.visibility != Visibility::Visible {
if !span.visible {
continue;
}

Expand Down

0 comments on commit 388b452

Please sign in to comment.