Bug 1513019 - Fix plane splitting with complex, axis-aligned transforms. r=emilio,kats a=pascalc
authorGlenn Watson <github@intuitionlibrary.com>
Mon, 15 Apr 2019 14:00:23 +0000
changeset 526225 89768dc13409426b5b0ff972b258a27e2454115a
parent 526224 5710827ee9cf5011b6698590a7d31e922f636cf2
child 526226 efb56840fba5d9bf8a5df33cfc5062faf0d91b60
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, kats, pascalc
bugs1513019
milestone67.0
Bug 1513019 - Fix plane splitting with complex, axis-aligned transforms. r=emilio,kats a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D27462
gfx/wr/webrender/src/picture.rs
gfx/wr/wrench/reftests/transforms/big-axis-aligned-scale-ref.yaml
gfx/wr/wrench/reftests/transforms/big-axis-aligned-scale.yaml
gfx/wr/wrench/reftests/transforms/reftest.list
--- a/gfx/wr/webrender/src/picture.rs
+++ b/gfx/wr/webrender/src/picture.rs
@@ -2497,42 +2497,39 @@ impl PicturePrimitive {
         let local_rect = match original_local_rect
             .intersection(combined_local_clip_rect)
         {
             Some(rect) => rect.cast(),
             None => return false,
         };
         let world_rect = world_rect.cast();
 
-        match transform.transform_kind() {
-            TransformedRectKind::AxisAligned => {
-                let inv_transform = transforms
-                    .get_world_inv_transform(prim_instance.spatial_node_index);
-                let polygon = Polygon::from_transformed_rect_with_inverse(
+        if transform.is_simple_translation() {
+            let inv_transform = transforms
+                .get_world_inv_transform(prim_instance.spatial_node_index);
+            let polygon = Polygon::from_transformed_rect_with_inverse(
+                local_rect,
+                &matrix,
+                &inv_transform.cast(),
+                plane_split_anchor,
+            ).unwrap();
+            splitter.add(polygon);
+        } else {
+            let mut clipper = Clipper::new();
+            let results = clipper.clip_transformed(
+                Polygon::from_rect(
                     local_rect,
-                    &matrix,
-                    &inv_transform.cast(),
                     plane_split_anchor,
-                ).unwrap();
-                splitter.add(polygon);
-            }
-            TransformedRectKind::Complex => {
-                let mut clipper = Clipper::new();
-                let results = clipper.clip_transformed(
-                    Polygon::from_rect(
-                        local_rect,
-                        plane_split_anchor,
-                    ),
-                    &matrix,
-                    Some(world_rect),
-                );
-                if let Ok(results) = results {
-                    for poly in results {
-                        splitter.add(poly);
-                    }
+                ),
+                &matrix,
+                Some(world_rect),
+            );
+            if let Ok(results) = results {
+                for poly in results {
+                    splitter.add(poly);
                 }
             }
         }
 
         true
     }
 
     pub fn resolve_split_planes(
new file mode 100644
--- /dev/null
+++ b/gfx/wr/wrench/reftests/transforms/big-axis-aligned-scale-ref.yaml
@@ -0,0 +1,6 @@
+---
+root:
+  items:
+    - type: rect
+      bounds: [ 0, 0, 200, 44 ]
+      color: green
new file mode 100644
--- /dev/null
+++ b/gfx/wr/wrench/reftests/transforms/big-axis-aligned-scale.yaml
@@ -0,0 +1,10 @@
+---
+root:
+  items:
+    - type: stacking-context
+      transform-style: preserve-3d
+      transform: scale(-2, 44, 44727)
+      items:
+        - type: rect
+          bounds: [ -100, -100, 200, 101 ]
+          color: green
--- a/gfx/wr/wrench/reftests/transforms/reftest.list
+++ b/gfx/wr/wrench/reftests/transforms/reftest.list
@@ -33,8 +33,9 @@ platform(linux,mac) fuzzy(9,348) == pers
 platform(linux,mac) fuzzy(1,122) == border-scale.yaml border-scale.png
 platform(linux,mac) fuzzy(1,16) == border-scale-2.yaml border-scale-2.png
 platform(linux,mac) fuzzy(1,69) == border-scale-3.yaml border-scale-3.png
 platform(linux,mac) fuzzy(1,74) == border-scale-4.yaml border-scale-4.png
 # Just make sure we aren't crashing here
 != large-raster-root.yaml blank.yaml
 == flatten-preserve-3d-root.yaml flatten-preserve-3d-root-ref.yaml
 == strange-w.yaml strange-w-ref.yaml
+== big-axis-aligned-scale.yaml big-axis-aligned-scale-ref.yaml