Skip to content

Commit

Permalink
Deindent a bunch of code.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Nov 13, 2018
1 parent 652e3f8 commit 4e61f12
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 4e61f12

Please sign in to comment.