Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin dependencies and remove dependance on a nightly feature #212

Merged
merged 2 commits into from Mar 1, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

No more slice patterns

  • Loading branch information
Manishearth committed Mar 1, 2016
commit 63c08eeb5142eb4dc3f618a462842c0d6325740e
@@ -1215,7 +1215,7 @@ impl<'a> BatchBuilder<'a> {
match border_style {
BorderStyle::Ridge | BorderStyle::Groove => {
let corner_center = util::rect_center(corner_bounds);
let [outer_corner_rect, inner_corner_rect, color1_rect, color0_rect] =
let (outer_corner_rect, inner_corner_rect, color1_rect, color0_rect) =
subdivide_border_corner(corner_bounds, &corner_center, rotation_angle);

let (tl_color, br_color) = groove_ridge_border_colors(color0, border_style);
@@ -1392,7 +1392,7 @@ impl<'a> BatchBuilder<'a> {
// TODO: Check for zero width/height borders!
// FIXME(pcwalton): It's kind of messy to be matching on the rotation angle here to pick
// the right rect to draw the rounded corner in. Is there a more elegant way to do this?
let [outer_corner_rect, inner_corner_rect, color0_rect, color1_rect] =
let (outer_corner_rect, inner_corner_rect, color0_rect, color1_rect) =
subdivide_border_corner(corner_bounds, radius_extent, rotation_angle);

let dummy_mask_image = resource_cache.get_dummy_mask_image();
@@ -1916,13 +1916,13 @@ fn groove_ridge_border_colors(color: &ColorF, border_style: BorderStyle) -> (Col
fn subdivide_border_corner(corner_bounds: &Rect<f32>,
point: &Point2D<f32>,
rotation_angle: BasicRotationAngle)
-> [Rect<f32>; 4] {
let [tl, tr, br, bl] = util::subdivide_rect_into_quadrants(corner_bounds, point);
-> (Rect<f32>, Rect<f32>, Rect<f32>, Rect<f32>) {
let (tl, tr, br, bl) = util::subdivide_rect_into_quadrants(corner_bounds, point);
match rotation_angle {
BasicRotationAngle::Upright => [tl, br, bl, tr],
BasicRotationAngle::Clockwise90 => [tr, bl, tl, br],
BasicRotationAngle::Clockwise180 => [br, tl, tr, bl],
BasicRotationAngle::Clockwise270 => [bl, tr, br, tl],
BasicRotationAngle::Upright => (tl, br, bl, tr),
BasicRotationAngle::Clockwise90 => (tr, bl, tl, br),
BasicRotationAngle::Clockwise180 => (br, tl, tr, bl),
BasicRotationAngle::Clockwise270 => (bl, tr, br, tl),
}
}

@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#![feature(slice_patterns, step_by, zero_one)]
#![feature(step_by, zero_one)]
//#![feature(mpsc_select)]

#[macro_use]
@@ -178,7 +178,7 @@ pub fn scale_color(color: &ColorF, factor: f32) -> ColorF {

/// Subdivides a rectangle into quadrants formed by a point. The quadrants are returned in the
/// order of: top left, top right, bottom right, and bottom left.
pub fn subdivide_rect_into_quadrants(rect: &Rect<f32>, point: &Point2D<f32>) -> [Rect<f32>; 4] {
pub fn subdivide_rect_into_quadrants(rect: &Rect<f32>, point: &Point2D<f32>) -> (Rect<f32>, Rect<f32>, Rect<f32>, Rect<f32>) {
let point = Point2D::new(clamp(point.x, rect.origin.x, rect.max_x()),
clamp(point.y, rect.origin.y, rect.max_y()));
let tl_rect = Rect::new(rect.origin,
@@ -189,7 +189,7 @@ pub fn subdivide_rect_into_quadrants(rect: &Rect<f32>, point: &Point2D<f32>) ->
Size2D::new(rect.max_x() - point.x, rect.max_y() - point.y));
let bl_rect = Rect::new(Point2D::new(rect.origin.x, point.y),
Size2D::new(point.x - rect.origin.x, rect.max_y() - point.y));
return [tl_rect, tr_rect, br_rect, bl_rect];
return (tl_rect, tr_rect, br_rect, bl_rect);

fn clamp(x: f32, lo: f32, hi: f32) -> f32 {
if x < lo {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.