Skip to content

Commit b2e02df

Browse files
author
bors-servo
authored
Auto merge of servo#630 - glennw:euclid-from-points, r=kvark
Update euclid, use new from_points method. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/630) <!-- Reviewable:end -->
2 parents 74a80ab + 9488286 commit b2e02df

File tree

6 files changed

+12
-43
lines changed

6 files changed

+12
-43
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webrender/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ app_units = "0.3"
1818
bincode = "0.6"
1919
bit-set = "0.4"
2020
byteorder = "0.5"
21-
euclid = "0.10"
21+
euclid = "0.10.3"
2222
fnv="1.0"
2323
gleam = "0.2.25"
2424
lazy_static = "0.2"

webrender/src/frame.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use scene::Scene;
1616
use std::collections::{HashMap, HashSet};
1717
use std::hash::BuildHasherDefault;
1818
use tiling::{AuxiliaryListsMap, FrameBuilder, FrameBuilderConfig, LayerMap, PrimitiveFlags};
19-
use util::MatrixHelpers;
2019
use webrender_traits::{AuxiliaryLists, PipelineId, Epoch, ScrollPolicy, ScrollLayerId};
2120
use webrender_traits::{ClipRegion, ColorF, DisplayItem, StackingContext, FilterOp, MixBlendMode};
2221
use webrender_traits::{ScrollEventPhase, ScrollLayerInfo, ScrollLocation, SpecificDisplayItem, ScrollLayerState};

webrender/src/tiling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use std::hash::{BuildHasherDefault};
3030
use std::sync::atomic::{AtomicUsize, Ordering};
3131
use std::usize;
3232
use texture_cache::TexturePage;
33-
use util::{self, rect_from_points, MatrixHelpers, rect_from_points_f};
33+
use util::{self, rect_from_points, rect_from_points_f};
3434
use util::{TransformedRect, TransformedRectKind, subtract_rect, pack_as_float};
3535
use webrender_traits::{ColorF, FontKey, ImageKey, ImageRendering, MixBlendMode};
3636
use webrender_traits::{BorderDisplayItem, BorderSide, BorderStyle, YuvColorSpace};

webrender/src/util.rs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<Src, Dst> MatrixHelpers<Src, Dst> for TypedMatrix4D<f32, Src, Dst> {
6464
let top_right = self.transform_point(&rect.top_right());
6565
let bottom_left = self.transform_point(&rect.bottom_left());
6666
let bottom_right = self.transform_point(&rect.bottom_right());
67-
TypedRect::from_points(&top_left, &top_right, &bottom_right, &bottom_left)
67+
TypedRect::from_points(&[top_left, top_right, bottom_right, bottom_left])
6868
}
6969

7070
fn can_losslessly_transform_a_2d_rect(&self) -> bool {
@@ -90,43 +90,13 @@ impl<Src, Dst> MatrixHelpers<Src, Dst> for TypedMatrix4D<f32, Src, Dst> {
9090
}
9191

9292
pub trait RectHelpers<U> where Self: Sized {
93-
94-
fn from_points(a: &TypedPoint2D<f32, U>,
95-
b: &TypedPoint2D<f32, U>,
96-
c: &TypedPoint2D<f32, U>,
97-
d: &TypedPoint2D<f32, U>)
98-
-> Self;
9993
fn contains_rect(&self, other: &Self) -> bool;
10094
fn from_floats(x0: f32, y0: f32, x1: f32, y1: f32) -> Self;
10195
fn is_well_formed_and_nonempty(&self) -> bool;
10296
}
10397

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

106-
fn from_points(a: &TypedPoint2D<f32, U>,
107-
b: &TypedPoint2D<f32, U>,
108-
c: &TypedPoint2D<f32, U>,
109-
d: &TypedPoint2D<f32, U>) -> Self {
110-
let (mut min_x, mut min_y) = (a.x, a.y);
111-
let (mut max_x, mut max_y) = (min_x, min_y);
112-
for point in &[b, c, d] {
113-
if point.x < min_x {
114-
min_x = point.x
115-
}
116-
if point.x > max_x {
117-
max_x = point.x
118-
}
119-
if point.y < min_y {
120-
min_y = point.y
121-
}
122-
if point.y > max_y {
123-
max_y = point.y
124-
}
125-
}
126-
TypedRect::new(TypedPoint2D::new(min_x, min_y),
127-
TypedSize2D::new(max_x - min_x, max_y - min_y))
128-
}
129-
130100
fn contains_rect(&self, other: &Self) -> bool {
131101
self.origin.x <= other.origin.x &&
132102
self.origin.y <= other.origin.y &&

webrender_traits/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ipc = ["ipc-channel"]
1616
[dependencies]
1717
app_units = "0.3.0"
1818
byteorder = "0.5"
19-
euclid = "0.10"
19+
euclid = "0.10.3"
2020
gleam = "0.2"
2121
heapsize = "0.3.6"
2222
offscreen_gl_context = {version = "0.5.0", features = ["serde_serialization"]}

0 commit comments

Comments
 (0)