diff --git a/Cargo.lock b/Cargo.lock index 9c00e25178..b99a00db04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -973,7 +973,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "plane-split" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1069,7 +1069,7 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1496,7 +1496,7 @@ dependencies = [ "pathfinder_gfx_utils 0.2.0 (git+https://github.com/pcwalton/pathfinder)", "pathfinder_partitioner 0.2.0 (git+https://github.com/pcwalton/pathfinder)", "pathfinder_path_utils 0.2.0 (git+https://github.com/pcwalton/pathfinder)", - "plane-split 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "plane-split 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1803,7 +1803,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum pathfinder_path_utils 0.2.0 (git+https://github.com/pcwalton/pathfinder)" = "" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f" -"checksum plane-split 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3a4fc9e31d70eb6828e9a2d7a401a824d9f281686a39a8fc06f08796edb1bb" +"checksum plane-split 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "64d766f38b15fe1337bdddfc869ef5c50437323f857aaaadc6490197db80a1b8" "checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b" "checksum proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "effdb53b25cdad54f8f48843d67398f7ef2e14f12c1b4cb4effc549a6462a4d6" "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" diff --git a/webrender/Cargo.toml b/webrender/Cargo.toml index 7c74c9ed0c..037ce18da8 100644 --- a/webrender/Cargo.toml +++ b/webrender/Cargo.toml @@ -32,7 +32,7 @@ image = { optional = true, version = "0.19" } lazy_static = "1" log = "0.4" num-traits = "0.2" -plane-split = "0.12.1" +plane-split = "0.13" png = { optional = true, version = "0.12" } rayon = "1" ron = { optional = true, version = "0.1.7" } diff --git a/webrender/src/batch.rs b/webrender/src/batch.rs index 00bd69e215..b9cc949f22 100644 --- a/webrender/src/batch.rs +++ b/webrender/src/batch.rs @@ -660,8 +660,10 @@ impl AlphaBatchBuilder { &matrix, Some(bounding_rect.to_f64()), ); - for poly in results { - splitter.add(poly); + if let Ok(results) = results { + for poly in results { + splitter.add(poly); + } } } } diff --git a/webrender/src/util.rs b/webrender/src/util.rs index 2b2189a188..846895497a 100644 --- a/webrender/src/util.rs +++ b/webrender/src/util.rs @@ -461,12 +461,20 @@ pub fn project_rect( // Otherwise, it will be clamped to the screen bounds anyway. if homogens.iter().any(|h| h.w <= 0.0) { let mut clipper = Clipper::new(); - clipper.add_frustum( + let polygon = Polygon::from_rect(*rect, 1); + + let planes = match Clipper::frustum_planes( transform, Some(*bounds), - ); + ) { + Ok(planes) => planes, + Err(..) => return None, + }; + + for plane in planes { + clipper.add(plane); + } - let polygon = Polygon::from_rect(*rect, 1); let results = clipper.clip(polygon); if results.is_empty() { return None