Bug 1513019 - Fix plane splitting with complex, axis-aligned transforms. r=emilio,kats
authorGlenn Watson <github@intuitionlibrary.com>
Mon, 15 Apr 2019 14:00:23 +0000
changeset 469494 b4a7ea516329
parent 469493 b22a06518604
child 469495 04185cfeb1ae
push id35873
push userccoroiu@mozilla.com
push dateMon, 15 Apr 2019 21:36:26 +0000
treeherdermozilla-central@b8f49a14c458 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, kats
bugs1513019
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1513019 - Fix plane splitting with complex, axis-aligned transforms. r=emilio,kats 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
@@ -2524,42 +2524,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