From 9488286d1bd5307e1d907d206114d9c42425040d Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Tue, 13 Dec 2016 09:44:52 +1000 Subject: [PATCH] Update euclid, use new from_points method. --- Cargo.lock | 16 ++++++++-------- webrender/Cargo.toml | 2 +- webrender/src/frame.rs | 1 - webrender/src/tiling.rs | 2 +- webrender/src/util.rs | 32 +------------------------------- webrender_traits/Cargo.toml | 2 +- 6 files changed, 12 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4a474511f..2c4f7c1f5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ dependencies = [ "clap 2.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", "font-loader 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -237,7 +237,7 @@ dependencies = [ [[package]] name = "euclid" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -587,7 +587,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1013,7 +1013,7 @@ dependencies = [ "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1034,7 +1034,7 @@ dependencies = [ "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1060,7 +1060,7 @@ version = "0.1.0" dependencies = [ "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "webrender 0.11.0", @@ -1072,7 +1072,7 @@ name = "wr-sample" version = "0.1.0" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "webrender 0.11.0", @@ -1143,7 +1143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07c4c7cc7b396419bc0a4d90371d0cee16cb5053b53647d287c0b728000c41fe" "checksum dwrote 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "caec6baccdd686cb9b7aac3775bb08bab9f732584d74f3a6c0071be60d250deb" "checksum enum_primitive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f79eff5be92a4d7d5bddf7daa7d650717ea71628634efe6ca7bcda85b2183c23" -"checksum euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "44ef2a3e4a621518e488db36820a12b49a9d5004764b8daf1458bbe5d7c9b626" +"checksum euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0c274f13773ec277a48408d0c7a8dc935ad4bfe190f4cfccd0126d203afc3c83" "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" "checksum font-loader 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0658a43445357800293fd652716dde29bd38f63f59a45c515d6aee176827e16c" diff --git a/webrender/Cargo.toml b/webrender/Cargo.toml index 83ccc26724..f44be61a88 100644 --- a/webrender/Cargo.toml +++ b/webrender/Cargo.toml @@ -18,7 +18,7 @@ app_units = "0.3" bincode = "0.6" bit-set = "0.4" byteorder = "0.5" -euclid = "0.10" +euclid = "0.10.3" fnv="1.0" gleam = "0.2.25" lazy_static = "0.2" diff --git a/webrender/src/frame.rs b/webrender/src/frame.rs index 2cc4977a0a..f557a64bf1 100644 --- a/webrender/src/frame.rs +++ b/webrender/src/frame.rs @@ -16,7 +16,6 @@ use scene::Scene; use std::collections::{HashMap, HashSet}; use std::hash::BuildHasherDefault; use tiling::{AuxiliaryListsMap, FrameBuilder, FrameBuilderConfig, LayerMap, PrimitiveFlags}; -use util::MatrixHelpers; use webrender_traits::{AuxiliaryLists, PipelineId, Epoch, ScrollPolicy, ScrollLayerId}; use webrender_traits::{ClipRegion, ColorF, DisplayItem, StackingContext, FilterOp, MixBlendMode}; use webrender_traits::{ScrollEventPhase, ScrollLayerInfo, ScrollLocation, SpecificDisplayItem, ScrollLayerState}; diff --git a/webrender/src/tiling.rs b/webrender/src/tiling.rs index 15bc0156a0..5a0dcf87f3 100644 --- a/webrender/src/tiling.rs +++ b/webrender/src/tiling.rs @@ -30,7 +30,7 @@ use std::hash::{BuildHasherDefault}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::usize; use texture_cache::TexturePage; -use util::{self, rect_from_points, MatrixHelpers, rect_from_points_f}; +use util::{self, rect_from_points, rect_from_points_f}; use util::{TransformedRect, TransformedRectKind, subtract_rect, pack_as_float}; use webrender_traits::{ColorF, FontKey, ImageKey, ImageRendering, MixBlendMode}; use webrender_traits::{BorderDisplayItem, BorderSide, BorderStyle, YuvColorSpace}; diff --git a/webrender/src/util.rs b/webrender/src/util.rs index a3ef0810e4..b7b7316431 100644 --- a/webrender/src/util.rs +++ b/webrender/src/util.rs @@ -64,7 +64,7 @@ impl MatrixHelpers for TypedMatrix4D { let top_right = self.transform_point(&rect.top_right()); let bottom_left = self.transform_point(&rect.bottom_left()); let bottom_right = self.transform_point(&rect.bottom_right()); - TypedRect::from_points(&top_left, &top_right, &bottom_right, &bottom_left) + TypedRect::from_points(&[top_left, top_right, bottom_right, bottom_left]) } fn can_losslessly_transform_a_2d_rect(&self) -> bool { @@ -90,12 +90,6 @@ impl MatrixHelpers for TypedMatrix4D { } pub trait RectHelpers where Self: Sized { - - fn from_points(a: &TypedPoint2D, - b: &TypedPoint2D, - c: &TypedPoint2D, - d: &TypedPoint2D) - -> Self; fn contains_rect(&self, other: &Self) -> bool; fn from_floats(x0: f32, y0: f32, x1: f32, y1: f32) -> Self; fn is_well_formed_and_nonempty(&self) -> bool; @@ -103,30 +97,6 @@ pub trait RectHelpers where Self: Sized { impl RectHelpers for TypedRect { - fn from_points(a: &TypedPoint2D, - b: &TypedPoint2D, - c: &TypedPoint2D, - d: &TypedPoint2D) -> Self { - let (mut min_x, mut min_y) = (a.x, a.y); - let (mut max_x, mut max_y) = (min_x, min_y); - for point in &[b, c, d] { - if point.x < min_x { - min_x = point.x - } - if point.x > max_x { - max_x = point.x - } - if point.y < min_y { - min_y = point.y - } - if point.y > max_y { - max_y = point.y - } - } - TypedRect::new(TypedPoint2D::new(min_x, min_y), - TypedSize2D::new(max_x - min_x, max_y - min_y)) - } - fn contains_rect(&self, other: &Self) -> bool { self.origin.x <= other.origin.x && self.origin.y <= other.origin.y && diff --git a/webrender_traits/Cargo.toml b/webrender_traits/Cargo.toml index 74bcc7447a..83b4fceda1 100644 --- a/webrender_traits/Cargo.toml +++ b/webrender_traits/Cargo.toml @@ -16,7 +16,7 @@ ipc = ["ipc-channel"] [dependencies] app_units = "0.3.0" byteorder = "0.5" -euclid = "0.10" +euclid = "0.10.3" gleam = "0.2" heapsize = "0.3.6" offscreen_gl_context = {version = "0.5.0", features = ["serde_serialization"]}