Skip to content

Commit

Permalink
Auto merge of #487 - floppyhammer:fix_android_demo, r=jdm
Browse files Browse the repository at this point in the history
Make the demo compile with NDK

Solving #472. Upgrade `usvg` to `0.20.0`, which removes `harfbuzz_rs` dependency.
  • Loading branch information
bors-servo authored Mar 28, 2022
2 parents caee8cf + 9c1f48a commit db0dfee
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ font-kit = "0.6"
foreign-types = "0.3"
gl = "0.14"
libc = "0.2"
usvg = "0.9"
usvg = "0.20.0"

[dependencies.pathfinder_canvas]
features = ["pf-text"]
Expand Down
3 changes: 3 additions & 0 deletions demo/android/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ path = "../../../gl"

[dependencies.pathfinder_gpu]
path = "../../../gpu"

[dependencies.pathfinder_resources]
path = "../../../resources"
8 changes: 4 additions & 4 deletions demo/android/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ extern crate lazy_static;

use jni::objects::{GlobalRef, JByteBuffer, JClass, JObject, JString, JValue};
use jni::{JNIEnv, JavaVM};
use pathfinder_demo::window::{Event, SVGPath, View, Window, WindowSize};
use pathfinder_demo::window::{Event, DataPath, View, Window, WindowSize};
use pathfinder_demo::DemoApp;
use pathfinder_demo::Options;
use pathfinder_geometry::vector::{Vector2I, vec2i};
use pathfinder_geometry::rect::RectI;
use pathfinder_gl::GLVersion;
use pathfinder_gl::{GLVersion, GLDevice};
use pathfinder_resources::ResourceLoader;
use std::cell::RefCell;
use std::io::Error as IOError;
Expand Down Expand Up @@ -175,7 +175,7 @@ pub unsafe extern "system" fn Java_graphics_pathfinder_pathfinderdemo_Pathfinder
EVENT_QUEUE
.lock()
.unwrap()
.push(Event::OpenSVG(SVGPath::Resource(string)))
.push(Event::OpenData(DataPath::Resource(string)))
}

struct WindowImpl {
Expand All @@ -202,7 +202,7 @@ impl Window for WindowImpl {

fn make_current(&mut self, _view: View) {}

fn present(&mut self) {}
fn present(&mut self, device: &mut GLDevice) {}

fn resource_loader(&self) -> &dyn ResourceLoader {
&RESOURCE_LOADER
Expand Down
2 changes: 1 addition & 1 deletion demo/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pf-gl = []
clap = "2.32"
gl = "0.14"
rayon = "1.0"
usvg = "0.9"
usvg = "0.20.0"

[dependencies.image]
version = "0.23"
Expand Down
2 changes: 1 addition & 1 deletion demo/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ fn load_scene(resource_loader: &dyn ResourceLoader,
DataPath::Path(ref path) => std::fs::read(path).unwrap().into()
};

if let Ok(tree) = SvgTree::from_data(&data, &UsvgOptions::default()) {
if let Ok(tree) = SvgTree::from_data(&data, &UsvgOptions::default().to_ref()) {
Content::Svg(tree)
} else if let Ok(file) = PdfFile::from_data(data) {
Content::Pdf { file, cache: PdfRenderCache::new(), page_nr: 0 }
Expand Down
2 changes: 1 addition & 1 deletion demo/magicleap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = ["Alan Jeffrey <[email protected]>"]
[dependencies]
gl = "0.14"
rayon = "1.0"
usvg = "0.9"
usvg = "0.20.0"
egl = "0.2"
log = "0.4"
smallvec = "1.2"
Expand Down
2 changes: 1 addition & 1 deletion svg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ keywords = ["pathfinder", "svg", "vector", "graphics", "gpu"]
[dependencies]
bitflags = "1.0"
hashbrown = "0.7"
usvg = "0.9"
usvg = "0.20.0"

[dependencies.pathfinder_color]
path = "../color"
Expand Down
2 changes: 1 addition & 1 deletion svg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl SVGScene {
state.transform = state.transform * node_transform;
match *node.borrow() {
NodeKind::Group(ref group) => {
if group.filter.is_some() {
if !group.filter.is_empty() {
self.result_flags.insert(BuildResultFlags::UNSUPPORTED_FILTER_ATTR);
}
if group.mask.is_some() {
Expand Down
2 changes: 1 addition & 1 deletion utils/convert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ edition = "2018"
[dependencies]
pathfinder_export = { path = "../../export" }
pathfinder_svg = { path = "../../svg" }
usvg = "0.9"
usvg = "0.20.0"
2 changes: 1 addition & 1 deletion utils/svg-to-skia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["Patrick Walton <[email protected]>"]
edition = "2018"

[dependencies]
usvg = "0.9"
usvg = "0.20.0"

0 comments on commit db0dfee

Please sign in to comment.