Skip to content

Commit

Permalink
Auto merge of #3307 - emilio:cleanup, r=kvark
Browse files Browse the repository at this point in the history
Deindent a bunch of code.

Just some minor cleanup while I was looking at this code.

<!-- 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/3307)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Nov 13, 2018
2 parents 130f943 + 4e61f12 commit 2a9ddf2
Showing 1 changed file with 59 additions and 58 deletions.
117 changes: 59 additions & 58 deletions webrender/src/segment.rs
Expand Up @@ -234,71 +234,72 @@ impl SegmentBuilder {
) {
self.has_interesting_clips = true;

if inner_rect.is_well_formed_and_nonempty() {
debug_assert!(outer_rect.contains_rect(&inner_rect));

let p0 = outer_rect.origin;
let p1 = inner_rect.origin;
let p2 = inner_rect.bottom_right();
let p3 = outer_rect.bottom_right();

let segments = &[
LayoutRect::new(
LayoutPoint::new(p0.x, p0.y),
LayoutSize::new(p1.x - p0.x, p1.y - p0.y),
),
LayoutRect::new(
LayoutPoint::new(p2.x, p0.y),
LayoutSize::new(p3.x - p2.x, p1.y - p0.y),
),
LayoutRect::new(
LayoutPoint::new(p2.x, p2.y),
LayoutSize::new(p3.x - p2.x, p3.y - p2.y),
),
LayoutRect::new(
LayoutPoint::new(p0.x, p2.y),
LayoutSize::new(p1.x - p0.x, p3.y - p2.y),
),
LayoutRect::new(
LayoutPoint::new(p1.x, p0.y),
LayoutSize::new(p2.x - p1.x, p1.y - p0.y),
),
LayoutRect::new(
LayoutPoint::new(p2.x, p1.y),
LayoutSize::new(p3.x - p2.x, p2.y - p1.y),
),
LayoutRect::new(
LayoutPoint::new(p1.x, p2.y),
LayoutSize::new(p2.x - p1.x, p3.y - p2.y),
),
LayoutRect::new(
LayoutPoint::new(p0.x, p1.y),
LayoutSize::new(p1.x - p0.x, p2.y - p1.y),
),
];
if !inner_rect.is_well_formed_and_nonempty() {
self.items.push(Item::new(
outer_rect,
None,
true
));
return;
}

for segment in segments {
self.items.push(Item::new(
*segment,
None,
true
));
}
debug_assert!(outer_rect.contains_rect(&inner_rect));

if inner_clip_mode.is_some() {
self.items.push(Item::new(
inner_rect,
inner_clip_mode,
false,
));
}
} else {
let p0 = outer_rect.origin;
let p1 = inner_rect.origin;
let p2 = inner_rect.bottom_right();
let p3 = outer_rect.bottom_right();

let segments = &[
LayoutRect::new(
LayoutPoint::new(p0.x, p0.y),
LayoutSize::new(p1.x - p0.x, p1.y - p0.y),
),
LayoutRect::new(
LayoutPoint::new(p2.x, p0.y),
LayoutSize::new(p3.x - p2.x, p1.y - p0.y),
),
LayoutRect::new(
LayoutPoint::new(p2.x, p2.y),
LayoutSize::new(p3.x - p2.x, p3.y - p2.y),
),
LayoutRect::new(
LayoutPoint::new(p0.x, p2.y),
LayoutSize::new(p1.x - p0.x, p3.y - p2.y),
),
LayoutRect::new(
LayoutPoint::new(p1.x, p0.y),
LayoutSize::new(p2.x - p1.x, p1.y - p0.y),
),
LayoutRect::new(
LayoutPoint::new(p2.x, p1.y),
LayoutSize::new(p3.x - p2.x, p2.y - p1.y),
),
LayoutRect::new(
LayoutPoint::new(p1.x, p2.y),
LayoutSize::new(p2.x - p1.x, p3.y - p2.y),
),
LayoutRect::new(
LayoutPoint::new(p0.x, p1.y),
LayoutSize::new(p1.x - p0.x, p2.y - p1.y),
),
];

for segment in segments {
self.items.push(Item::new(
outer_rect,
*segment,
None,
true
));
}

if inner_clip_mode.is_some() {
self.items.push(Item::new(
inner_rect,
inner_clip_mode,
false,
));
}
}

// Push some kind of clipping region into the segment builder.
Expand Down

0 comments on commit 2a9ddf2

Please sign in to comment.