From 8d01aba2376050077968679485109359683e491a Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Tue, 12 May 2020 08:26:48 -0700 Subject: [PATCH] Update to piet 0.13 Get rid of kurbo patch, as we now use kurbo through piet. Also clean up some warnings. --- Cargo.lock | 10 +++++----- Cargo.toml | 4 ---- piet-gpu-hal/src/vulkan.rs | 7 ++++--- piet-gpu/Cargo.toml | 3 +-- piet-gpu/bin/cli.rs | 3 --- piet-gpu/src/lib.rs | 1 - piet-gpu/src/pico_svg.rs | 4 ++-- piet-gpu/src/render_ctx.rs | 6 +++--- 8 files changed, 15 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a3e77350..4a0a133b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -295,8 +295,9 @@ dependencies = [ [[package]] name = "kurbo" -version = "0.5.11" -source = "git+https://github.com/linebender/kurbo?rev=7bd7e66bd137e757305d170a0f9f2b4f7beeb299#7bd7e66bd137e757305d170a0f9f2b4f7beeb299" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5657aca5a36917d389d717f1a0c24d5ebcee5551fda8c1f555af597565d408e4" dependencies = [ "arrayvec", ] @@ -513,9 +514,9 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "piet" -version = "0.0.12" +version = "0.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29420eccb68d6b9ad2f8dd87caf9c3bcd3bbd056bfe67871c48b6efab9316b79" +checksum = "552531e1eeb85c966172849155b25b555f76c10cc479396579fac058a63269a4" dependencies = [ "kurbo", ] @@ -524,7 +525,6 @@ dependencies = [ name = "piet-gpu" version = "0.1.0" dependencies = [ - "kurbo", "piet", "piet-gpu-hal", "piet-gpu-types", diff --git a/Cargo.toml b/Cargo.toml index efa5f887..f71f2dea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,3 @@ members = [ "piet-gpu-hal", "piet-gpu-types" ] - -# TODO: remove when the flatten feature is published -[patch.crates-io] -kurbo = { git = "https://github.com/linebender/kurbo", rev = "7bd7e66bd137e757305d170a0f9f2b4f7beeb299" } diff --git a/piet-gpu-hal/src/vulkan.rs b/piet-gpu-hal/src/vulkan.rs index ff4587ef..2fac0158 100644 --- a/piet-gpu-hal/src/vulkan.rs +++ b/piet-gpu-hal/src/vulkan.rs @@ -62,7 +62,8 @@ pub struct Buffer { pub struct Image { image: vk::Image, - image_memory: vk::DeviceMemory, + // Not used now but probably will be for destruction. + _image_memory: vk::DeviceMemory, image_view: vk::ImageView, extent: vk::Extent3D, } @@ -475,7 +476,7 @@ impl crate::Device for VkDevice { )?; Ok(Image { image, - image_memory, + _image_memory: image_memory, image_view, extent, }) @@ -984,7 +985,7 @@ impl VkSwapchain { pub unsafe fn image(&self, idx: usize) -> Image { Image { image: self.images[idx], - image_memory: vk::DeviceMemory::null(), + _image_memory: vk::DeviceMemory::null(), image_view: vk::ImageView::null(), extent: vk::Extent3D { width: self.extent.width, diff --git a/piet-gpu/Cargo.toml b/piet-gpu/Cargo.toml index a922a46f..6bdf1782 100644 --- a/piet-gpu/Cargo.toml +++ b/piet-gpu/Cargo.toml @@ -21,8 +21,7 @@ path = "../piet-gpu-hal" path = "../piet-gpu-types" [dependencies] -kurbo = "0.5.11" -piet = "0.0.12" +piet = "0.0.13" png = "0.16.2" rand = "0.7.3" roxmltree = "0.11" diff --git a/piet-gpu/bin/cli.rs b/piet-gpu/bin/cli.rs index 1a3c37ab..839c262d 100644 --- a/piet-gpu/bin/cli.rs +++ b/piet-gpu/bin/cli.rs @@ -2,9 +2,6 @@ use std::fs::File; use std::io::BufWriter; use std::path::Path; - -use piet::Color; - use piet_gpu_hal::vulkan::VkInstance; use piet_gpu_hal::{CmdBuf, Device, Error, MemFlags}; diff --git a/piet-gpu/src/lib.rs b/piet-gpu/src/lib.rs index 2adbfc1a..a47737aa 100644 --- a/piet-gpu/src/lib.rs +++ b/piet-gpu/src/lib.rs @@ -8,7 +8,6 @@ use rand::{Rng, RngCore}; use piet::kurbo::{BezPath, Circle, Line, Point, Vec2}; use piet::{Color, RenderContext}; -use piet_gpu_hal::vulkan::VkInstance; use piet_gpu_hal::{CmdBuf, Device, Error, ImageLayout, MemFlags}; use pico_svg::PicoSvg; diff --git a/piet-gpu/src/pico_svg.rs b/piet-gpu/src/pico_svg.rs index 2423ddaa..a4c92d00 100644 --- a/piet-gpu/src/pico_svg.rs +++ b/piet-gpu/src/pico_svg.rs @@ -4,7 +4,7 @@ use std::str::FromStr; use roxmltree::Document; -use kurbo::BezPath; +use piet::kurbo::{Affine, BezPath}; use piet::{Color, RenderContext}; @@ -38,7 +38,7 @@ impl PicoSvg { if el.is_element() { let d = el.attribute("d").ok_or("missing 'd' attribute")?; let bp = BezPath::from_svg(d)?; - let path = kurbo::Affine::scale(scale) * bp; + let path = Affine::scale(scale) * bp; if let Some(fill_color) = el.attribute("fill") { let color = parse_color(fill_color); items.push(Item::Fill(FillItem { color, path: path.clone() })); diff --git a/piet-gpu/src/render_ctx.rs b/piet-gpu/src/render_ctx.rs index c08aca99..63673016 100644 --- a/piet-gpu/src/render_ctx.rs +++ b/piet-gpu/src/render_ctx.rs @@ -248,7 +248,7 @@ fn flatten_shape( let mut points = Vec::new(); let mut start_pt = None; let mut last_pt = None; - kurbo::flatten(path, TOLERANCE, |el| { + piet::kurbo::flatten(path, TOLERANCE, |el| { match el { PathEl::MoveTo(p) => { let scene_pt = to_scene_point(p); @@ -296,7 +296,7 @@ impl Text for PietGpuText { &mut self, _font: &Self::Font, _text: &str, - _width: f64, + _width: impl Into>, ) -> Self::TextLayoutBuilder { unimplemented!(); } @@ -325,7 +325,7 @@ impl TextLayout for PietGpuTextLayout { 0.0 } - fn update_width(&mut self, _new_width: f64) -> Result<(), Error> { + fn update_width(&mut self, _new_width: impl Into>) -> Result<(), Error> { unimplemented!() }