Skip to content

Commit

Permalink
Update euclid, use new from_points method.
Browse files Browse the repository at this point in the history
  • Loading branch information
gw3583 committed Dec 12, 2016
1 parent b7b211b commit 9488286
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 43 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion webrender/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion webrender/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion webrender/src/tiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
32 changes: 1 addition & 31 deletions webrender/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<Src, Dst> MatrixHelpers<Src, Dst> for TypedMatrix4D<f32, Src, Dst> {
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 {
Expand All @@ -90,43 +90,13 @@ impl<Src, Dst> MatrixHelpers<Src, Dst> for TypedMatrix4D<f32, Src, Dst> {
}

pub trait RectHelpers<U> where Self: Sized {

fn from_points(a: &TypedPoint2D<f32, U>,
b: &TypedPoint2D<f32, U>,
c: &TypedPoint2D<f32, U>,
d: &TypedPoint2D<f32, U>)
-> 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;
}

impl<U> RectHelpers<U> for TypedRect<f32, U> {

fn from_points(a: &TypedPoint2D<f32, U>,
b: &TypedPoint2D<f32, U>,
c: &TypedPoint2D<f32, U>,
d: &TypedPoint2D<f32, U>) -> 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 &&
Expand Down
2 changes: 1 addition & 1 deletion webrender_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down

0 comments on commit 9488286

Please sign in to comment.