From bb401afa2847d6d0211168a8e4fa23fe7b30d835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 30 Aug 2018 01:34:59 +0200 Subject: [PATCH] Minor build_clip_chain_instance cleanup. Just nits I noticed while I was going through the code. --- webrender/src/clip.rs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/webrender/src/clip.rs b/webrender/src/clip.rs index 3b86eb89d1..24811e63cb 100644 --- a/webrender/src/clip.rs +++ b/webrender/src/clip.rs @@ -472,17 +472,11 @@ impl ClipStore { if let Some(clip_rect) = clip_node.item.get_local_clip_rect() { match conversion { ClipSpaceConversion::Local => { - local_clip_rect = match local_clip_rect.intersection(&clip_rect) { - Some(local_clip_rect) => local_clip_rect, - None => return None, - }; + local_clip_rect = local_clip_rect.intersection(&clip_rect)?; } ClipSpaceConversion::Offset(ref offset) => { let clip_rect = clip_rect.translate(offset); - local_clip_rect = match local_clip_rect.intersection(&clip_rect) { - Some(local_clip_rect) => local_clip_rect, - None => return None, - }; + local_clip_rect = local_clip_rect.intersection(&clip_rect)?; } ClipSpaceConversion::Transform(..) => { // TODO(gw): In the future, we can reduce the size @@ -508,20 +502,11 @@ impl ClipStore { current_clip_chain_id = clip_chain_node.parent_clip_chain_id; } - let local_bounding_rect = match local_prim_rect.intersection(&local_clip_rect) { - Some(rect) => rect, - None => return None, - }; + let local_bounding_rect = local_prim_rect.intersection(&local_clip_rect)?; - let pic_clip_rect = match prim_to_pic_mapper.map(&local_bounding_rect) { - Some(pic_bounding_rect) => pic_bounding_rect, - None => return None, - }; + let pic_clip_rect = prim_to_pic_mapper.map(&local_bounding_rect)?; - let world_clip_rect = match pic_to_world_mapper.map(&pic_clip_rect) { - Some(world_clip_rect) => world_clip_rect, - None => return None, - }; + let world_clip_rect = pic_to_world_mapper.map(&pic_clip_rect)?; // Now, we've collected all the clip nodes that *potentially* affect this // primitive region, and reduced the size of the prim region as much as possible.